Skip to content

Commit 5598fdd

Browse files
author
Bob Strahan
committed
Remove bounding box configuration and make processing automatic
1 parent 6084e92 commit 5598fdd

File tree

4 files changed

+24
-59
lines changed

4 files changed

+24
-59
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,8 +1150,6 @@ assessment:
11501150
max_workers: "20"
11511151
simple_batch_size: "3"
11521152
list_batch_size: "1"
1153-
bounding_boxes:
1154-
enabled: true
11551153
default_confidence_threshold: '0.8'
11561154
top_p: '0.1'
11571155
max_tokens: '10000'

lib/idp_common_pkg/idp_common/assessment/service.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -587,14 +587,6 @@ def _get_text_confidence_data(self, page) -> str:
587587

588588
return ""
589589

590-
def _is_bounding_box_enabled(self) -> bool:
591-
"""Check if bounding box extraction is enabled."""
592-
assessment_config = self.config.get("assessment", {})
593-
bbox_config = assessment_config.get("bounding_boxes", {})
594-
from idp_common.utils import normalize_boolean_value
595-
596-
return normalize_boolean_value(bbox_config.get("enabled", False))
597-
598590
def _convert_bbox_to_geometry(
599591
self, bbox_coords: List[float], page_num: int
600592
) -> Dict[str, Any]:
@@ -977,18 +969,15 @@ def process_document_section(self, document: Document, section_id: str) -> Docum
977969
}
978970
parsing_succeeded = False # Mark that parsing failed
979971

