Skip to content

Commit 8e94961

Browse files
committed
Merge branch 'feature/enable-disable-steps' into 'develop'
Feature/enable disable steps See merge request genaiic-reusable-assets/engagement-artifacts/genaiic-idp-accelerator!245
2 parents 9e1f78c + 7e330cd commit 8e94961

File tree

31 files changed

+845
-191
lines changed

31 files changed

+845
-191
lines changed

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,33 @@ SPDX-License-Identifier: MIT-0
1212
- Dynamic pricing configuration loading from configuration
1313
- Enhanced cost analysis capabilities with comprehensive Athena queries for cost tracking, trend analysis, and efficiency metrics
1414
- Automatic cost calculation as `estimated_cost = value × unit_cost` for all metering records
15+
16+
- **Configuration-Based Summarization Control**
17+
- Summarization can now be enabled/disabled via configuration file `summarization.enabled` property instead of CloudFormation stack parameter
18+
- **Key Benefits**: Runtime control without stack redeployment, zero LLM costs when disabled, simplified state machine architecture, backward compatible defaults
19+
- **Implementation**: Always calls SummarizationStep but service skips processing when `enabled: false`
20+
- **Cost Optimization**: When disabled, no LLM API calls or S3 operations are performed
21+
- **Configuration Example**: Set `summarization.enabled: false` to disable, `enabled: true` to enable (default)
22+
23+
- **Configuration-Based Assessment Control**
24+
- Assessment can now be enabled/disabled via configuration file `assessment.enabled` property instead of CloudFormation stack parameter
25+
- **Key Benefits**: Runtime control without stack redeployment, zero LLM costs when disabled, simplified state machine architecture, backward compatible defaults
26+
- **Implementation**: Always calls AssessmentStep but service skips processing when `enabled: false`
27+
- **Cost Optimization**: When disabled, no LLM API calls or S3 operations are performed
28+
- **Configuration Example**: Set `assessment.enabled: false` to disable, `enabled: true` to enable (default)
29+
30+
### Removed
31+
- **CloudFormation Parameters**: Removed `IsSummarizationEnabled` and `IsAssessmentEnabled` parameters from all pattern templates
32+
- **Related Conditions**: Removed parameter conditions and state machine definition substitutions for both features
33+
- **Conditional Logic**: Eliminated complex conditional logic from state machine definitions for summarization and assessment steps
34+
35+
### ⚠️ Breaking Changes
36+
- **Configuration Migration Required**: When updating a stack that previously had `IsSummarizationEnabled` or `IsAssessmentEnabled` set to `false`, these features will now default to `enabled: true` after the update. To maintain the disabled behavior:
37+
1. Update your configuration file to set `summarization.enabled: false` and/or `assessment.enabled: false` as needed
38+
2. Save the configuration changes immediately after the stack update
39+
3. This ensures continued cost optimization by preventing unexpected LLM API calls
40+
- **Action Required**: Review your current CloudFormation parameter settings before updating and update your configuration accordingly to preserve existing behavior
41+
1542

1643
## [0.3.11]
1744

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: 2 additions & 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'
@@ -368,6 +369,7 @@ summarization:
368369
system_prompt: >-
369370
You are a document summarization expert who can analyze and summarize documents from various domains including medical, financial, legal, and general business documents. Your task is to create a summary that captures the key information, main points, and important details from the document. Your output must be in valid JSON format. \nSummarization Style: Balanced\\nCreate a balanced summary that provides a moderate level of detail. Include the main points and key supporting information, while maintaining the document's overall structure. Aim for a comprehensive yet concise summary.\n Your output MUST be in valid JSON format with markdown content. You MUST strictly adhere to the output format specified in the instructions.
370371
assessment:
372+
enabled: true
371373
image:
372374
target_height: ''
373375
target_width: ''

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

Lines changed: 2 additions & 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'
@@ -1143,6 +1144,7 @@ summarization:
11431144
system_prompt: >-
11441145
You are a document summarization expert who can analyze and summarize documents from various domains including medical, financial, legal, and general business documents. Your task is to create a summary that captures the key information, main points, and important details from the document. Your output must be in valid JSON format. \nSummarization Style: Balanced\\nCreate a balanced summary that provides a moderate level of detail. Include the main points and key supporting information, while maintaining the document's overall structure. Aim for a comprehensive yet concise summary.\n Your output MUST be in valid JSON format with markdown content. You MUST strictly adhere to the output format specified in the instructions.
11451146
assessment:
1147+
enabled: true
11461148
image:
11471149
target_height: ''
11481150
target_width: ''

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ pricing:
886886
- name: cacheWriteInputTokens
887887
price: '3.75E-6'
888888
assessment:
889+
enabled: true
889890
image:
890891
target_height: ''
891892
target_width: ''
@@ -1069,6 +1070,7 @@ evaluation:
10691070
values match for document attribute extraction. You will consider the
10701071
context and meaning rather than just exact string matching.
10711072
summarization:
1073+
enabled: true
10721074
top_p: '0.1'
10731075
max_tokens: '4096'
10741076
top_k: '5'

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

