diff --git a/src/codes/code_funcs.py b/src/codes/code_funcs.py index 47d410c..c8a4a10 100644 --- a/src/codes/code_funcs.py +++ b/src/codes/code_funcs.py @@ -495,7 +495,7 @@ def fill_bill_type( cache=True, instruction=prompt_templates.FILL_BILL_TYPE_INSTRUCTION(), ) - llm_answer_final = string_utils.universal_json_load(llm_answer_raw) + llm_answer_final = _parser(llm_answer_raw) # Second attempt: Service term + reimbursement term + exhibit context (if first attempt failed and context available) if not llm_answer_final and exhibit_text: @@ -818,9 +818,6 @@ def grouper_breakout(results_with_code: pd.DataFrame): """ # try grouper fields again if they are empty and grouper_cd is not empty answer_dicts_with_code = results_with_code.to_dict(orient="records") - GROUPER_QUESTIONS = FieldSet( - file_path=config.FIELD_JSON_PATH, field_type="grouper_breakout" - ).print_prompt_dict() # Separate dicts that need grouper breakout from those that don't needs_breakout = [] @@ -840,10 +837,9 @@ def grouper_breakout(results_with_code: pd.DataFrame): # Parallelize LLM calls for rows that need breakout def process_grouper_breakout(answer_dict): - grouper_breakout_prompt = prompt_templates.GROUPER_BREAKOUT( + grouper_breakout_prompt, grouper_parser = prompt_templates.GROUPER_BREAKOUT( answer_dict.get("SERVICE_TERM", ""), answer_dict.get("REIMB_TERM", ""), - GROUPER_QUESTIONS, ) claude_answer_raw = llm_utils.invoke_claude( grouper_breakout_prompt, @@ -853,7 +849,7 @@ def grouper_breakout(results_with_code: pd.DataFrame): instruction=prompt_templates.GROUPER_BREAKOUT_INSTRUCTION(), ) try: - grouper_answer = string_utils.universal_json_load(claude_answer_raw) + grouper_answer = grouper_parser(claude_answer_raw) except Exception as e: grouper_answer = {"GROUPER_TYPE": e}