diff --git a/fieldExtraction/src/prompts/investment_prompts.json b/fieldExtraction/src/prompts/investment_prompts.json index 687b8db..dd713f2 100644 --- a/fieldExtraction/src/prompts/investment_prompts.json +++ b/fieldExtraction/src/prompts/investment_prompts.json @@ -281,7 +281,7 @@ "field_name": "AARETE_DERIVED_EFFECTIVE_DT", "relationship": "one_to_one", "field_type": "smart_chunked", - "prompt": "Please analyze the following contract and extract ONLY the effective date of the CURRENT contract or CURRENT amendment. THE DATE MAY OR MAY NOT BE EXPLICITLY LABELED AS AN EFFECTIVE DATE. Follow these retrieval rules in order:\n\n[RETRIEVAL RULES]\nLOOK FOR dates that appear after these common phrases but not limited to (case-insensitive matching):\n'Effective Date:' FOLLOWED BY a date\n'is entered into as of' FOLLOWED BY a date\n'is made and entered into as of the' FOLLOWED BY a date\n'effective as of' FOLLOWED BY a date\n'shall begin on' FOLLOWED BY a date\n'Effective Date of Agreement:' FOLLOWED BY a date\n'Effective Date of Amendment' FOLLOWED BY a date\n'made this' FOLLOWED BY a date\n'made and entered into' FOLLOWED BY a date\n\nALSO LOOK FOR dates in phrases that semantically indicate an effective date (may or may not be explictly labelled as effective date), even if they do not exactly match the phrases above.\nExamples include but ARE NOT LIMITED TO:\nPhrases indicating when a contract or amendment begins or takes effect, Phrases specifying the start date of the contract or amendment, Phrases defining when the contract or amendment becomes operational, or Any phrase indicating contract or amendment creation or execution date.\n\nIt is possible that the contract will specify that the effective date is derived from elsewhere in the contract. One specific case is outlined:\n\nSIGNATURE DATE HANDLING:\nPRIMARY RULE: DO NOT USE signature dates unless STRICTLY meeting the criteria below\nWHEN TO USE a signature date: ONLY IF that SPECIFIC signature date has an EXPLICIT statement marking IT as the effective date\nHere are some example scenarios:\n✓ USE: 'Effective Date: 1/13/2024' + 'Date: [blank]' below\n✓ USE: 'Effective Date of Agreement: 2/15/2016' + 'Date: [blank]' below\n\nWHEN NOT TO USE a signature date:\n- Even if there is an empty effective date section or field nearby\nHere are some example scenarios but not limited to:\n✗ DO NOT USE: 'Date: 1/1/2024' + 'Effective Date: [blank]' below\n✗ DO NOT USE: 'Effective Date: [blank]' + 'Date: 1/1/2024' below\n\nSECONDARY RULE – UNREFERENCED DATE NEAR “EFFECTIVE DATE:” LABEL:\nIf no explicit effective date is found in the contract, and the “Effective Date:” label appears with a blank or empty field, you MAY consider a nearby date as the effective date ONLY IF ALL of the following conditions are true:\n- The nearby date is NOT referenced by any signature, title, or labeled field (i.e., it is unassigned or free-floating)\n- Other nearby dates ARE explicitly labeled (e.g., under “Date” near signature lines or roles)\n- The unassigned date appears directly under or beside the “Effective Date:” label\n- The document does not provide a clearer effective date elsewhere\n\nIn such cases, treat the unreferenced date near the “Effective Date:” label as the effective date. Preserve the date's exact format as it appears.\n\n[OUTPUT DATE HANDLING]\nCRITICAL - DATE FORMAT PRESERVATION:\n- You MUST preserve the EXACT format of the date AS IT APPEARS in the document\n- DO NOT modify, standardize, or reformat the date in ANY way\n- Preserve ALL original: Spacing (including multiple spaces), punctuation, separators (commas, hyphens, forward slashes, etc.), leading/trailing spaces, or partial or incomplete dates\n\nExamples of EXACT DATE preservation:\n✓ If document shows: '3-1 , , 03' → return |3-1 , , 03|\n✓ If document shows: 'June 1st,2010' → return |June 1st,2010|\n✓ If document shows: 'Feb 1st day of , 10' → return |Feb 1st day of , 10|\n✓ If document shows: '6 /1/ 2010' → return |6 /1/ 2010|\n✓ If document shows: '12-1-20' → return |12-1-20|\n✓ If document shows: 'made this day of Jan, 2009' → return |day of Jan, 2009|\n✓ If document shows: 'to be effective as of , 20 ( the 'Effective Date').' → return |, 20|\n\nIt is POSSIBLE that the intended effective date could be blank (left blank, not filled), empty, incomplete, or partial. This is still acceptable as the ANSWER. DO NOT ASSUME/INFER anything about the date or its components.\nReturn N/A only if NO valid effective date is found (excluding blank/empty/incomplete dates)\n\nIF MULTIPLE matches are retrieved:\n- VERIFY that you have PRECISELY followed the retrieval rules\n- If multiple matches are present, PRIORITIZE and SELECT the LATEST date as the answer\n- MAINTAIN the EXACT FORMAT of the selected date as it appears in the document\n\nBefore providing the final answer, SHOW your reasoning:\n- LIST ALL dates found that match patterns in the retrieval rules\n- For EACH date found:\n* EXPLAIN why it is considered for effective date or not\n* Include the EXACT text snippet where the date was found\n- JUSTIFY your final date selection or why N/A is being returned\n\nFinal Answer Format:\n- Your answer MUST be ENCLOSED in |pipes|\n- The text between the pipes MUST be an EXACT COPY of how the date appears in the document\n- DO NOT add or remove ANY characters, spaces, or formatting", + "prompt": "Please analyze the following contract and extract ONLY the effective date of the CURRENT contract or CURRENT amendment. THE DATE MAY OR MAY NOT BE EXPLICITLY LABELED AS AN EFFECTIVE DATE. Follow these retrieval rules in order:\n\n[RETRIEVAL RULES]\nLOOK FOR dates that appear after these common phrases but not limited to (case-insensitive matching):\n'Effective Date:' FOLLOWED BY a date\n'is entered into as of' FOLLOWED BY a date\n'is made and entered into as of the' FOLLOWED BY a date\n'effective as of' FOLLOWED BY a date\n'shall begin on' FOLLOWED BY a date\n'Effective Date of Agreement:' FOLLOWED BY a date\n'Effective Date of Amendment' FOLLOWED BY a date\n'made this' FOLLOWED BY a date\n'made and entered into' FOLLOWED BY a date\n\nALSO LOOK FOR dates in phrases that semantically indicate an effective date (may or may not be explictly labelled as effective date), even if they do not exactly match the phrases above.\nExamples include but ARE NOT LIMITED TO:\nPhrases indicating when a contract or amendment begins or takes effect, Phrases specifying the start date of the contract or amendment, Phrases defining when the contract or amendment becomes operational, or Any phrase indicating contract or amendment creation or execution date.\n\nIt is possible that the contract will specify that the effective date is derived from elsewhere in the contract. One specific case is outlined:\n\nSIGNATURE DATE HANDLING:\nPRIMARY RULE: DO NOT USE signature dates unless STRICTLY meeting the criteria below\nWHEN TO USE a signature date: ONLY IF that SPECIFIC signature date has an EXPLICIT statement marking IT as the effective date\nHere are some example scenarios:\n✓ USE: 'Effective Date: 1/13/2024' + 'Date: [blank]' below\n✓ USE: 'Effective Date of Agreement: 2/15/2016' + 'Date: [blank]' below\n\nWHEN NOT TO USE a signature date:\n- Even if there is an empty effective date section or field nearby\nHere are some example scenarios but not limited to:\n✗ DO NOT USE: 'Date: 1/1/2024' + 'Effective Date: [blank]' below\n✗ DO NOT USE: 'Effective Date: [blank]' + 'Date: 1/1/2024' below\n\nSECONDARY RULE – UNREFERENCED DATE NEAR “EFFECTIVE DATE:” LABEL:\nIf no explicit effective date is found in the contract, and the “Effective Date:” label appears with a blank or empty field, you MAY consider a nearby date as the effective date ONLY IF ALL of the following conditions are true:\n- The nearby date is NOT referenced by any signature, title, or labeled field (i.e., it is unassigned or free-floating)\n- Other nearby dates ARE explicitly labeled (e.g., under “Date” near signature lines or roles)\n- The unassigned date appears directly under or beside the “Effective Date:” label\n- The document does not provide a clearer effective date elsewhere\n\nIn such cases, treat the unreferenced date near the “Effective Date:” label as the effective date. Preserve the date's exact format as it appears.\n\n[OUTPUT DATE HANDLING]\nCRITICAL - DATE FORMAT PRESERVATION:\n- You MUST preserve the EXACT format of the date AS IT APPEARS in the document\n- DO NOT modify, standardize, or reformat the date in ANY way\n- Preserve ALL original: Spacing (including multiple spaces), punctuation, separators (commas, hyphens, forward slashes, etc.), leading/trailing spaces, or partial or incomplete dates\n\nExamples of EXACT DATE preservation:\n✓ If document shows: '3-1 , , 03' → return |3-1 , , 03|\n✓ If document shows: 'June 1st,2010' → return |June 1st,2010|\n✓ If document shows: 'Feb 1st day of , 10' → return |Feb 1st day of , 10|\n✓ If document shows: '6 /1/ 2010' → return |6 /1/ 2010|\n✓ If document shows: '12-1-20' → return |12-1-20|\n✓ If document shows: 'made this day of Jan, 2009' → return |day of Jan, 2009|\n✓ If document shows: 'to be effective as of , 20 ( the 'Effective Date').' → return |, 20|\n\nIt is POSSIBLE that the intended effective date could be blank (left blank, not filled), empty, incomplete, or partial. DO NOT ASSUME/INFER anything about the date or its components.\nReturn N/A only if NO valid effective date is found (e.g. cases with blank/empty/incomplete dates/placeholder values).\n\nIF MULTIPLE matches are retrieved:\n- VERIFY that you have PRECISELY followed the retrieval rules\n- If multiple matches are present, PRIORITIZE and SELECT the LATEST date as the answer\n- MAINTAIN the EXACT FORMAT of the selected date as it appears in the document\n\nBefore providing the final answer, SHOW your reasoning:\n- LIST ALL dates found that match patterns in the retrieval rules\n- For EACH date found:\n* EXPLAIN why it is considered for effective date or not\n* Include the EXACT text snippet where the date was found\n- JUSTIFY your final date selection or why N/A is being returned\n\nFinal Answer Format:\n- Your answer MUST be ENCLOSED in |pipes|\n- The text between the pipes MUST be an EXACT COPY of how the date appears in the document\n- DO NOT add or remove ANY characters, spaces, or formatting", "keywords": ["effective date", "effective date:","entered into", "shall be effective", "will become effective", "signature page"], "format": "date" }, diff --git a/fieldExtraction/src/prompts/prompt_templates.py b/fieldExtraction/src/prompts/prompt_templates.py index 16090b8..204e90b 100644 --- a/fieldExtraction/src/prompts/prompt_templates.py +++ b/fieldExtraction/src/prompts/prompt_templates.py @@ -740,13 +740,15 @@ def ONE_TO_ONE_MULTI_FIELD_TEMPLATE(context, questions: dict[str, str]): {context.replace('"', "'")} ## END CONTRACT TEXT ## -For each question, explain your reasoning. Then provide your final answers in a JSON dictionary format. +For each question, explain your reasoning. Then provide your final answers in a JSON dictionary format. Explanation MUST NOT contain any curly brackets '{{' or '}}'. Replace them with '()' instead. The JSON should: - Include every key - Use 'N/A' for any question where the requested information doesn't apply to this context - Use 'UNKNOWN' for any question where the requested information should exist but cannot be clearly identified - Contain only the final answers, not explanations +- NOT contain any curly brackets '{{' or '}}' inside. +- If curly bracket still exists inside JSON, replace them with '()' instead. Example format: I found the effective date in section 2.1 which states...