Lines changed: 2 additions & 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'
@@ -608,6 +609,7 @@ summarization:
608609
system_prompt: >-
609610
You are a document summarization expert who can analyze and summarize documents from various domains including medical, financial, legal, and general business documents. Your task is to create a summary that captures the key information, main points, and important details from the document. Your output must be in valid JSON format. \nSummarization Style: Balanced\\nCreate a balanced summary that provides a moderate level of detail. Include the main points and key supporting information, while maintaining the document's overall structure. Aim for a comprehensive yet concise summary.\n Your output MUST be in valid JSON format with markdown content. You MUST strictly adhere to the output format specified in the instructions.
610611
assessment:
612+
enabled: true
611613
image:
612614
target_height: ''
613615
target_width: ''

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

Lines changed: 2 additions & 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'
@@ -468,6 +469,7 @@ summarization:
468469
system_prompt: >-
469470
You are a document summarization expert who can analyze and summarize documents from various domains including medical, financial, legal, and general business documents. Your task is to create a summary that captures the key information, main points, and important details from the document. Your output must be in valid JSON format. \nSummarization Style: Balanced\\nCreate a balanced summary that provides a moderate level of detail. Include the main points and key supporting information, while maintaining the document's overall structure. Aim for a comprehensive yet concise summary.\n Your output MUST be in valid JSON format with markdown content. You MUST strictly adhere to the output format specified in the instructions.
470471
assessment:
472+
enabled: true
471473
image:
472474
target_width: ''
473475
target_height: ''

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/assessment.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,33 @@ The assessment step is conditionally integrated into Pattern-2's ProcessSections
5454

5555
## Configuration
5656

57-
### Deployment Parameter
57+
### Configuration-Based Control
5858

59-
Enable assessment during stack deployment:
59+
Assessment can now be controlled via the configuration file rather than CloudFormation stack parameters. This provides more flexibility and eliminates the need for stack redeployment when changing assessment behavior.
6060

61+
**Configuration-based Control (Recommended):**
6162
```yaml
62-
Parameters:
63-
IsAssessmentEnabled:
64-
Type: String
65-
Default: "false"
66-
AllowedValues: ["true", "false"]
67-
Description: Enable assessment functionality for extraction confidence evaluation
63+
assessment:
64+
enabled: true # Set to false to disable assessment
65+
model: us.amazon.nova-lite-v1:0
66+
temperature: 0.0
67+
# ... other assessment settings
6868
```
6969

70+
**Key Benefits:**
71+
- **Runtime Control**: Enable/disable without stack redeployment
72+
- **Cost Optimization**: Zero LLM costs when disabled (`enabled: false`)
73+
- **Simplified Architecture**: No conditional logic in state machines
74+
- **Backward Compatible**: Defaults to `enabled: true` when property is missing
75+
76+
**Behavior When Disabled:**
77+
- Assessment lambda is still called (minimal overhead)
78+
- Service immediately returns with logging: "Assessment is disabled via configuration"
79+
- No LLM API calls or S3 operations are performed
80+
- Document processing continues to completion
81+
82+
**Migration Note**: The previous `IsAssessmentEnabled` CloudFormation parameter has been removed in favor of this configuration-based approach.
83+
7084
### Assessment Configuration Section
7185

7286
Add the assessment section to your configuration YAML:
@@ -808,7 +822,7 @@ The assessment feature implements several cost optimization techniques:
808822

809823
1. **Text Confidence Data**: Uses condensed OCR confidence information instead of full raw OCR results (80-90% token reduction)
810824
2. **Conditional Image Processing**: Images only processed when `{DOCUMENT_IMAGE}` placeholder is present
811-
3. **Optional Deployment**: Assessment infrastructure only deployed when `IsAssessmentEnabled=true`
825+
3. **Configuration-Based Control**: Assessment can be enabled/disabled via configuration `enabled` property for flexible deployment
812826
4. **Efficient Prompting**: Optimized prompt templates minimize token usage while maintaining accuracy
813827
5. **Configurable Image Dimensions**: Adjust image resolution to balance assessment quality and processing costs
814828
6. **Granular Assessment with Caching**: For complex documents, use granular assessment with prompt caching for 60-80% cost reduction
@@ -889,7 +903,7 @@ ValueError: "Assessment prompt template formatting failed: missing required plac
889903
### Common Issues
890904

891905
1. **Assessment Not Running**
892-
- Verify `IsAssessmentEnabled=true` in deployment
906+
- Verify `assessment.enabled: true` in configuration file
893907
- Check state machine definition includes assessment step
894908
- Confirm assessment Lambda function deployed successfully
895909

0 commit comments

Comments
 (0)