Skip to content

Commit 8b91163

Browse files
author
Bob Strahan
committed
docs: enhance deployment guide with CLI options and restructure testing methods
1 parent 9d40fb9 commit 8b91163

File tree

2 files changed

+236
-41
lines changed

2 files changed

+236
-41
lines changed

README.md

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ White-glove customization, deployment, and integration support for production us
3131

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

7475
### Processing Your First Document
7576

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

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)
79+
#### Method 1: Web UI (Interactive)
8180

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

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
108+
# Download results
109+
idp-cli download-results \
110+
--stack-name <your-stack-name> \
111+
--batch-id <batch-id> \
112+
--output-dir ./results/
113+
```
89114

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
115+
**See [IDP CLI Documentation](./idp_cli/README.md)** for:
116+
- CLI-based stack deployment and updates
117+
- Batch document processing
118+
- Complete evaluation workflows with baselines
119+
- Athena and Agent Analytics integration
120+
- CI/CD integration examples
93121

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

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

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

docs/deployment.md

Lines changed: 194 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,101 @@ This guide covers how to deploy, build, publish, and test the GenAI Intelligent
77

88
## Deployment Options
99

10+
The GenAI IDP Accelerator can be deployed using either the AWS CloudFormation console (recommended for first-time users) or the IDP CLI (recommended for automation and programmatic deployments).
11+
1012
### Administrator Access Requirements
1113

1214
**Important**: Deploying the GenAI IDP Accelerator requires administrator access to your AWS account. However, for organizations that want to enable non-administrator users to deploy and manage IDP stacks, we provide an optional CloudFormation service role approach:
1315

1416
- **For Administrators**: Use the deployment options below with your existing administrator privileges
1517
- **For Delegated Access**: See [iam-roles/cloudformation-management/README.md](../iam-roles/cloudformation-management/README.md) for instructions on provisioning a CloudFormation service role that allows non-administrator users to deploy and maintain IDP stacks without requiring administrator permissions
1618

17-
### One-Click Deployment
19+
### Option 1: One-Click CloudFormation Console Deployment (Recommended for First-Time Users)
20+
21+
1. Choose your region and click the Launch Stack button:
1822

23+
| Region name | Region code | Launch |
24+
| ----------- | ----------- | ------ |
25+
| US West (Oregon) | us-west-2 | [![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](https://us-west-2.console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/create/review?templateURL=https://s3.us-west-2.amazonaws.com/aws-ml-blog-us-west-2/artifacts/genai-idp/idp-main.yaml&stackName=IDP) |
1926
| US East (N.Virginia) | us-east-1 | [![Launch Stack](https://cdn.rawgit.com/buildkite/cloudformation-launch-stack-button-svg/master/launch-stack.svg)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?templateURL=https://s3.us-east-1.amazonaws.com/aws-ml-blog-us-east-1/artifacts/genai-idp/idp-main.yaml&stackName=IDP) |
2027

21-
3. Review the template parameters and provide values as needed
22-
4. Check the acknowledgment box and click **Create stack**
23-
5. Wait for the stack to reach the `CREATE_COMPLETE` state
28+
2. Review the template parameters and provide values as needed
29+
3. Check the acknowledgment box and click **Create stack**
30+
4. Wait for the stack to reach the `CREATE_COMPLETE` state (10-15 minutes)
2431

2532
> **Note**: When the stack is deploying for the first time, it will send an email with a temporary password to the address specified in the AdminEmail parameter. You will need to use this temporary password to log into the UI and set a permanent password.
2633
27-
## Option 2: Build Deployment Assets from Source Code
34+
---
35+
36+
### Option 2: CLI-Based Deployment (Recommended for Automation)
37+
38+
For programmatic deployment, updates, and batch processing, use the IDP CLI.
39+
40+
#### Install the CLI
41+
42+
```bash
43+
cd idp_cli
44+
pip install -e .
45+
```
46+
47+
#### Deploy a New Stack
48+
49+
```bash
50+
idp-cli deploy \
51+
--stack-name my-idp-stack \
52+
--pattern pattern-2 \
53+
--admin-email [email protected] \
54+
--max-concurrent 100 \
55+
--wait
56+
```
57+
58+
**What this does:**
59+
- Creates all CloudFormation resources (~120 resources)
60+
- Waits for deployment to complete (10-15 minutes)
61+
- Sends email with temporary admin password
62+
- Returns stack outputs including Web UI URL and bucket names
63+
64+
#### Deploy with Custom Configuration
65+
66+
```bash
67+
# Deploy with local config file (automatically uploaded to S3)
68+
idp-cli deploy \
69+
--stack-name my-idp-stack \
70+
--pattern pattern-2 \
71+
--admin-email [email protected] \
72+
--custom-config ./config_library/pattern-2/bank-statement-sample/config.yaml \
73+
--wait
74+
```
75+
76+
#### Update an Existing Stack
77+
78+
```bash
79+
# Update configuration
80+
idp-cli deploy \
81+
--stack-name my-idp-stack \
82+
--custom-config ./updated-config.yaml \
83+
--wait
84+
85+
# Update parameters
86+
idp-cli deploy \
87+
--stack-name my-idp-stack \
88+
--max-concurrent 200 \
89+
--log-level DEBUG \
90+
--wait
91+
```
92+
93+
**Benefits of CLI deployment:**
94+
- Scriptable and automatable
95+
- Version-controlled deployments
96+
- Rapid iteration for configuration testing
97+
- Integration with CI/CD pipelines
98+
- No manual console clicking required
99+
100+
**For complete CLI documentation**, see [IDP CLI Documentation](../idp_cli/README.md).
101+
102+
---
103+
104+
## Option 3: Build Deployment Assets from Source Code
28105

29106
### Dependencies
30107

@@ -246,7 +323,103 @@ To update an existing GenAIIDP deployment to a new version:
246323
247324
## Testing the Solution
248325

249-
### Basic Test
326+
### Method 1: CLI-Based Batch Testing (Recommended for Automation)
327+
328+
For batch processing, evaluation workflows, or automated testing:
329+
330+
#### Quick Batch Test
331+
332+
```bash
333+
# Install CLI
334+
cd idp_cli && pip install -e .
335+
336+
# Process sample documents
337+
idp-cli run-inference \
338+
--stack-name IDP \
339+
--dir ./samples/ \
340+
--batch-id sample-test \
341+
--monitor
342+
```
343+
344+
**What you'll see:**
345+
```
346+
✓ Uploaded 3 documents to InputBucket
347+
✓ Sent 3 messages to processing queue
348+
349+
Monitoring Batch: sample-test
350+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
351+
Status Summary
352+
─────────────────────────────────────
353+
✓ Completed 3 100%
354+
⏸ Queued 0 0%
355+
```
356+
357+
#### Download Results
358+
359+
```bash
360+
# Download all results
361+
idp-cli download-results \
362+
--stack-name IDP \
363+
--batch-id sample-test \
364+
--output-dir ./test-results/
365+
366+
# View extraction data
367+
cat ./test-results/sample-test/lending_package.pdf/sections/1/result.json | jq .
368+
```
369+
370+
#### Evaluation Workflow Testing
371+
372+
Test accuracy with validated baselines:
373+
374+
```bash
375+
# 1. Process documents initially
376+
idp-cli run-inference \
377+
--stack-name IDP \
378+
--dir ./test-docs/ \
379+
--batch-id baseline-run \
380+
--monitor
381+
382+
# 2. Download and validate results
383+
idp-cli download-results \
384+
--stack-name IDP \
385+
--batch-id baseline-run \
386+
--output-dir ./baselines/ \
387+
--file-types sections
388+
389+
# 3. Manually review and correct baselines
390+
# (Edit ./baselines/baseline-run/*/sections/*/result.json as needed)
391+
392+
# 4. Create manifest with baselines
393+
cat > eval-manifest.csv << EOF
394+
document_path,baseline_source
395+
./test-docs/invoice.pdf,./baselines/baseline-run/invoice.pdf/
396+
./test-docs/w2.pdf,./baselines/baseline-run/w2.pdf/
397+
EOF
398+
399+
# 5. Reprocess with evaluation
400+
idp-cli run-inference \
401+
--stack-name IDP \
402+
--manifest eval-manifest.csv \
403+
--batch-id eval-test \
404+
--monitor
405+
406+
# 6. Download evaluation results
407+
idp-cli download-results \
408+
--stack-name IDP \
409+
--batch-id eval-test \
410+
--output-dir ./eval-results/ \
411+
--file-types evaluation
412+
413+
# 7. Review accuracy metrics
414+
cat ./eval-results/eval-test/invoice.pdf/evaluation/report.md
415+
```
416+
417+
**For complete evaluation workflow documentation**, see [IDP CLI - Complete Evaluation Workflow](../idp_cli/README.md#complete-evaluation-workflow).
418+
419+
---
420+
421+
### Method 2: Web UI Testing (Interactive)
422+
### Method 3: Direct S3 Upload Testing (Simple)
250423

251424
1. Open the `S3InputBucketConsoleURL` and `S3OutputBucketConsoleURL` from the stack Outputs tab
252425
2. Open the `StateMachineConsoleURL` from the stack Outputs tab
@@ -256,7 +429,21 @@ To update an existing GenAIIDP deployment to a new version:
256429
4. Monitor the Step Functions execution to observe the workflow
257430
5. When complete, check the Output bucket for the structured JSON file with extracted fields
258431

259-
### Testing via the UI
432+
#### Upload Multiple Files for Volume Testing
433+
434+
To copy a sample file multiple times:
435+
436+
```bash
437+
n=10
438+
for i in `seq 1 $n`; do
439+
aws s3 cp ./samples/lending_package.pdf \
440+
s3://idp-inputbucket-kmsxxxxxxxxx/lending_package-$i.pdf
441+
done
442+
```
443+
444+
---
445+
446+
### Method 4: Web UI Testing (Interactive)
260447

261448
1. Open the Web UI URL from the CloudFormation stack's Outputs tab
262449
2. Log in using your credentials (the temporary password from the email if this is your first login)
@@ -266,27 +453,6 @@ To update an existing GenAIIDP deployment to a new version:
266453
6. Follow the upload process and observe the document processing in the UI
267454
7. View the extraction results once processing is complete
268455

269-
### Testing without the UI
270-
271-
You can test the solution without using the UI through the following methods:
272-
273-
1. Direct S3 uploads as described in the Basic Test section
274-
2. Using the AWS CLI to upload documents to the input bucket:
275-
276-
```bash
277-
aws s3 cp ./samples/lending_package.pdf s3://idp-inputbucket-kmsxxxxxxxxx/
278-
```
279-
280-
3. Using the AWS SDK in your application code to programmatically send documents for processing
281-
282-
### Upload Multiple Sample Files
283-
284-
To copy a sample file multiple times for testing:
285-
286-
```bash
287-
n=10
288-
for i in `seq 1 $n`; do aws s3 cp ./samples/lending_package.pdf s3://idp-inputbucket-kmsxxxxxxxxx/lending_package-$i.pdf; done
289-
```
290456

291457
### Testing Individual Lambda Functions Locally
292458

0 commit comments

Comments
 (0)