diff --git a/fieldExtraction/src/investment/file_processing.py b/fieldExtraction/src/investment/file_processing.py index 25789ca..63fffbe 100644 --- a/fieldExtraction/src/investment/file_processing.py +++ b/fieldExtraction/src/investment/file_processing.py @@ -99,9 +99,7 @@ def run_one_to_n_prompts(filename, text_dict, exhibit_pages, exhibit_chunk_mappi for exhibit_page in exhibit_pages: exhibit_chunk = string_utils.get_exhibit_chunk(text_dict, exhibit_chunk_mapping, exhibit_page) if string_utils.contains_reimbursement(exhibit_chunk): - - print(exhibit_page) - + ################## INITIALIZE FIELDS ################## reimbursement_level_fields = FieldSet(relationship="one_to_n", field_type="reimbursement_level", file_path=FIELD_JSON_PATH) exhibit_level_fields = FieldSet(relationship="one_to_n", field_type="exhibit_level", file_path=FIELD_JSON_PATH) diff --git a/fieldExtraction/src/investment/one_to_n_funcs.py b/fieldExtraction/src/investment/one_to_n_funcs.py index b9d087a..e8bad37 100644 --- a/fieldExtraction/src/investment/one_to_n_funcs.py +++ b/fieldExtraction/src/investment/one_to_n_funcs.py @@ -166,7 +166,6 @@ def get_special_cases(reimbursement_primary_answers: list[dict], filename: str) for answer_dict in reimbursement_primary_answers: contract_service_cd, contract_reimbursement_method = answer_dict.get("CONTRACT_SERVICE_CD_OR_DESC"), answer_dict.get("CONTRACT_REIMBURSEMENT_METHOD") - print(contract_service_cd) if contract_service_cd and contract_reimbursement_method: llm_answer_final = string_utils.extract_text_from_delimiters( llm_utils.invoke_claude( @@ -175,7 +174,6 @@ def get_special_cases(reimbursement_primary_answers: list[dict], filename: str) filename ), Delimiter.PIPE) - print(f"LLM Answers Final: {llm_answer_final}") # Default if "DEFAULT_TERM" in llm_answer_final: diff --git a/fieldExtraction/src/investment/special_case_funcs.py b/fieldExtraction/src/investment/special_case_funcs.py index 8db1d6b..f51c455 100644 --- a/fieldExtraction/src/investment/special_case_funcs.py +++ b/fieldExtraction/src/investment/special_case_funcs.py @@ -10,39 +10,35 @@ def get_outlier_fields(answer_dict, filename): service, methodology = answer_dict.get("CONTRACT_SERVICE_CD_OR_DESC"), answer_dict.get("CONTRACT_REIMBURSEMENT_METHOD") answer_dict["CONTRACT_FACILITY_OUTLIER_TERMS"] = methodology questions = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="outlier") - llm_answer_final = string_utils.universal_json_load( - llm_utils.invoke_claude( + llm_answer_raw = llm_utils.invoke_claude( investment_prompts.SERVICE_METHODOLOGY_BREAKOUT(service, methodology, questions), config.MODEL_ID_CLAUDE35_SONNET, filename ) - ) + llm_answer_final = string_utils.universal_json_load(llm_answer_raw) return {**answer_dict, **llm_answer_final} - def get_stop_loss_fields(answer_dict, filename): service, methodology = answer_dict.get("CONTRACT_SERVICE_CD_OR_DESC"), answer_dict.get("CONTRACT_REIMBURSEMENT_METHOD") answer_dict["CONTRACT_FACILITY_STOP_LOSS_TERMS"] = methodology questions = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="stop_loss") - llm_answer_final = string_utils.universal_json_load( - llm_utils.invoke_claude( + llm_answer_raw = llm_utils.invoke_claude( investment_prompts.SERVICE_METHODOLOGY_BREAKOUT(service, methodology, questions), config.MODEL_ID_CLAUDE35_SONNET, filename ) - ) + llm_answer_final = string_utils.universal_json_load(llm_answer_raw) return {**answer_dict, **llm_answer_final} def get_sequestration_fields(answer_dict, filename): service, methodology = answer_dict.get("CONTRACT_SERVICE_CD_OR_DESC"), answer_dict.get("CONTRACT_REIMBURSEMENT_METHOD") questions = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="sequestration") - llm_answer_final = string_utils.universal_json_load( - llm_utils.invoke_claude( + llm_answer_raw = llm_utils.invoke_claude( investment_prompts.SERVICE_METHODOLOGY_BREAKOUT(service, methodology, questions), config.MODEL_ID_CLAUDE35_SONNET, filename ) - ) + llm_answer_final = string_utils.universal_json_load(llm_answer_raw) return {**answer_dict, **llm_answer_final} diff --git a/fieldExtraction/src/prompts/investment_prompts.py b/fieldExtraction/src/prompts/investment_prompts.py index 6cd1294..8865a24 100644 --- a/fieldExtraction/src/prompts/investment_prompts.py +++ b/fieldExtraction/src/prompts/investment_prompts.py @@ -498,7 +498,7 @@ Here is the Service and Methodology: Service: {service} Methodology: {methodology} -Determine if the Service and Methodology match any of the descriptions. +Determine if the Service and Methodology match any of the special case descriptions. If so, write the name of the Case. If they do not, simply write N/A. {PIPE_FORMAT_INSTRUCTIONS}