Streamline financial workflows with generative AI for email automation

Machine Learning


Many businesses across all industries still rely on laborious, error-prone manual procedures to process documents, especially documents sent via email. Despite the availability of technology that can digitize and automate document workflows through intelligent automation, businesses still rely primarily on labor-intensive manual document processing. This represents a huge opportunity for businesses to optimize this workflow, save time, costs, and improve accuracy by modernizing outdated manual document processing with AWS Intelligent Document Processing (IDP). To extract key information from emails and large volumes of documents from various sources, businesses need comprehensive automation that enables email ingestion, file uploads, and system integration for seamless processing and analysis. Intelligent automation offers an opportunity to revolutionize document workflows across sectors through digitization and process optimization.

In this post, we discuss generative artificial intelligence (AI) techniques for extracting insights from business emails and attachments. We explain how AI can optimize financial workflow processes by automatically summarizing documents, extracting data, and classifying information from email attachments, helping businesses serve more customers, reassign employees to higher-value tasks, speeding up processes, reducing expenses, improving data accuracy, and increasing efficiency.

Challenges with Manual Data Extraction

Currently, most business sectors suffer from manual document processing, reading emails and their attachments without using any automated system. These steps are costly, time-consuming and error-prone. Manual processes struggle to keep up with the number of documents. It is difficult to find the relevant information required for business decisions. Hence, there is a demand for shorter decision-making cycles and faster document processing. The aim of this article is to help companies that process documents manually to speed up the delivery of data derived from those documents for use in business operations. By reducing the time and ongoing costs associated with manual workflows, organizations can become more productive, responsive and innovative through data analytics.

In the past, optical character recognition (OCR) worked for perfect documents, but when document quality was imperfect, the performance of those old systems often did not meet customer needs. Manual processes inevitably lead to errors, and double-checking every task is costly and time-consuming, creating fluctuations in workflow. Businesses with seasonal variations in customer demand face challenges in staffing document processing to maintain responsive customer service. The key is to efficiently extract the most important data from a mountain of documents to enable fast decisions. For example, a mortgage application may be over 1,000 pages long, but only about a dozen data points have a critical impact on a credit decision. The key is to accurately identify the key details amid the sea of ​​information and approve the loan in a timely manner while providing excellent service to the applicant.

In this post, we discuss how generative AI can make it easier to work with business documents and email attachments. An example business consideration is the financial industry, which has a growing user base. These industries require back-office automation solutions to extract details from emails and attachments, summarize content for downstream transmission, classify documents and content, and assign documents to human reviewers when required. At the same time, the solution must provide data security, including PII and SOC compliance.

Solution overview

The code that accompanies this solution is available in our GitHub repository. This solution walks you through two steps to deploying generative AI for email automation.

  • Data is extracted from email attachments and classified using various stages of Intelligent Document Processing (IDP), an industry term used to describe mechanisms that use AI and machine learning (ML) to process and extract information from structured, semi-structured, and unstructured documents.
  • Summarizing data using large-scale language models (LLMs).

The following diagram outlines the pipeline steps you might take when developing an IDP solution.

The data capture stage extracts documents from emails, compiles them, and securely stores them as input documents. There are different types of documents and sometimes there is no way to automatically identify and classify them. However, you can bypass the classification process and go directly to the next stage, which accurately extracts information from documents. The enrichment stage allows you to take data and language from documents and apply it in a meaningful way to enhance that data. Human review is the last stage in the process, where you can request human evaluation on low-accuracy extracted data. Customers in highly regulated sectors such as financial services and healthcare are adding human evaluation to their pipelines to review data points.

This solution has the following key advantages:

  • Elasticity – Flexible to scale up or down to meet your business needs
  • innovation – Automate the extraction of document data sent via email channels
  • Cost reduction – Optimize manual labor costs and associated operational costs

Data Extraction Workflow

The following diagram outlines the stages through which you might streamline your financial workflow to build a solution.

