最新资讯
nytimes.com 美众议院共和党领袖要求 Nvidia 黄仁勋闭门简报 pub.towardsai.net 忘掉我:为记忆而设计的系统中的删除难题 unite.ai Airbnb 计划推出覆盖规划、预订与客服的 AI 旅行 agent techcrunch.com Airbnb 称将于 2027 年上半年推出 AI 旅行代理 theverge.com Perplexity 推出面向工作的 AI 代理 Teammates unite.ai Five9 拟以约3.25亿美元收购 Level AI,扩展客服AI分销渠道 unite.ai Serve Robotics 向物理AI公司开放车队软件与数据 wired.com 聊天机器人广告时代到来:哪些做法有效、哪些无效 techmeme.com METR:Anthropic 删减了评估报告中最具信息量的证据 unite.ai 微软借助 AI 修复更多 Windows 漏洞,但补丁部署仍滞后 bloomberg.com Cloudflare 上调年度利润预期,AI 推动网络需求 theinformation.com Anthropic 为 Claude 推出个人理财功能
多元动态
登录 注册
行业动态 aws.amazon.com · @Rushabh Lokhande

使用Amazon Textract为Amazon Bedrock知识库定制大型复杂文档处理

原文 我的收藏

本文介绍如何结合Amazon Textract的高精度文本提取与Amazon Bedrock的生成式AI,处理大型复杂文档。文中展示了摄取和预处理PDF及图像的流程,并演示如何规模化查询公用事业账单以加速处理。

AI推荐理由 此方案将OCR与知识库结合,直接解决RAG中复杂文档解析的准确性问题,使企业能规模化处理PDF和扫描件,降低手动清洗成本。云厂商服务集成日益紧密,AI工程化门槛继续下降。

88

正文

