Skip to content

Commit dc12559

Browse files
author
Bob Strahan
committed
Add configuration-based summarization control with runtime enable/disable
1 parent 377f0e9 commit dc12559

File tree

24 files changed

+335
-106
lines changed

24 files changed

+335
-106
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ SPDX-License-Identifier: MIT-0
55

66
## [Unreleased]
77

8+
### Added
9+
- **Configuration-Based Summarization Control**
10+
- Summarization can now be enabled/disabled via configuration file `summarization.enabled` property instead of CloudFormation stack parameter
11+
- **Key Benefits**: Runtime control without stack redeployment, zero LLM costs when disabled, simplified state machine architecture, backward compatible defaults
12+
- **Implementation**: Always calls SummarizationStep but service skips processing when `enabled: false`
13+
- **Cost Optimization**: When disabled, no LLM API calls or S3 operations are performed
14+
- **Configuration Example**: Set `summarization.enabled: false` to disable, `enabled: true` to enable (default)
15+
16+
### Changed
17+
- **State Machine Simplification**: Removed `SummarizationChoice` conditional states from all patterns (Pattern 1, 2, 3) for cleaner workflows
18+
- **Service Logic Enhancement**: SummarizationService now checks configuration `enabled` flag at the beginning of `process_document()`
19+
- **Configuration Schema Updates**: Added `enabled` boolean property to summarization sections in all CloudFormation template schemas
20+
21+
### Removed
22+
- **CloudFormation Parameter**: Removed `IsSummarizationEnabled` parameter from all pattern templates (patterns/pattern-1, pattern-2, pattern-3)
23+
- **Related Conditions**: Removed `IsSummarizationEnabled` conditions and state machine definition substitutions
24+
25+
### Documentation
26+
- **Updated Documentation**: Enhanced docs/configuration.md, docs/architecture.md, and all pattern-specific docs (pattern-1.md, pattern-2.md, pattern-3.md)
27+
- **Service Documentation**: Updated lib/idp_common_pkg/idp_common/summarization/README.md with configuration examples and behavior details
28+
- **Migration Guidance**: Added migration notes about the CloudFormation parameter removal
829

930
## [0.3.11]
1031

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.11
1+
0.3.12-wip

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ notes: Processing configuration in BDA project.
55
assessment:
66
default_confidence_threshold: '0.8'
77
summarization:
8+
enabled: true
89
top_p: '0.1'
910
max_tokens: '4096'
1011
top_k: '5'

config_library/pattern-2/bank-statement-sample/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ extraction:
307307
system_prompt: >-
308308
You are a document assistant. Respond only with JSON. Never make up data, only provide data found in the document being provided.
309309
summarization:
310+
enabled: true
310311
top_p: '0.1'
311312
max_tokens: '4096'
312313
top_k: '5'

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,7 @@ extraction:
10821082
system_prompt: >-
10831083
You are a document assistant. Respond only with JSON. Never make up data, only provide data found in the document being provided.
10841084
summarization:
1085+
enabled: true
10851086
top_p: '0.1'
10861087
max_tokens: '4096'
10871088
top_k: '5'

config_library/pattern-2/rvl-cdip-package-sample-with-few-shot-examples/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,7 @@ evaluation:
10691069
values match for document attribute extraction. You will consider the
10701070
context and meaning rather than just exact string matching.
10711071
summarization:
1072+
enabled: true
10721073
top_p: '0.1'
10731074
max_tokens: '4096'
10741075
top_k: '5'

config_library/pattern-2/rvl-cdip-package-sample/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ extraction:
547547
system_prompt: >-
548548
You are a document assistant. Respond only with JSON. Never make up data, only provide data found in the document being provided.
549549
summarization:
550+
enabled: true
550551
top_p: '0.1'
551552
max_tokens: '4096'
552553
top_k: '5'

config_library/pattern-3/rvl-cdip-package-sample/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ extraction:
407407
system_prompt: >-
408408
You are a document assistant. Respond only with JSON. Never make up data, only provide data found in the document being provided.
409409
summarization:
410+
enabled: true
410411
top_p: '0.1'
411412
max_tokens: '4096'
412413
top_k: '5'

