Skip to content

Commit bd57797

Browse files
author
Bob Strahan
committed
Merge branch 'develop' v0.3.20
2 parents a8e410a + 851b3d1 commit bd57797

File tree

65 files changed

+9378
-622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+9378
-622
lines changed

CHANGELOG.md

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,54 @@ SPDX-License-Identifier: MIT-0
99

1010
### Added
1111

12-
- **Agentic extraction preview with Strands agents** delivering structured field validation, configurable review flows, and sample notebooks/assets for Pattern-2 lending documents.
13-
- Agentic extraction utilises Strands Agent framework to produce structured outputs in an iterative and self reviewing agent loop. It utilises tools for interacting with the output which will be extended in the future.
14-
- Through the library this already allows users to utilise the `structured_output` function from the `lib/idp_common_pkg/idp_common/extraction/agentic_idp.py` to request extractions using Pydantic Models with custom validators defined. We intend to enable deeper validation customizations through the UI as well in the future.
15-
- **Containerized Pattern-2 deployment pipeline** that builds and pushes all Lambda images via CodeBuild using the new Dockerfile, plus automated ECR cleanup and tests.
12+
- **Agentic extraction preview with Strands agents (experimental)** introducing intelligent, self-correcting document extraction with improved schema compliance and accuracy improvements over traditional methods.
13+
- Leverages the Strands Agent framework with iterative validation loops and automatic error correction to deliver schema compliance
14+
- Provides structured output through Pydantic models with built-in validators, automatic retry handling, and superior handling of complex nested structures and date standardization
15+
- Includes sample notebooks and configuration assets demonstrating agentic extraction for Pattern-2 lending documents
16+
- Programmatic access available via `structured_output` function in `lib/idp_common_pkg/idp_common/extraction/agentic_idp.py`
17+
- Currently this is an experimental feature. Future extensibility includes UI-based validation customization, code generation, and Model Context Protocol (MCP) integration for external data enrichment during extraction
18+
19+
- **IDP CLI - Command Line Interface for Batch Document Processing**
20+
- Added CLI tool (`idp_cli/`) for programmatic batch document processing and stack management
21+
- **Key Features**: Deploy/update/delete CloudFormation stacks, process and reprocess documents from local directories or S3 URIs, live progress monitoring with rich terminal UI, download processing results locally, validate manifests before processing, generate manifests from directories with automatic baseline matching
22+
- **Selective Reprocessing**: New `rerun-inference` command to reprocess documents from specific pipeline steps (classification or extraction) while leveraging existing OCR data for cost/time optimization
23+
- **Evaluation Framework**: Workflow for accuracy testing including initial processing, manual validation, baseline creation, and automated evaluation with detailed metrics
24+
- **Analytics Integration**: Query aggregated results via Athena SQL or use Agent Analytics in Web UI for visual analysis
25+
- **Use Cases**: Rapid configuration iteration, large-scale batch processing, CI/CD integration, automated accuracy testing, automated environment cleanup, prompt engineering experiments
26+
- **Documentation**: README with Quick Start, Commands Reference, Evaluation Workflow, and troubleshooting guides
27+
28+
- **Extraction Results Integration in Summarization Service**
29+
- Integrates extraction results from the extraction service into summarization module for context-aware summaries
30+
- **Features**: Fully backward compatible (works with or without extraction results), automatic section handling, error resilient with graceful continuation, comprehensive logging
31+
- **Configuration**: Enable by adding `{EXTRACTION_RESULTS}` placeholder to `task_prompt` in config.yaml
32+
- **Benefits**: Context-aware summaries referencing extracted values, improved accuracy and quality, better extraction-summary alignment
1633

1734
### Changed
1835

19-
- Updated Pattern-2 templates, `publish.py`, and documentation to detect container builds, surface new prerequisites (Docker/ECR), and detail enabling agentic extraction.
36+
- **Containerized Pattern-2 deployment pipeline** that builds and pushes all Lambda images via CodeBuild using the new Dockerfile, plus automated ECR cleanup and tests.
2037
- Lambda docker image deployments have a 10 GB image size limit compared to the 250 MB zip limit of regular deployment. This however doesn't allow for viewing the code in the AWS console.
2138
The change was introduced to accommodate the increased package size of introducing Strands into the package dependencies.
2239

