"""BCBS Promise client prompt_calls overrides. Only functions that MUST differ from SaaS live here. Everything else falls through to `src/pipelines/saas/prompts/prompt_calls.py` via the resolver shim at `src/pipelines/shared/prompts/prompt_calls.py`. See `docs/client_prompt_calls_drift_analysis.md` for the audit that retired the previous override set. """ import logging import src.prompts.prompt_templates as prompt_templates from src.utils import llm_utils, string_utils # CLIENT OVERRIDE — INTENTIONAL DIVERGENCE FROM SAAS # Reason: BCBS requires strict YES equality (`final_answer == "YES"`) rather # than SaaS's tolerant `"YES" in final_answer`. Borderline LLM responses # ("Yes.", "YES, ...") must be treated as NOT valid reimbursements for this # client. Requires business sign-off before alignment. # Reviewed: 2026-04-07 def validate_reimbursements_for_llm(answer_dict: dict[str, str], filename: str) -> bool: """Use LLM to determine if a service has actual reimbursement methodology.""" if isinstance(answer_dict, str): answer_dict = {"SERVICE_TERM": "", "REIMB_TERM": answer_dict} if string_utils.is_empty( answer_dict.get("SERVICE_TERM", None) ) or string_utils.is_empty(answer_dict.get("REIMB_TERM", None)): logging.warning( f"Missing SERVICE_TERM or REIMB_TERM in {filename}: {answer_dict}" ) return False service_term, reimb_term = answer_dict["SERVICE_TERM"], answer_dict["REIMB_TERM"] prompt, _parser = prompt_templates.VALIDATE_REIMBURSEMENTS_PROMPT( service_term, reimb_term ) logging.debug(f"Prompt for reimbursement validation in {filename}:\n{prompt}") llm_response = llm_utils.invoke_claude( prompt, "sonnet_latest", filename, cache=True, instruction=prompt_templates.VALIDATE_REIMBURSEMENTS_INSTRUCTION(), ) logging.debug( f"LLM response for reimbursement validation in {filename}:\n{llm_response}" ) final_answer = _parser(llm_response) return "YES" in final_answer