diff --git a/src/codes/code_funcs.py b/src/codes/code_funcs.py index c7b92c6..58d889f 100644 --- a/src/codes/code_funcs.py +++ b/src/codes/code_funcs.py @@ -392,7 +392,8 @@ def code_implicit_rag(service, implicit_run_dict, filename, constants): try: llm_answer_final = _parser(llm_answer_raw) except Exception as e: - return {"CODE_METHODOLOGY": e} + logging.error(str(e)) + return {} if not llm_answer_final: continue diff --git a/src/pipelines/saas/prompts/prompt_calls.py b/src/pipelines/saas/prompts/prompt_calls.py index 6a4f027..279517e 100644 --- a/src/pipelines/saas/prompts/prompt_calls.py +++ b/src/pipelines/saas/prompts/prompt_calls.py @@ -357,6 +357,7 @@ def prompt_special_case_assignment( filename: str, ) -> dict[str, str]: + # If all non-term values are identical across dictionaries, return first dict non_term_keys = [k for k in special_case_dicts[0].keys() if "_TERM" not in k] if all( @@ -391,7 +392,7 @@ def prompt_special_case_assignment( # This is a special case - we need the index as an integer if isinstance(index_answer, list) and len(index_answer) > 0: index_str = str(index_answer[0]) # Convert to string first - if not string_utils.is_empty(index_str): + if not string_utils.is_empty(index_str) and int(index_str) < len(special_case_dicts): return special_case_dicts[int(index_str)] return {} except: @@ -850,7 +851,7 @@ def prompt_lesser_of_check( except json.JSONDecodeError as e: logging.error( f"Failed to parse LESSER_OF_CHECK JSON for service '{service_term}', " - f"exhibit '{exhibit_title}': {e}. Raw response: {llm_answer_final[:200]}... " + f"exhibit '{exhibit_title}': {e}. Raw response: {llm_answer_raw[:200]}... " f"Defaulting to STANDALONE" ) return {