From 849aa626dc26f880007b5637f69bef28bba9a67a Mon Sep 17 00:00:00 2001 From: ppanchigar Date: Tue, 14 Apr 2026 12:58:30 -0500 Subject: [PATCH] Fix client validate_reimbursements_for_llm to match SaaS behavior BCBS: change strict == "YES" to "YES" in final_answer. The strict equality was rejecting borderline LLM responses (e.g. "YES, ..."), dropping row counts from ~7 to 1. Clover: remove .strip().upper() which crashed with AttributeError because the parser returns a list, not a string. Every validation call failed, dropping row counts from 106 to 1. Both overrides now use the same "YES" in final_answer logic as SaaS. E2E verified: BCBS 5 rows (within LLM variance of baseline 7), Clover 106 rows (exact match to baseline). --- src/pipelines/clients/bcbs_promise/prompts/prompt_calls.py | 2 +- src/pipelines/clients/clover/prompts/prompt_calls.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pipelines/clients/bcbs_promise/prompts/prompt_calls.py b/src/pipelines/clients/bcbs_promise/prompts/prompt_calls.py index 9ebeaa8..41f636d 100644 --- a/src/pipelines/clients/bcbs_promise/prompts/prompt_calls.py +++ b/src/pipelines/clients/bcbs_promise/prompts/prompt_calls.py @@ -50,4 +50,4 @@ def validate_reimbursements_for_llm(answer_dict: dict[str, str], filename: str) f"LLM response for reimbursement validation in {filename}:\n{llm_response}" ) final_answer = _parser(llm_response) - return final_answer == "YES" + return "YES" in final_answer diff --git a/src/pipelines/clients/clover/prompts/prompt_calls.py b/src/pipelines/clients/clover/prompts/prompt_calls.py index 77a7f3c..5813b4a 100644 --- a/src/pipelines/clients/clover/prompts/prompt_calls.py +++ b/src/pipelines/clients/clover/prompts/prompt_calls.py @@ -49,5 +49,5 @@ def validate_reimbursements_for_llm(answer_dict: dict[str, str], filename: str) logging.debug( f"LLM response for reimbursement validation in {filename}:\n{llm_response}" ) - final_answer = _parser(llm_response).strip().upper() - return final_answer == "YES" + final_answer = _parser(llm_response) + return "YES" in final_answer