40+
### Fixed
41+
- **Discovery function times out when processing large documents.**
42+
- increase lambda discovery processor timeout to 900s
43+
- **Corrected baseline directory structure documentation in evaluation.md**
44+
- Fixed incorrect baseline structure showing flat `.json` files instead of proper directory hierarchy
45+
- Updated to correct structure: `<document-name>/sections/1/result.json`
46+
- Reorganized document for better logical flow and user experience
47+
- **GovCloud Template Generation - Removed GraphQLApi References** - #82
48+
- Fixed invalid GovCloud template generation where ProcessChanges AppSync resources were not being removed, causing "Fn::GetAtt references undefined resource GraphQLApi" errors
49+
- Updated `scripts/generate_govcloud_template.py` to remove all ProcessChanges-related resources and extend AppSync parameter cleanup to all pattern stacks
50+
- Fixed InvalidClientTokenId validation error by ensuring CloudFormation client uses the correct region when validating templates (commercial vs GovCloud)
51+
- **Enhanced Processing Flow Visualization for Disabled Steps**
52+
- Fixed UX issue where disabled processing steps (when `summarization.enabled: false` or `assessment.enabled: false` in configuration) appeared visually identical to active steps in the "View Processing Flow" display
53+
- **Key Benefit**: Users can now immediately see which steps are actually processing data vs. steps that execute but skip processing based on configuration settings, preventing confusion about whether summarization or assessment ran
54+
- Limitation: the new visual indicators are driven from the current config, which may have been altered since the document was processed. We will address this in a later release. See Issue #86.
55+
56+
### Known Issues
57+
- **GovCloud Deployments fail, due to lack of ARM support for CodeBuild. Fix targeted for next release.**
58+
59+
2360
## [0.3.19]
2461

