Refactor document processing endpoint to accept file_id as a path parameter and update related logic; modify DocumentProcessRequest to make file_id optional; add clarification to tax processing rules in DocumentProcessor.

This commit is contained in:
bolade
2025-10-07 12:36:04 +01:00
parent 659ca4ff15
commit b2bf631448
4 changed files with 26 additions and 25 deletions
+15 -15
View File
@@ -51,22 +51,22 @@ class MatchingEngine:
enhanced_matches = self._apply_manual_tax_analysis(
ai_matches, user_location
)
else:
# Use LLM-based tax analysis in a SINGLE batch call
try:
enhanced_matches = (
self.llm_tax_analyzer.analyze_and_apply_tax_rules_batch(
ai_matches, user_location
)
)
except Exception as e:
# If batch LLM analysis fails, log it and continue with matches as-is
import logging
# else:
# # Use LLM-based tax analysis in a SINGLE batch call
# try:
# enhanced_matches = (
# self.llm_tax_analyzer.analyze_and_apply_tax_rules_batch(
# ai_matches, user_location
# )
# )
# except Exception as e:
# # If batch LLM analysis fails, log it and continue with matches as-is
# import logging
logging.error(f"Batch LLM tax analysis failed: {str(e)}")
for match in ai_matches:
match.match_reason += " (Note: Advanced tax analysis unavailable)"
enhanced_matches = ai_matches
# logging.error(f"Batch LLM tax analysis failed: {str(e)}")
# for match in ai_matches:
# match.match_reason += " (Note: Advanced tax analysis unavailable)"
# enhanced_matches = ai_matches
return enhanced_matches