980-
# Process bounding boxes if enabled
981-
if self._is_bounding_box_enabled():
982-
logger.info(
983-
"Bounding box extraction is enabled - processing geometry data"
972+
# Process bounding boxes automatically if bbox data is present
973+
try:
974+
logger.debug("Checking for bounding box data in assessment response")
975+
assessment_data = self._extract_geometry_from_assessment(
976+
assessment_data
984977
)
985-
try:
986-
assessment_data = self._extract_geometry_from_assessment(
987-
assessment_data
988-
)
989-
except Exception as e:
990-
logger.warning(f"Failed to extract geometry data: {str(e)}")
991-
# Continue with assessment even if geometry extraction fails
978+
except Exception as e:
979+
logger.warning(f"Failed to extract geometry data: {str(e)}")
980+
# Continue with assessment even if geometry extraction fails
992981

993982
# Get confidence thresholds
994983
default_confidence_threshold = _safe_float_conversion(

patterns/pattern-2/template.yaml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -681,54 +681,43 @@ Resources:
681681
field: "enabled",
682682
value: true
683683
}
684-
bounding_boxes:
685-
type: object
686-
sectionLabel: Bounding Box Configuration
687-
description: Configure spatial localization of extracted fields with bounding boxes
688-
order: 2
689-
properties:
690-
enabled:
691-
type: boolean
692-
description: Enable bounding box extraction for spatial localization of extracted fields. When enabled, assessment results will include geometry data compatible with UI visualization.
693-
default: false
694-
order: 0
695684
default_confidence_threshold:
696685
type: number
697686
description: Default confidence threshold for all attributes (0.0 to 1.0). If an attribute doesn't have its own threshold, this default will be used for confidence threshold alerts.
698687
minimum: 0
699688
maximum: 1
700-
order: 3
689+
order: 2
701690
model:
702691
type: string
703692
description: Bedrock model ID
704693
enum: ["us.amazon.nova-lite-v1:0", "us.amazon.nova-pro-v1:0", "us.amazon.nova-premier-v1:0", "us.anthropic.claude-3-haiku-20240307-v1:0", "us.anthropic.claude-3-5-sonnet-20241022-v2:0", "us.anthropic.claude-3-7-sonnet-20250219-v1:0", "us.anthropic.claude-sonnet-4-20250514-v1:0", "us.anthropic.claude-opus-4-20250514-v1:0", "us.anthropic.claude-opus-4-1-20250805-v1:0"]
705-
order: 4
694+
order: 3
706695
temperature:
707696
type: number
708697
description: Sampling temperature
709-
order: 5
698+
order: 4
710699
top_k:
711700
type: number
712701
description: Sampling Top K
713-
order: 6
702+
order: 5
714703
top_p:
715704
type: number
716705
description: Sampling Top P
717-
order: 7
706+
order: 6
718707
max_tokens:
719708
type: number
720709
description: Max tokens
721-
order: 8
710+
order: 7
722711
system_prompt:
723712
type: string
724713
format: textarea
725714
description: System prompt
726-
order: 9
715+
order: 8
727716
task_prompt:
728717
type: string
729718
format: textarea
730719
description: Task prompt - supports placeholders {DOCUMENT_TEXT} (markdown text), {OCR_TEXT_CONFIDENCE} (OCR text blocks with confidence), {DOCUMENT_CLASS}, {ATTRIBUTE_NAMES_AND_DESCRIPTIONS}, {EXTRACTION_RESULTS}, {GRANULAR_CONTEXT} and {DOCUMENT_IMAGE}. Use <<CACHEPOINT>> to separate static and dynamic elements of prompt for Bedrock prompt caching.
731-
order: 10
720+
order: 9
732721
summarization:
733722
order: 6
734723
type: object

patterns/pattern-3/template.yaml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -600,54 +600,43 @@ Resources:
600600
field: "enabled",
601601
value: true
602602
}
603-
bounding_boxes:
604-
type: object
605-
sectionLabel: Bounding Box Configuration
606-
description: Configure spatial localization of extracted fields with bounding boxes
607-
order: 2
608-
properties:
609-
enabled:
610-
type: boolean
611-
description: Enable bounding box extraction for spatial localization of extracted fields. When enabled, assessment results will include geometry data compatible with UI visualization.
612-
default: false
613-
order: 0
614603
default_confidence_threshold:
615604
type: number
616605
description: Default confidence threshold for all attributes (0.0 to 1.0). If an attribute doesn't have its own threshold, this default will be used for confidence threshold alerts.
617606
minimum: 0
618607
maximum: 1
619-
order: 3
608+
order: 2
620609
model:
621610
type: string
622611
description: Bedrock model ID
623612
enum: ["us.amazon.nova-lite-v1:0", "us.amazon.nova-pro-v1:0", "us.amazon.nova-premier-v1:0", "us.anthropic.claude-3-haiku-20240307-v1:0", "us.anthropic.claude-3-5-sonnet-20241022-v2:0", "us.anthropic.claude-3-7-sonnet-20250219-v1:0", "us.anthropic.claude-sonnet-4-20250514-v1:0", "us.anthropic.claude-opus-4-20250514-v1:0", "us.anthropic.claude-opus-4-1-20250805-v1:0"]
624-
order: 4
613+
order: 3
625614
temperature:
626615
type: number
627616
description: Sampling temperature
628-
order: 5
617+
order: 4
629618
top_k:
630619
type: number
631620
description: Sampling Top K
632-
order: 6
621+
order: 5
633622
top_p:
634623
type: number
635624
description: Sampling Top P
636-
order: 7
625+
order: 6
637626
max_tokens:
638627
type: number
639628
description: Max tokens
640-
order: 8
629+
order: 7
641630
system_prompt:
642631
type: string
643632
format: textarea
644633
description: System prompt
645-
order: 9
634+
order: 8
646635
task_prompt:
647636
type: string
648637
format: textarea
649638
description: Task prompt - supports placeholders {DOCUMENT_TEXT} (markdown text), {OCR_TEXT_CONFIDENCE} (OCR text blocks with confidence), {DOCUMENT_CLASS}, {ATTRIBUTE_NAMES_AND_DESCRIPTIONS}, {EXTRACTION_RESULTS}, {GRANULAR_CONTEXT} and {DOCUMENT_IMAGE}. Use <<CACHEPOINT>> to separate static and dynamic elements of prompt for Bedrock prompt caching.
650-
order: 10
639+
order: 9
651640
summarization:
652641
order: 6
653642
type: object

0 commit comments

Comments
 (0)