docs/architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The solution uses a modular architecture with nested CloudFormation stacks to su
4040
- Centralized monitoring and management across all patterns
4141
- Pattern-specific optimizations and configurations
4242
- Optional features that can be enabled across all patterns:
43-
- Document summarization (controlled by `IsSummarizationEnabled` parameter)
43+
- Document summarization (controlled by configuration `summarization.enabled` property)
4444
- This feature also enables the "Chat with Document" functionality
4545
- This feature does not use the Bedrock Knowledge Base but stores a full-text text file in S3
4646
- Document Knowledge Base (using Amazon Bedrock)
@@ -215,7 +215,7 @@ For detailed information about the Web UI, its features, and usage, see [web-ui.
215215

216216
### Document Summarization
217217

218-
When enabled via the `IsSummarizationEnabled` parameter (default: true), the solution provides document summarization across all patterns:
218+
When enabled via the configuration `summarization.enabled` property (default: true), the solution provides document summarization across all patterns:
219219

220220
- All patterns use a dedicated summarization step with Bedrock models
221221
- Summarization provides a concise overview of the document content

docs/configuration.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The web interface allows real-time configuration updates without stack redeploym
1616
- **Prompt Engineering**: Customize system and task prompts for optimal results
1717
- **OCR Features**: Configure Textract features (TABLES, FORMS, SIGNATURES, LAYOUT) for enhanced data capture
1818
- **Evaluation Methods**: Set evaluation methods and thresholds for each attribute
19-
- **Summarization**: Configure model, prompts, and parameters for document summarization (when `IsSummarizationEnabled` is true)
19+
- **Summarization**: Configure model, prompts, parameters, and enable/disable document summarization via the `enabled` property
2020

2121
### Configuration Management Features
2222

@@ -27,6 +27,35 @@ The web interface allows real-time configuration updates without stack redeploym
2727

2828
Configuration changes are validated and applied immediately, with rollback capability if issues arise. See [web-ui.md](web-ui.md) for details on using the administration interface.
2929

30+
## Summarization Configuration
31+
32+
### Enable/Disable Summarization
33+
34+
Summarization can be controlled via the configuration file rather than CloudFormation stack parameters. This provides more flexibility and eliminates the need for stack redeployment when changing summarization behavior.
35+
36+
**Configuration-based Control (Recommended):**
37+
```yaml
38+
summarization:
39+
enabled: true # Set to false to disable summarization
40+
model: us.anthropic.claude-3-7-sonnet-20250219-v1:0
41+
temperature: 0.0
42+
# ... other summarization settings
43+
```
44+
45+
**Key Benefits:**
46+
- **Runtime Control**: Enable/disable without stack redeployment
47+
- **Cost Optimization**: Zero LLM costs when disabled (`enabled: false`)
48+
- **Simplified Architecture**: No conditional logic in state machines
49+
- **Backward Compatible**: Defaults to `enabled: true` when property is missing
50+
51+
**Behavior When Disabled:**
52+
- Summarization lambda is still called (minimal overhead)
53+
- Service immediately returns with logging: "Summarization is disabled in configuration"
54+
- No LLM API calls or S3 operations are performed
55+
- Document processing continues to completion
56+
57+
**Migration Note**: The previous `IsSummarizationEnabled` CloudFormation parameter has been removed in favor of this configuration-based approach.
58+
3059
## Stack Parameters
3160

3261
Key parameters that can be configured during CloudFormation deployment:
@@ -64,7 +93,6 @@ Key parameters that can be configured during CloudFormation deployment:
6493
- `Pattern3Configuration`: Configuration preset to use
6594

6695
### Optional Features
67-
- `IsSummarizationEnabled`: Enable/disable document summarization (default: true)
6896
- `EvaluationBaselineBucketName`: Optional existing bucket for ground truth data
6997
- `EvaluationAutoEnabled`: Enable automatic accuracy evaluation (default: true)
7098
- `DocumentKnowledgeBase`: Enable document knowledge base functionality

0 commit comments

Comments
 (0)