对于每月处理数千份水电费账单的客户服务团队来说,准确解析和分析复杂的多页文档是一个持续的挑战。不一致的格式、密集的表格和多变的布局使得难以快速提取正确的信息。这导致响应延迟、计费错误和客户不满。随着文档量的增长,这些低效率问题会加剧,使组织无法利用手中已有的数据。Amazon Bedrock与Amazon Textract集成,提供了解决此问题的检索和生成能力。通过将Amazon Textract对结构化内容的高精度提取与Amazon Bedrock的生成式AI能力相结合,组织可以从手动搜索文档转变为以编程方式查询文档。这可以从水电费账单中大规模解锁可操作的见解,并提供更快、更准确的客户互动。在本文中,我们演示如何与复杂PDF和图像格式的水电费账单聊天,解析它们,分析内容,并标记相关表格以帮助大型语言模型(LLM)提取最有用的信息。您可以在GitHub上找到本文的代码。用例概述 客户服务支持团队收到大量关于水电费账单的查询,涵盖计费、使用量、支付和客户服务等多个领域。该团队难以高效解析和分析这些查询,这些查询以PDF、DOCX、TXT、HTML和XLSX等多种格式出现。从这些文档中手动提取相关信息的过程耗时且容易出错,导致响应时间延迟和客户不满。为了解决该问题,客户最初尝试使用水电费账单直接实施检索增强生成(RAG)解决方案。然而,他们很快遇到了重大问题。用于从这些文档中提取信息的大型语言模型(LLM)遗漏了关键细节,在某些情况下,产生幻觉并提供不正确或不相关的信息。这使客户意识到,简单地将文档和水电费账单以原始形式加载不会产生可靠、准确的响应。客户服务支持团队需要一个强大的解决方案来准确提取和分析各种水电费账单中的信息,这些账单有多种格式:PDF、DOCX、TXT、HTML、PNG和XLSX。该团队旨在构建一个基于RAG的解决方案,能够可靠地提取相关信息,如账号、计费详情和支付说明,以提供准确及时的客户查询响应。客户的初始方法涉及将原始水电费账单直接输入RAG模型。这种方法有几个缺点:数据提取不完整:LLM难以提取所有必要信息,经常遗漏关键细节,如到期日、支付金额和账号。幻觉:模型偶尔生成不正确或不相关的信息,导致客户服务响应混乱和错误。格式可变性:水电费账单的不同格式(PDF、DOCX、TXT、HTML、XLSX)对LLM构成挑战,导致不同文档类型的性能不一致。在观察到这些问题后,客户很快意识到需要更复杂的方法。简单地将原始文档加载到RAG模型中是不够的。团队需要一种预处理和增强水电费账单的方法,以便LLM能够准确提取和使用必要信息。支持的类型 目前支持以下文件类型:PDF、DOCX、TXT、HTML、XLSX和PNG。PDF(便携式文档格式)。Amazon Textract可以从多页PDF文档中提取文本,包括具有复杂布局和嵌入图像的文档。DOCX(Microsoft Word文档)。Amazon Textract可以解析并从Word文档中提取文本,包括表格、图像和其他嵌入对象。TXT(纯文本文件)。可以解析纯文本文件以提取文本内容。HTML(超文本标记语言)。Amazon Textract可以从HTML文件中提取文本,包括标签内的结构化数据。XLSX(Microsoft Excel电子表格)。虽然主要是一种文本提取工具,但Amazon Textract可以从Excel电子表格中提取文本,包括单元格内容和表格数据。PNG(便携式网络图形)。Amazon Textract可以从PNG文件中提取文本。解决方案概述 为了应对这些挑战,客户可以选择将Amazon Textract(一种文本提取服务)与Amazon Bedrock集成。这种集成提供以下功能:高级文本提取:Amazon Textract预处理水电费账单,从各种格式中提取文本并捕获所有相关信息。数据清理和丰富:提取的数据被清理和丰富,以去除噪音和不相关信息,以便只有最相关的细节被输入RAG模型。上下文理解:Amazon Textract使用上下文理解来准确标记和标记提取的数据,使LLM更容易处理和生成准确的响应。通过实施这种方法,客户服务团队旨在构建更可靠的基于RAG的解决方案。该解决方案可以准确提取和使用水电费账单中的信息,改善响应时间和客户满意度。部署解决方案 为了部署解决方案,已创建了一个shell脚本,用于创建AWS CloudFormation堆栈并根据解决方案的需要部署依赖资源。要运行shell脚本,请按照以下步骤操作:从GitHub克隆仓库。导航到custom-knowledge-base目录。打开终端并运行bash custom_kb_deployment_setup.sh。这会为您部署AWS CloudFormation堆栈。CloudFormation堆栈创建以下 账户中的资源:AWS Lambda执行角色。用于Lambda函数的Lambda层。两个Lambda函数。一个Amazon简单存储服务(Amazon S3)存储桶。一个Amazon OpenSearch Serverless集群。Amazon Bedrock知识库。用于Amazon Bedrock知识库的AWS身份和访问管理(IAM)角色。部署后步骤 堆栈部署完成后,完成以下步骤以配置解决方案。配置Amazon S3 打开Amazon S3控制台。找到创建的S3存储桶,命名为document--。创建一个名为raw_files的文件夹。将仓库中提供的水电费账单上传到raw_files。自动处理 文件上传触发document-parser Lambda函数。Amazon Textract作业处理原始文件。处理后的文件保存到parsed_files文件夹。第二个Lambda函数将文件处理为TXT格式。最终输出保存到parsed_kb_documents文件夹。知识库设置 打开Amazon Bedrock控制台并导航到Amazon Bedrock知识库,这是用于构建检索增强生成解决方案的完全托管能力。在左侧导航窗格中,选择知识库。选择新创建的知识库。选择数据源。选择数据源并选择同步。等待同步完成。测试应用程序 打开Amazon Bedrock控制台并选择知识库。选择文本知识库。在配置下,选择Amazon Nova Micro模型。有关模型在各AWS区域的可用性,请参阅Amazon Bedrock中按AWS区域支持模型。在右侧的文本框中,您现在可以询问与水费账单相关的问题。图1:使用自定义知识库解决方案的输出 图2:不使用自定义知识库解决方案的输出 摘要 本指南概述了使用AWS服务部署自定义知识库解决方案的过程。该解决方案使用AWS CloudFormation自动创建基本资源,包括Lambda函数、S3存储桶、OpenSearch Serverless集群和Amazon Bedrock知识库。部署过程运行一个shell脚本,该脚本启动部署解决方案所需的CloudFormation堆栈创建。部署后步骤包括配置S3存储桶、上传示例文档和设置Amazon Bedrock知识库。该解决方案自动处理上传的文档,将其转换为适合知识库的格式。结论 此自定义知识库解决方案演示了如何集成多个AWS服务来创建智能文档处理和查询系统。通过使用CloudFormation进行部署,该解决方案在不同环境中创建一致、可重复的基础设施。从原始文件上传到知识库集成的自动化文档处理流水线,展示了可扩展、高效处理大型文档集的潜力。负责任AI考虑 在生产中部署基于RAG的解决方案时,实施保障措施以确保可靠、可信的输出非常重要。Amazon Bedrock Guardrails提供可配置的控制,以过滤有害内容、阻止拒绝的主题,并从输入和输出中编辑敏感信息。此外,接地验证通过评估模型响应是否由检索到的源文档支持,帮助检测和减少幻觉。对于生产部署,我们建议启用这些控制,以在知识库交互中保持准确性、合规性和用户信任。此解决方案对于处理大量结构化文档的组织特别有价值,例如本例中的水电费账单。它提供了一种简化提取、处理和查询这些文档信息的方式,可能提高运营效率并支持更复杂的数据分析。未来的增强可能包括扩展处理的文档类型、与更多AWS服务集成以进行更复杂的分析,或开发用户友好的前端界面以便更容易与知识库交互。总体而言,此解决方案为希望在AWS上构建智能文档处理和查询系统的组织提供了一个坚实的起点,并具有根据特定业务需求定制和扩展的灵活性。关于作者 Rushabh Lokhande Rushabh是AWS专业服务分析实践的高级数据与AI工程师。他帮助客户实施大数据、机器学习和分析解决方案。在工作之外,他喜欢与家人共度时光、阅读、跑步和打高尔夫球。Jeevith Anumalla Jeevith是AWS专业服务的高级数据架构师,专门设计可扩展的云架构并指导客户完成数字化转型之旅。他帮助组织利用AWS服务现代化应用程序、优化成本并推动创新。在工作之外,他喜欢旅行、指导有抱负的技术人员以及徒步旅行。Ashish Bhagam Ashish是AWS专业服务分析实践的数据架构师。他帮助客户设计和实施可扩展的数据解决方案并现代化其数据架构。在工作之外,他喜欢观看板球比赛并与家人共度美好时光。
查看原文(中文正文为 AI 翻译)
For customer service teams handling thousands of utility bills each month, accurately parsing and analyzing complex, multi-page documents is a persistent challenge. Inconsistent formats, dense tables, and varied layouts make it difficult to extract the right information quickly. This leads to delayed responses, billing errors, and frustrated customers. As document volumes grow, these inefficiencies compound, leaving organizations unable to act on the data already in their hands. Amazon Bedrock, integrated with Amazon Textract, provides the retrieval and generation capabilities to solve this. By combining the high-accuracy extraction of structured and unstructured content from Amazon Textract with the generative AI capabilities of Amazon Bedrock, organizations can move from manually searching through documents to programmatically querying them. This unlocks actionable insights from utility bills at scale and delivers faster, more accurate customer interactions. In this post, we demonstrate how to chat with utility bills in complex PDF and image formats, parse them, analyze the content, and tag the relevant tables to help large language models (LLMs) extract the most useful information. You can find the code for this post on GitHub. Use cases overview A customer service support team receives a multitude of queries regarding utility bills, spanning across various domains such as billing, usage, payment, and customer service. The team struggles to efficiently parse and analyze these queries, which come in various formats including PDF, DOCX, TXT, HTML, and XLSX. The manual process of extracting relevant information from these documents is time-consuming and prone to errors, leading to delays in response times and customer dissatisfaction. To solve the problem statement, the customer initially attempted to implement a Retrieval Augmented Generation (RAG) solution using the utility bills directly. However, they quickly encountered significant issues. The large language model (LLM) used to extract information from these documents was missing key details and, in some cases, hallucinating and providing incorrect or irrelevant information. This led the customer to realize that simply loading the documents and utility bills in their raw form would not produce reliable, accurate responses. The customer service support team needed a robust solution to accurately extract and analyze information from various utility bills, which come in multiple formats: PDF, DOCX, TXT, HTML, PNG, and XLSX. The team aimed to build a RAG-based solution that could reliably extract relevant information, such as account numbers, billing details, and payment instructions, to provide accurate and timely responses to customer queries. The customer’s initial approach involved feeding the raw utility bills directly into the RAG model. This method had several drawbacks: Incomplete data extraction: The LLM struggled to extract all necessary information, often missing critical details such as due dates, payment amounts, and account numbers. Hallucinations: The model occasionally generated incorrect or irrelevant information, leading to confusion and errors in customer service responses. Format variability: The different formats of the utility bills (PDF, DOCX, TXT, HTML, XLSX) posed challenges for the LLM, resulting in inconsistent performance across different document types. After observing these issues, the customer quickly realized that a more sophisticated approach was needed. Simply loading the raw documents into the RAG model was insufficient. The team needed a method to preprocess and enhance the utility bills so that the LLM could accurately extract and use the necessary information. Supported types The following file types are currently supported: PDF, DOCX, TXT, HTML, XLSX, and PNG. PDF (Portable Document Format). Amazon Textract can extract text from multi-page PDF documents, including those with complex layouts and embedded images. DOCX (Microsoft Word Document). Amazon Textract can parse and extract text from Word documents, including tables, images, and other embedded objects. TXT (Plain Text Files). Plain text files can be parsed to extract text content. HTML (HyperText Markup Language). Amazon Textract can extract text from HTML files, including structured data within tags. XLSX (Microsoft Excel Spreadsheet). While primarily a text extraction tool, Amazon Textract can extract text from Excel spreadsheets, including cell contents and table data. PNG (Portable Network Graphics). Amazon Textract can extract text from PNG files. Solution overview To address these challenges, the customer can choose to integrate Amazon Textract, a text extraction service, with Amazon Bedrock. This integration provides the following: Advanced text extraction: Amazon Textract preprocesses the utility bills, extracting text from various formats and capturing all relevant information. Data cleaning and enrichment: The extracted data is cleaned and enriched to remove noise and irrelevant information, so that only the most pertinent details are fed into the RAG model. Contextual understanding: Amazon Textract uses contextual understanding to accurately label and tag the extracted data, making it easier for the LLM to process and generate accurate responses. By implementing this approach, the customer service team aims to build a more reliable RAG-based solution. This solution can accurately extract and use information from utility bills, improving response times and customer satisfaction. Deploy the solution To deploy the solution, a shell script has been created that creates the AWS CloudFormation stack and deploys dependency resources as needed for the solution. To run the shell script, follow these steps: Clone the repository from GitHub. Navigate to the custom-knowledge-base directory. Open a terminal and run bash custom_kb_deployment_setup.sh. This deploys the AWS CloudFormation stack for you. The CloudFormation stack creates the following resources in your account: AWS Lambda Execution Role. Lambda layer used for Lambda function. Two Lambda functions. One Amazon Simple Storage Service (Amazon S3) bucket. One Amazon OpenSearch Serverless cluster. Amazon Bedrock Knowledge Bases. AWS Identity and Access Management (IAM) role for Amazon Bedrock knowledge base. Post-deployment steps After the stack finishes deploying, complete the following steps to configure the solution. Configure Amazon S3 Open the Amazon S3 console. Locate the created S3 bucket named document--. Create a folder named raw_files. Upload the provided utility bills from the repository to raw_files. Automated processing A file upload triggers the document-parser Lambda function. Amazon Textract jobs process the raw files. Processed files are saved to the parsed_files folder. A second Lambda function processes the files into TXT format. The final output is saved to the parsed_kb_documents folder. Knowledge base setup Open the Amazon Bedrock console and navigate to Amazon Bedrock Knowledge Bases, the fully managed capability for building retrieval-augmented generation solutions. In the left navigation pane, choose Knowledge Bases. Select the newly created knowledge base. Choose Data source. Select the data source and choose Sync. Wait for the sync to complete. Test the application Open the Amazon Bedrock console and select the knowledge base. Select Text Knowledge Base. Under configurations, select the Amazon Nova Micro model. For model availability by AWS Region, refer to Supported models by AWS Region in Amazon Bedrock. In the text box on the right, you can now ask questions related to the utility bills. Figure 1: Output with the custom knowledge base solution Figure 2: Output without the custom knowledge base solution Summary This guide outlines the deployment process for a custom knowledge base solution using AWS services. The solution uses AWS CloudFormation to automate the creation of essential resources, including Lambda functions, S3 buckets, an OpenSearch Serverless cluster, and an Amazon Bedrock knowledge base. The deployment process runs a shell script that initiates the CloudFormation stack creation required for deploying the solution. The post-deployment steps include configuring the S3 bucket, uploading sample documents, and setting up the Amazon Bedrock knowledge base. The solution automatically processes uploaded documents, transforming them into a format suitable for the knowledge base. Conclusion This custom knowledge base solution demonstrates how to integrate multiple AWS services to create an intelligent document processing and querying system. By using CloudFormation for deployment, the solution creates consistent, repeatable infrastructure across different environments. The automated document processing pipeline, from raw file upload to knowledge base integration, shows the potential for scalable, efficient handling of large document sets. Responsible AI considerations When deploying RAG-based solutions in production, it is important to implement safeguards for reliable, trustworthy outputs. Amazon Bedrock Guardrails provides configurable controls to filter harmful content, block denied topics, and redact sensitive information from both inputs and outputs. Additionally, grounding validation helps detect and reduce hallucinations by evaluating whether model responses are supported by the retrieved source documents. For production deployments, we recommend turning on these controls to maintain accuracy, compliance, and user trust across your knowledge base interactions. This solution can be particularly valuable for organizations dealing with large volumes of structured documents, such as utility bills in this example. It provides a streamlined way to extract, process, and query information from these documents, potentially improving operational efficiency and supporting more sophisticated data analysis. Future enhancements could include expanding the types of documents processed, integrating with additional AWS services for more complex analysis, or developing a user-friendly front-end interface for easier interaction with the knowledge base. Overall, this solution serves as a solid starting point for organizations looking to build intelligent document processing and querying systems on AWS, with the flexibility to customize and expand based on specific business needs. About the authors Rushabh Lokhande Rushabh is a Senior Data & AI Engineer with AWS Professional Services Analytics Practice. He helps customers implement big data, machine learning, and analytics solutions. Outside of work, he enjoys spending time with family, reading, running, and playing golf. Jeevith Anumalla Jeevith is a Senior Data Architect with AWS Professional Services, specializing in designing scalable cloud architectures and guiding customers through their digital transformation journey. He helps organizations leverage AWS services to modernize applications, optimize costs, and drive innovation. Outside of work, he enjoys traveling, mentoring aspiring technologists, and hiking. Ashish Bhagam Ashish is a Data Architect with AWS Professional Services Analytics Practice. He helps customers design and implement scalable data solutions and modernize their data architectures. Outside of work, he enjoys watching cricket matches and spending quality time with his family.

来源报道 · 3 篇 · 以下链接均前往原始媒体

opmlrss::AWS Machine Learning Blog 使用Amazon Textract为Amazon Bedrock知识库定制大型复杂文档处理 09-05 · 原文发布
← 返回精选动态 原文

更多内容