Skip to content

Commit da9f478

Browse files
author
Bob Strahan
committed
improve spacing in prompt templates
1 parent ef6012a commit da9f478

File tree

2 files changed

+53
-6
lines changed

2 files changed

+53
-6
lines changed

config_library/pattern-2/default/config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,20 @@ extraction:
443443
<background>
444444
You are an expert in document analysis and information extraction.
445445
You can understand and extract key information from documents classified as type
446+
446447
{DOCUMENT_CLASS}.
448+
447449
</background>
448450
451+
449452
<task>
450453
Your task is to take the unstructured text provided and convert it into a well-organized table format using JSON. Identify the main entities, attributes, or categories mentioned in the attributes list below and use them as keys in the JSON object.
451454
Then, extract the relevant information from the text and populate the corresponding values in the JSON object.
452455
</task>
453456
457+
454458
<extraction-guidelines>
459+
455460
Guidelines:
456461
1. Ensure that the data is accurately represented and properly formatted within
457462
the JSON structure
@@ -474,23 +479,35 @@ extraction:
474479
- When a mark touches multiple options, analyze which option was most likely intended based on position and density. For handwritten checks, the mark typically flows from the selected checkbox outward.
475480
- Carefully analyze visual cues and contextual hints. Think from a human perspective, anticipate natural tendencies, and apply thoughtful reasoning to make the best possible judgment.
476481
10. Think step by step first and then answer.
482+
477483
</extraction-guidelines>
478484
485+
479486
<attributes>
487+
480488
{ATTRIBUTE_NAMES_AND_DESCRIPTIONS}
489+
481490
</attributes>
482491
492+
483493
<<CACHEPOINT>>
484494
485495
<document-text>
496+
486497
{DOCUMENT_TEXT}
498+
487499
</document-text>
488500
501+
489502
<document_image>
503+
490504
{DOCUMENT_IMAGE}
505+
491506
</document_image>
492507
508+
493509
<final-instructions>
510+
494511
Extract key information from the document and return a JSON object with the following key steps:
495512
1. Carefully analyze the document text to identify the requested attributes
496513
2. Extract only information explicitly found in the document - never make up data
@@ -499,6 +516,7 @@ extraction:
499516
5. Use null for any fields not found in the document
500517
6. Ensure the output is properly formatted JSON with quoted keys and values
501518
7. Think step by step before finalizing your answer
519+
502520
</final-instructions>
503521
temperature: '0.0'
504522
model: us.amazon.nova-pro-v1:0

config_library/pattern-2/few_shot_example_with_multimodal_page_classification/config.yaml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -653,22 +653,33 @@ classification:
653653
task_prompt: >-
654654
Classify this document into exactly one of these categories:
655655
656+
656657
{CLASS_NAMES_AND_DESCRIPTIONS}
657658
658-
<few_shot_examples>
659+
660+
<few_shot_examples>
661+
659662
{FEW_SHOT_EXAMPLES}
660-
</few_shot_examples>
663+
664+
</few_shot_examples>
661665
662666
<<CACHEPOINT>>
663667
664-
<document_ocr_data>
665-
{DOCUMENT_TEXT}
668+
669+
<document_ocr_data>
670+
671+
{DOCUMENT_TEXT}
672+
666673
</document_ocr_data>
667674
668-
<document_image>
669-
{DOCUMENT_IMAGE}
675+
676+
<document_image>
677+
678+
{DOCUMENT_IMAGE}
679+
670680
</document_image>
671681
682+
672683
Respond only with a JSON object containing the class label. For example:
673684
{{"class": "letter"}}
674685
extraction:
@@ -684,15 +695,20 @@ extraction:
684695
<background>
685696
You are an expert in document analysis and information extraction.
686697
You can understand and extract key information from documents classified as type
698+
687699
{DOCUMENT_CLASS}.
700+
688701
</background>
689702
703+
690704
<task>
691705
Your task is to take the unstructured text provided and convert it into a well-organized table format using JSON. Identify the main entities, attributes, or categories mentioned in the attributes list below and use them as keys in the JSON object.
692706
Then, extract the relevant information from the text and populate the corresponding values in the JSON object.
693707
</task>
694708
709+
695710
<extraction-guidelines>
711+
696712
Guidelines:
697713
1. Ensure that the data is accurately represented and properly formatted within
698714
the JSON structure
@@ -715,23 +731,35 @@ extraction:
715731
- When a mark touches multiple options, analyze which option was most likely intended based on position and density. For handwritten checks, the mark typically flows from the selected checkbox outward.
716732
- Carefully analyze visual cues and contextual hints. Think from a human perspective, anticipate natural tendencies, and apply thoughtful reasoning to make the best possible judgment.
717733
10. Think step by step first and then answer.
734+
718735
</extraction-guidelines>
719736
737+
720738
<attributes>
739+
721740
{ATTRIBUTE_NAMES_AND_DESCRIPTIONS}
741+
722742
</attributes>
723743
744+
724745
<<CACHEPOINT>>
725746
726747
<document-text>
748+
727749
{DOCUMENT_TEXT}
750+
728751
</document-text>
729752
753+
730754
<document_image>
755+
731756
{DOCUMENT_IMAGE}
757+
732758
</document_image>
733759
760+
734761
<final-instructions>
762+
735763
Extract key information from the document and return a JSON object with the following key steps:
736764
1. Carefully analyze the document text to identify the requested attributes
737765
2. Extract only information explicitly found in the document - never make up data
@@ -740,6 +768,7 @@ extraction:
740768
5. Use null for any fields not found in the document
741769
6. Ensure the output is properly formatted JSON with quoted keys and values
742770
7. Think step by step before finalizing your answer
771+
743772
</final-instructions>
744773
pricing:
745774
- name: textract/detect_document_text

0 commit comments

Comments
 (0)