2562
### Added

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ NC := \033[0m # No Color
99
# Default target - run both lint and test
1010
all: lint test
1111

12-
# Run tests in idp_common_pkg directory
12+
# Run tests in idp_common_pkg and idp_cli directories
1313
test:
1414
$(MAKE) -C lib/idp_common_pkg test
15+
cd idp_cli && python -m pytest -v
1516

1617
# Run both linting and formatting in one command
1718
lint: ruff-lint format check-arn-partitions

README.md

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
SPDX-License-Identifier: MIT-0
55

6+
**Questions?** [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/aws-solutions-library-samples/accelerated-intelligent-document-processing-on-aws)
7+
68
## Table of Contents
79

810
- [Introduction](#introduction)
@@ -31,6 +33,7 @@ White-glove customization, deployment, and integration support for production us
3133

3234
- **Serverless Architecture**: Built entirely on AWS serverless technologies including Lambda, Step Functions, SQS, and DynamoDB
3335
- **Modular, pluggable patterns**: Pre-built processing patterns using state-of-the-art models and AWS services
36+
- **Command Line Interface**: Programmatic batch processing with evaluation framework and analytics integration
3437
- **Advanced Classification**: Support for page-level and holistic document packet classification
3538
- **Few Shot Example Support**: Improve accuracy through example-based prompting
3639
- **Custom Business Logic Integration**: Inject custom prompt generation logic via Lambda functions for specialized document processing
@@ -73,23 +76,50 @@ To quickly deploy the GenAI-IDP solution in your AWS account:
7376

7477
### Processing Your First Document
7578

76-
After deployment, you can quickly process a document and view results:
79+
After deployment, choose the processing method that fits your use case:
7780

78-
1. **Upload a Document**:
79-
- **Via Web UI**: Open the Web UI URL from the CloudFormation stack's Outputs tab, log in, and click "Upload Document"
80-
- **Via S3**: Upload directly to the S3 input bucket (find the bucket URL in CloudFormation stack Outputs)
81+
#### Method 1: Web UI (Interactive)
8182

82-
2. **Use Sample Documents**:
83-
- For Patterns 1 (BDA) and Pattern 2: Use [samples/lending_package.pdf](./samples/lending_package.pdf)
84-
- For Pattern 3 (UDOP): Use [samples/rvl_cdip_package.pdf](./samples/rvl_cdip_package.pdf)
83+
1. Open the Web UI URL from CloudFormation stack Outputs
84+
2. Log in and click "Upload Document"
85+
3. Upload a sample document:
86+
- For Patterns 1 & 2: [samples/lending_package.pdf](./samples/lending_package.pdf)
87+
- For Pattern 3: [samples/rvl_cdip_package.pdf](./samples/rvl_cdip_package.pdf)
88+
4. Monitor processing and view results in the dashboard
89+
90+
#### Method 2: Direct S3 Upload (Simple)
91+
92+
1. Upload to the InputBucket (URL in CloudFormation Outputs)
93+
2. Monitor via Step Functions console
94+
3. Results appear in OutputBucket automatically
95+
96+
#### Method 3: IDP CLI (Batch/Programmatic)
97+
98+
For batch processing, automation, or evaluation workflows:
99+
100+
```bash
101+
# Install CLI
102+
cd idp_cli && pip install -e .
103+
104+
# Process documents
105+
idp-cli run-inference \
106+
--stack-name <your-stack-name> \
107+
--dir ./samples/ \
108+
--monitor
85109

86-
3. **Monitor Processing**:
87-
- **Via Web UI**: Track document status on the dashboard
88-
- **Via Step Functions**: Open the StateMachine URL from CloudFormation stack Outputs to observe workflow execution
110+
# Download results
111+
idp-cli download-results \
112+
--stack-name <your-stack-name> \
113+
--batch-id <batch-id> \
114+
--output-dir ./results/
115+
```
89116

90-
4. **View Results**:
91-
- **Via Web UI**: Access processing results through the document details page
92-
- **Via S3**: Check the output bucket for structured JSON files with extracted data
117+
**See [IDP CLI Documentation](./idp_cli/README.md)** for:
118+
- CLI-based stack deployment and updates
119+
- Batch document processing
120+
- Complete evaluation workflows with baselines
121+
- Athena and Agent Analytics integration
122+
- CI/CD integration examples
93123

94124
See the [Deployment Guide](./docs/deployment.md#testing-the-solution) for more detailed testing instructions.
95125

@@ -124,6 +154,7 @@ For detailed deployment and testing instructions, see the [Deployment Guide](./d
124154

125155
- [Architecture](./docs/architecture.md) - Detailed component architecture and data flow
126156
- [Deployment](./docs/deployment.md) - Build, publish, deploy, and test instructions
157+
- [IDP CLI](./idp_cli/README.md) - Command line interface for batch processing and evaluation workflows
127158
- [Web UI](./docs/web-ui.md) - Web interface features and usage
128159
- [Agent Analysis](./docs/agent-analysis.md) - Natural language analytics and data visualization feature
129160
- [Custom MCP Agent](./docs/custom-MCP-agent.md) - Integrating external MCP servers for custom tools and capabilities

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.19
1+
0.3.20

config_library/pattern-2/lending-package-sample/config.yaml

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,12 +1082,14 @@ summarization:
10821082
top_k: "5"
10831083
task_prompt: >-
10841084
<document-text>
1085-
10861085
{DOCUMENT_TEXT}
1087-
10881086
</document-text>
10891087
1090-
Analyze the provided document (<document-text>) and create a comprehensive summary.
1088+
<extracted-attributes>
1089+
{EXTRACTION_RESULTS}
1090+
</extracted-attributes>
1091+
1092+
Analyze the provided document (<document-text>) along with the extracted attributes (<extracted-attributes>) to create a comprehensive and accurate summary.
10911093
10921094
CRITICAL INSTRUCTION: You MUST return your response as valid JSON with the
10931095
EXACT structure shown at the end of these instructions. Do not include any
@@ -1096,29 +1098,39 @@ summarization:
10961098
Create a summary that captures the essential information from the document.
10971099
Your summary should:
10981100
1099-
1. Extract key information, main points, and important details
1101+
1. **Integrate Extracted Attributes**: Begin with a "Key Information" section that highlights the most important extracted attributes in a structured format (use tables or lists as appropriate)
1102+
1103+
2. **Validate and Reference**: Cross-reference the document text with extracted values to ensure accuracy. When mentioning specific values, prefer the extracted attributes when they are available
1104+
1105+
3. **Maintain Document Structure**: Preserve the original document's organizational structure where appropriate, using the extracted attributes to enhance each section
11001106
1101-
2. Maintain the original document's organizational structure where
1102-
appropriate
1107+
4. **Highlight Critical Data**: Emphasize important extracted values such as:
1108+
- Names, addresses, and identification numbers
1109+
- Dates and time periods
1110+
- Monetary amounts and financial figures
1111+
- Status indicators and classifications
1112+
- Any calculated or derived values
11031113
1104-
3. Preserve important facts, figures, dates, and entities
1114+
5. **Use Markdown Formatting**: Apply markdown for better readability:
1115+
- Use headers (##, ###) for sections
1116+
- Create tables for structured data from extracted attributes
1117+
- Use **bold** for important values and *italics* for emphasis
1118+
- Create lists (bullet or numbered) for multiple items
11051119
1106-
4. Reduce the length while retaining all critical information
1120+
6. **Provide Context**: For each extracted value mentioned, provide brief context from the document text to explain its significance
11071121
1108-
5. Use markdown formatting for better readability (headings, lists,
1109-
emphasis, etc.)
1122+
7. **Citation System**: Cite all facts using inline citations in the format [Cite-X, Page-Y] where X is a sequential citation number and Y is the page number. Format citations as markdown links: [[Cite-1, Page-3]](#cite-1-page-3)
11101123
1111-
6. Cite all relevant facts from the source document using inline citations
1112-
in the format [Cite-X, Page-Y] where X is a sequential citation number and Y
1113-
is the page number
1124+
8. **Data Completeness**: If extracted attributes are missing or empty, note this in the summary and rely more heavily on the document text
11141125
1115-
7. Format citations as markdown links that reference the full citation list
1116-
at the bottom of the summary
1117-
Example: [[Cite-1, Page-3]](#cite-1-page-3)
1126+
9. **References Section**: At the end, include a "References" section listing all citations with their exact text from the source document
11181127
1119-
8. At the end of the summary, include a "References" section that lists all
1120-
citations with their exact text from the source document in the format:
1121-
[Cite-X, Page-Y]: Exact text from the document
1128+
Structure your summary as follows:
1129+
- **Key Information** (from extracted attributes)
1130+
- **Document Overview**
1131+
- **Detailed Sections** (based on document structure)
1132+
- **Summary and Conclusions**
1133+
- **References**
11221134
11231135
Output Format:
11241136
@@ -1127,7 +1139,7 @@ summarization:
11271139
11281140
```json
11291141
{
1130-
"summary": "A comprehensive summary in markdown format with inline citations linked to a references section at the bottom"
1142+
"summary": "A comprehensive summary in markdown format that integrates extracted attributes with document text, includes inline citations linked to a references section at the bottom"
11311143
}
11321144
```
11331145

0 commit comments

Comments
 (0)