Merged in hotfix/exhibit-linking-fix (pull request #569)

Hotfix/exhibit linking fix

* Add test

* Add empty header condition

* Remove test


Approved-by: Alex Galarce
This commit is contained in:
Katon Minhas
2025-06-10 21:43:34 +00:00
committed by Alex Galarce
parent baf5002b2c
commit f556e352b8
+9 -7
View File
@@ -299,18 +299,20 @@ def link_exhibit_pages(all_exhibit_headers, filename):
# If literally identical, skip prompt
if page_header.upper().strip() == previous_header.upper().strip():
exhibit_is_different = "N"
elif string_utils.is_empty(previous_header):
exhibit_is_different = "Y"
previous_header = page_header
else:
prompt = investment_prompts.EXHIBIT_LINKAGE(page_header, previous_header)
claude_answer_raw = llm_utils.invoke_claude(prompt, config.MODEL_ID_CLAUDE35_SONNET, filename)
exhibit_is_different = string_utils.extract_text_from_delimiters(claude_answer_raw, Delimiter.PIPE)
# If the prompt has identified that the current exhibit is meaningfully different than the previous
if "Y" in exhibit_is_different:
final_exhibit_pages.append(page_num)
final_exhibit_headers[page_num] = page_header
previous_header = page_header
# If the prompt has identified that the current exhibit is meaningfully different than the previous
if "Y" in exhibit_is_different:
final_exhibit_pages.append(page_num)
final_exhibit_headers[page_num] = page_header
return final_exhibit_pages, final_exhibit_headers