The first phase focuses on securely collecting and compiling data from documents, including email attachments. However, if you already have identifiable documents, you can bypass the classification process and move directly to the next phase. The second step accurately extracts information from documents. The third step allows you to build meaningful extensions to these documents using the extracted text and data. The fourth and final step uses foundational models (FMs) to standardize keys and values. This stage focuses on tailoring form data, including elements such as first name, phone number format, and more, to the specific format required by individual customers. The transformed data is then tailored to the format required by downstream databases. In cases of low trust scores or in industries that are subject to heavy regulation, form data may be sent for human review. These automated stages can be used together or separately, which can significantly reduce costs, eliminate manual effort, and improve document processing outcomes for your business.

AWS Architecture

The following diagram shows the extended architecture of the example system and explains how AWS services are used to integrate the end-to-end process.

After incoming email attachments are received and the input documents are securely stored, AWS document processing services and FM assist with extraction and summarization in the required format.

  • Amazon Simple Storage Service (Amazon S3) stores documents in a variety of formats generated from physical or digital mailrooms, email attachments, or user uploads from web or mobile apps, providing efficient processing and scalability.
  • Amazon Textract leverages the power of years of NLP and other ML advancements to go beyond traditional OCR technologies. Amazon Textract automatically extracts data, such as printed text, handwriting, layout elements, key-value pairs, and tabular information, from any document or image.
  • Amazon Comprehend can automatically classify text to extract insights and also provides NLP capabilities, with pre-trained models that can identify entities such as places, people, brands, and events, determine the language of text, extract key phrases, understand how positive or negative the sentiment of text is, and automatically organize a collection of text files by topic.
  • Amazon Bedrock is AWS' enterprise cloud platform that makes it easy to build and scale generative AI applications using FM. It provides the tools and infrastructure required to easily and cost-effectively deploy, monitor, scale, and manage AI/ML models. You can then have natural conversations with LLM models available in Amazon Bedrock to derive insights from vectorized data.

In our GitHub repository, we demonstrate how to combine Amazon Textract with LangChain to extract data from documents and use generative AI at different stages of your IDP. These samples demonstrate different ways to use LLM.

Prerequisites

Before you begin developing document workflows, there are a few prerequisite steps to complete. For more information on how to integrate Amazon Textract with LangChain as a document loader to extract data from documents and use generative AI capabilities within different IDP phases, see the GitHub repository. The following imports are specific to document extraction from emails.

!pip install unstructured
!pip install anthropic
import boto3 from langchain.llms.bedrock import Bedrock

Read emails and attachments

Configuration UnstructuredEmailLoader This is explained in the following code, which also summarizes the content of the email:

from langchain.document_loaders import UnstructuredEmailLoader
loader = UnstructuredEmailLoader("SampleDocument.eml")
document = loader.load()

template = """
summarize the email by associating tasks to different agents and as a next step
<document>{doc_text}</<document>
<summary>
"""
prompt = PromptTemplate(template=template, input_variables=["doc_text"])

llm_chain = LLMChain(prompt=prompt, llm=llm)
summary = llm_chain.run(document[0].page_content)
print(summary.replace("</summary>","").strip())

cleaning

To clean up your resources, follow the cleanup instructions specified in the GitHub repository.

Conclusion

In this article, we discussed how generative AI for email automation can be used to streamline finance workflows, including extracting data from email attachments, classifying documents, and summarizing and processing documents using IDP to derive insights. By exploring the various stages of the IDP pipeline, you can use the LLM workflow to enhance your own IDP pipeline.

To extend this solution, consider the following:

  • Using personalized data Retrieval Augmented Generation (RAG) correlation in LLM
  • It keeps summarized data private and accepts existing data sources as augmented inputs to desired decision outcomes.

For more information, see the following resources:


About the Author

Hariharan Nanmalvar He is a Solutions Architect at AWS and a technology professional with over 20 years of experience designing and implementing innovative solutions to solve complex business challenges. He has worked across a wide range of industries and customer domains, helping companies leverage machine learning and AI to streamline operations, improve efficiency, and enhance customer experience.

Raghavarao Sodhavathina He is a Principal Solutions Architect at AWS, specializing in Data Analytics, AI/ML and Serverless Platforms. He works with customers to create innovative solutions that address their business problems and accelerate their adoption of AWS services. In his spare time, he enjoys spending time with his family, reading books and watching movies.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *