From a9b08388e3f3ef985d657b3d86e94b95dc12e24c Mon Sep 17 00:00:00 2001 From: VenkataKrishna Reddy Avula Date: Tue, 6 Jan 2026 16:40:59 +0000 Subject: [PATCH] Merged in bugfix/payer_name (pull request #827) Bugfix/payer name to main * added full context instruction for payer name * removed print statement Approved-by: Katon Minhas --- fieldExtraction/src/investment/hybrid_smart_chunking_funcs.py | 3 +++ fieldExtraction/src/prompts/prompt_templates.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/fieldExtraction/src/investment/hybrid_smart_chunking_funcs.py b/fieldExtraction/src/investment/hybrid_smart_chunking_funcs.py index 6bf54d2..21ace1a 100644 --- a/fieldExtraction/src/investment/hybrid_smart_chunking_funcs.py +++ b/fieldExtraction/src/investment/hybrid_smart_chunking_funcs.py @@ -256,6 +256,7 @@ def run_hybrid_smart_chunked_fields( raw = llm_utils.invoke_claude( prompt, "sonnet_latest", filename, max_tokens=8192 ) + logging.debug(f"Hybrid Smart Chunking RAG Raw response for {field.field_name}: {raw}") try: parsed = string_utils.universal_json_load( raw @@ -270,6 +271,8 @@ def run_hybrid_smart_chunked_fields( if answers_dict[field.field_name] == "N/A": field.field_type = "full_context" + if field.field_name == "PAYER_NAME": + field.prompt = field.prompt + prompt_templates.FULL_CONTEXT_PAYER_NAME_ADDITIONAL_INSTRUCTION() logging.warning( f"Obtained N/A for {field.field_name}, marking as full_context" ) diff --git a/fieldExtraction/src/prompts/prompt_templates.py b/fieldExtraction/src/prompts/prompt_templates.py index db903cf..eb395f0 100644 --- a/fieldExtraction/src/prompts/prompt_templates.py +++ b/fieldExtraction/src/prompts/prompt_templates.py @@ -986,6 +986,8 @@ def FULL_CONTEXT_ADDITIONAL_INSTRUCTIONS(allow_na): else: return " Do NOT leave this field N/A. Choose the most appropriate answer based on the context. If there are multiple answers, return them in a pipe (|) separated list." +def FULL_CONTEXT_PAYER_NAME_ADDITIONAL_INSTRUCTION(): + return " Additionally check the contract text for the payer name or payer organization name or payer entity or name of organization issuing the health plan/policy and Choose the most appropriate answer based on the context." def CHECK_PROVIDER_NAME_MATCH_PROMPT(provider_name: str, hybrid_smart_chunking_provider_group_name: str) -> str: """Create prompt for LLM-based provider name matching."""