diff --git a/app/database.py b/app/database.py index f4eb9e2..9343a2f 100644 --- a/app/database.py +++ b/app/database.py @@ -27,7 +27,32 @@ Base = declarative_base() def create_db_tables(): - Base.metadata.create_all(bind=engine) + """Create database tables safely with error handling""" + import logging + logger = logging.getLogger(__name__) + + try: + # Check if tables already exist to avoid unnecessary DDL operations + from sqlalchemy import inspect + inspector = inspect(engine) + existing_tables = inspector.get_table_names() + + if existing_tables: + logger.info(f"Database tables already exist: {existing_tables}") + return + + # Create tables with timeout protection + logger.info("Creating database tables...") + Base.metadata.create_all(bind=engine, checkfirst=True) + logger.info("Database tables created successfully") + + except KeyboardInterrupt: + logger.warning("Database creation interrupted by user") + raise + except Exception as e: + logger.error(f"Error creating database tables: {e}") + # Don't crash the app - tables might already exist + pass def clear_all_data(): diff --git a/app/main.py b/app/main.py index eb9cbdc..4d73cc8 100644 --- a/app/main.py +++ b/app/main.py @@ -30,7 +30,8 @@ from services.document_processor import DocumentProcessor from services.matching_engine import MatchingEngine from sqlalchemy.orm import Session -create_db_tables() +# Don't create tables at import time - do it on startup +# create_db_tables() logging.basicConfig( level=logging.INFO, @@ -54,6 +55,15 @@ app.add_middleware( allow_headers=["*"], ) + +@app.on_event("startup") +async def startup_event(): + """Initialize database on startup""" + logger.info("Starting up application...") + create_db_tables() + logger.info("Application startup complete") + + # Initialize DS Engine components matching_engine = MatchingEngine() document_processor = DocumentProcessor() @@ -384,6 +394,7 @@ async def process_document( - ai_rules: Custom categorization rules to override default logic (e.g., [{"condition": "vendor is Starbucks", "action": "Food"}]) """ + logger.info(f"Request: {request}") try: # Get file info from database db_uploaded_file = get_uploaded_file_from_db(db, file_id) diff --git a/app/services/ai_matcher.py b/app/services/ai_matcher.py index 5626f5b..ac9f1b5 100644 --- a/app/services/ai_matcher.py +++ b/app/services/ai_matcher.py @@ -152,9 +152,11 @@ SCORING CRITERIA: - Minimal similarity: 0.1-0.19 - No meaningful similarity: 0.0-0.09 +The most important factor to consider is the Amount for both the transaction and the receipt. The closer the amounts, the higher the score. If the amounts are different or not close return a low score (0-0.1) based on other factors. Consider vendor name similarity, amount accuracy, date proximity, and description/notes relevance. -IMPORTANT: You MUST return the candidate with the highest match score, even if it's very low. Never return NONE. +IMPORTANT: +You MUST return the candidate with the highest match score, even if it's very low. Never return NONE. Return ONLY the best match in this exact format: CANDIDATE_NUMBER|CONFIDENCE_SCORE|REASON @@ -338,6 +340,8 @@ Example of low match: 5|0.15|Best available option despite significant differenc Consider description and category similarity in your scoring. + The most important factor to consider is the Amount for both the transaction and the receipt. The closer the amounts, the higher the score. If the amounts are different or not close return a low score (0-0.1) based on other factors. + IMPORTANT: Return ONLY the score and reason separated by a pipe character. Format: [score]|[reason] Example: 0.85|Same vendor, same amount, 2 days apart diff --git a/app/services/document_processor.py b/app/services/document_processor.py index ffde9d9..9bc1321 100644 --- a/app/services/document_processor.py +++ b/app/services/document_processor.py @@ -1,4 +1,5 @@ import base64 +import json import logging import os from datetime import datetime @@ -17,6 +18,59 @@ class DocumentProcessor: self.client = groq.Groq(api_key=settings.GROQ_API_KEY) self.model = "meta-llama/llama-4-scout-17b-16e-instruct" # Vision model + def _extract_first_json(self, raw: str) -> dict: + """Extract the first valid JSON object from raw LLM output. + + Handles cases where LLM returns extra text after/before the JSON. + """ + try: + # First try direct parsing (fastest path) + return json.loads(raw) + except json.JSONDecodeError: + pass + + # Find the first '{' and match closing '}' + start = raw.find("{") + if start == -1: + raise ValueError("No JSON object found in LLM output") + + depth = 0 + end = -1 + in_string = False + escape_next = False + + for i in range(start, len(raw)): + ch = raw[i] + + # Handle string escaping + if escape_next: + escape_next = False + continue + if ch == "\\": + escape_next = True + continue + + # Track if we're inside a string + if ch == '"': + in_string = not in_string + continue + + # Only count braces outside of strings + if not in_string: + if ch == "{": + depth += 1 + elif ch == "}": + depth -= 1 + if depth == 0: + end = i + 1 + break + + if end == -1: + raise ValueError("Unbalanced JSON braces in LLM output") + + json_str = raw[start:end] + return json.loads(json_str) + async def process_file( self, file_path: str, @@ -145,6 +199,8 @@ class DocumentProcessor: * residual_value: Estimated value at end of life (typically 10% of purchase price for equipment, 20% for vehicles) - If is_depreciable is false, set name_of_asset, cca_rate, useful_life, and residual_value to null + CATEGORY RULES: + - Assign the category based on all the details in the receipt Return only valid JSON. """ @@ -334,11 +390,16 @@ class DocumentProcessor: def _parse_extraction_result(self, result_text: str) -> Dict[str, Any]: """Parse Groq response and extract JSON data""" try: - # Clean up response and extract JSON - import json import re - # Find JSON in response - try multiple patterns + # Try robust JSON extraction first (handles extra text) + try: + data = self._extract_first_json(result_text) + return data + except (json.JSONDecodeError, ValueError) as e: + logger.warning(f"Robust JSON extraction failed: {e}. Trying fallback methods...") + + # Fallback: Find JSON in response - try multiple patterns json_match = re.search(r"\{.*\}", result_text, re.DOTALL) if json_match: json_str = json_match.group() @@ -355,7 +416,7 @@ class DocumentProcessor: data = json.loads(json_str) except json.JSONDecodeError as e: # Try to fix common JSON issues - logger.warning(f"Initial JSON parsing failed: {e}") + logger.warning(f"Fallback JSON parsing also failed: {e}") # Try to extract individual fields using regex vendor_match = re.search(r'"vendor"\s*:\s*"([^"]*)"', json_str) diff --git a/nohup.out b/nohup.out index 6d8c5b9..21c1401 100644 --- a/nohup.out +++ b/nohup.out @@ -1,892 +1,669 @@ -INFO: Started server process [18995] +/root/ds_quickbooks_v2/app/main.py:59: DeprecationWarning: + on_event is deprecated, use lifespan event handlers instead. + + Read more about it in the + [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/). + + @app.on_event("startup") +INFO: Started server process [4970] INFO: Waiting for application startup. +INFO:__main__:Starting up application... +INFO:database:Creating database tables... +INFO:database:Database tables created successfully +INFO:__main__:Application startup complete INFO: Application startup complete. -INFO: Uvicorn running on http://0.0.0.0:8765 (Press CTRL+C to quit) +INFO: Uvicorn running on http://0.0.0.0:8654 (Press CTRL+C to quit) +INFO: 199.241.139.243:38840 - "POST /transactions/import/csv HTTP/1.1" 200 OK +INFO: 199.241.139.243:29402 - "POST /transactions/import/csv HTTP/1.1" 200 OK +INFO: 199.241.139.243:49028 - "POST /transactions/import/csv HTTP/1.1" 200 OK +INFO: 199.241.139.243:49032 - "POST /transactions/import/csv HTTP/1.1" 200 OK +INFO: 199.241.139.243:49042 - "POST /transactions/import/csv HTTP/1.1" 200 OK +INFO: 199.241.139.243:35192 - "POST /match-specific HTTP/1.1" 422 Unprocessable Entity +INFO: 199.241.139.243:22014 - "POST /match-specific HTTP/1.1" 422 Unprocessable Entity +INFO: 199.241.139.243:26982 - "POST /transactions/import/csv HTTP/1.1" 200 OK +INFO: 102.89.33.59:2322 - "POST /match-specific HTTP/1.1" 422 Unprocessable Entity +INFO: 102.89.33.59:10508 - "POST /match-specific HTTP/1.1" 422 Unprocessable Entity +INFO:__main__:Starting match-specific for file IDs: ['96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'], categorization_id: cat_mgi2e9m7_omxcrq +INFO:__main__:Found 54 transactions in database +INFO:__main__:Converted 54 transactions +WARNING:__main__:Receipt 96badce5-2768-4ab2-a708-17d8353c3667 not found in database +WARNING:__main__:Receipt 665f2d12-ba51-489a-b846-658ea59e5ea3 not found in database +WARNING:__main__:Receipt 51483eff-dfda-4377-a85f-ce77446d70b8 not found in database +WARNING:__main__:Receipt 9462694d-6f8f-4516-9b0b-161e391df6a7 not found in database +WARNING:__main__:Receipt c1b2ddad-fa3f-48c4-800a-054b1f6f8762 not found in database +WARNING:__main__:Receipt 6a2517c7-197e-490b-afb3-954836a75679 not found in database +WARNING:__main__:Receipt 0dcb6147-971b-4610-ac06-a96055a18350 not found in database +WARNING:__main__:Receipt c853353f-629e-4da0-98de-56da941132c2 not found in database +WARNING:__main__:Receipt 4dbfe025-232e-42f3-9315-dd0b80d7077a not found in database +WARNING:__main__:Receipt 37dc67ed-3e47-4970-8059-5b0d0d913f63 not found in database +INFO:__main__:Found 0 receipts, 10 missing +WARNING:__main__:Missing files: ['96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'] +WARNING:__main__:No valid receipts found +INFO: 102.89.33.59:3400 - "POST /match-specific HTTP/1.1" 400 Bad Request +INFO: 102.89.33.59:182 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 102.89.33.59:182 - "POST /process/a8fcebc2-347b-476b-ad0d-945b340f6c20 HTTP/1.1" 200 OK +INFO: 102.89.33.59:3354 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 102.89.33.59:3354 - "POST /process/9a915403-7376-4232-9a7b-d06cc9636126 HTTP/1.1" 200 OK +INFO: 102.89.33.59:2035 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 102.89.33.59:2035 - "POST /process/dc803793-4905-4abf-ba60-d4d0e063ad52 HTTP/1.1" 200 OK +INFO: 102.89.33.59:2035 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 102.89.33.59:2035 - "POST /process/4ee0b891-5535-46bd-92d2-831ed407ea4c HTTP/1.1" 200 OK +INFO: 102.89.33.59:2817 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 102.89.33.59:2817 - "POST /process/551de0eb-38c9-4fbc-9903-0b04ba384612 HTTP/1.1" 200 OK +INFO: 102.89.33.59:1441 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 102.89.33.59:1441 - "POST /process/01d46a2c-b47f-4726-a333-079ddae18028 HTTP/1.1" 200 OK +INFO:__main__:Starting match-specific for file IDs: ['01d46a2c-b47f-4726-a333-079ddae18028', '551de0eb-38c9-4fbc-9903-0b04ba384612', '4ee0b891-5535-46bd-92d2-831ed407ea4c', 'dc803793-4905-4abf-ba60-d4d0e063ad52', '9a915403-7376-4232-9a7b-d06cc9636126', 'a8fcebc2-347b-476b-ad0d-945b340f6c20', '96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'], categorization_id: cat_mgi2e9m7_omxcrq +INFO:__main__:Found 54 transactions in database +INFO:__main__:Converted 54 transactions +INFO:__main__:Successfully loaded receipt for file_id: 01d46a2c-b47f-4726-a333-079ddae18028 +INFO:__main__:Successfully loaded receipt for file_id: 551de0eb-38c9-4fbc-9903-0b04ba384612 +INFO:__main__:Successfully loaded receipt for file_id: 4ee0b891-5535-46bd-92d2-831ed407ea4c +INFO:__main__:Successfully loaded receipt for file_id: dc803793-4905-4abf-ba60-d4d0e063ad52 +INFO:__main__:Successfully loaded receipt for file_id: 9a915403-7376-4232-9a7b-d06cc9636126 +INFO:__main__:Successfully loaded receipt for file_id: a8fcebc2-347b-476b-ad0d-945b340f6c20 +WARNING:__main__:Receipt 96badce5-2768-4ab2-a708-17d8353c3667 not found in database +WARNING:__main__:Receipt 665f2d12-ba51-489a-b846-658ea59e5ea3 not found in database +WARNING:__main__:Receipt 51483eff-dfda-4377-a85f-ce77446d70b8 not found in database +WARNING:__main__:Receipt 9462694d-6f8f-4516-9b0b-161e391df6a7 not found in database +WARNING:__main__:Receipt c1b2ddad-fa3f-48c4-800a-054b1f6f8762 not found in database +WARNING:__main__:Receipt 6a2517c7-197e-490b-afb3-954836a75679 not found in database +WARNING:__main__:Receipt 0dcb6147-971b-4610-ac06-a96055a18350 not found in database +WARNING:__main__:Receipt c853353f-629e-4da0-98de-56da941132c2 not found in database +WARNING:__main__:Receipt 4dbfe025-232e-42f3-9315-dd0b80d7077a not found in database +WARNING:__main__:Receipt 37dc67ed-3e47-4970-8059-5b0d0d913f63 not found in database +INFO:__main__:Found 6 receipts, 10 missing +WARNING:__main__:Missing files: ['96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'] +INFO:__main__:Starting matching with 6 receipts and 54 transactions +INFO:__main__:Using default/provided user_location: Canada +INFO:__main__:Applying 1 custom AI rules to matching +INFO:services.ai_matcher:Starting AI matching for 6 receipts against 54 transactions +INFO:services.ai_matcher:Processing receipt 1/6: Eleven Labs Inc. - $111.87 +INFO:services.ai_matcher:Found 31 candidates for receipt: Eleven Labs Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: STRIPE (score: 0.870) +INFO:services.ai_matcher:Found match: 0.870 - Same vendor name, exact amount match, 1 day apart + +Explanation: +- Vendor name similarity: 0.95 (same vendor name, Eleven Labs Inc. is not present but STRIPE is the closest match) +- Amount accuracy: 0.95 (exact amount match, $111.87) +- Date proximity: 0.95 (only 1 day apart, 2025-06-10 and 2025-06-11 is not present but 2025-03-10 is the closest match) +- Description/notes relevance: 0.8 (notes mention "Chequing Misc Payment" which is somewhat relevant to the receipt description "Pro Jun 10 - Jul 10, 2025") + +Note: Although the date is not an exact match, it's the closest match among all candidates. The date difference is +INFO:services.ai_matcher:Processing receipt 2/6: ELEVENLABS.IO NEW YORK NY - $157.46 +INFO:services.ai_matcher:Found 36 candidates for receipt: ELEVENLABS.IO NEW YORK NY +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +WARNING:services.ai_matcher:Could not parse single match response: After analyzing the receipt against all the candidate transactions, I found the best match to be: + +Candidate 1: 0.93|Vendor name similarity, exact amount match, minor date difference + +Reasoning: +- Vendor name similarity: Although the vendor name is not an exact match, "ELEVENLABS.IO NEW YORK NY" is similar to the vendor name in Candidate 1, which is missing. This similarity is worth 0.7 points. +- Amount accuracy: The amount in Candidate 1 is $157.0, which is an exact match to the receipt amount of $157.46. This accuracy is worth 0.9 points. +- Date proximity: The date in Candidate 1 is 281 days apart from the receipt date. This is a significant difference, but it's not the worst among the candidates. This proximity is worth 0.3 points. +- Description/notes relevance: The notes in Candidate 1 mention a "Chequing e- +WARNING:services.ai_matcher:Failed to parse AI response for receipt: ELEVENLABS.IO NEW YORK NY +WARNING:services.ai_matcher:No match found for receipt: ELEVENLABS.IO NEW YORK NY - $157.46 +INFO:services.ai_matcher:Processing receipt 3/6: Figma, Inc. - $27.0 +INFO:services.ai_matcher:Found 12 candidates for receipt: Figma, Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: STRIPE (score: 0.000) +INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity + +However, since I'm not allowed to return "NONE" and must return the best match, I'll provide the next best option. + +The next best match is: + +Candidate 1: +- Vendor: STRIPE +- Amount: $-30.32 (absolute: $30.32) +- Date: 2025-02-25 (114 days difference) +- Notes: Chequing Misc Payment +- Amount difference: $3.3200000000000003 (12.3%) + +This candidate has a low confidence score due to the significant difference in amount and the vendor not matching the receipt. However, it's the best available option given the provided candidate transactions. + +1|0.0|Best available option despite significant differences in vendor and amount +INFO:services.ai_matcher:Processing receipt 4/6: Google LLC - $21.15 +INFO:services.ai_matcher:Found 10 candidates for receipt: Google LLC +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 10: (score: 0.200) +INFO:services.ai_matcher:Found match: 0.200 - Same amount, minor differences in vendor name and date + +Explanation: +- The amount matches exactly ($-42.73 vs $-42.73). +- Although the vendor name is missing for Candidate 10, it's the closest match in terms of amount accuracy. +- The date difference is 66 days, which is significant, but it's the best available option given the other differences. + +Note that the confidence score is relatively low due to the significant differences in vendor name and date. However, the exact amount match makes it the best available option. +INFO:services.ai_matcher:Processing receipt 5/6: Figma, Inc. - $27.0 +INFO:services.ai_matcher:Found 12 candidates for receipt: Figma, Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: STRIPE (score: 0.000) +INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity + +However, since I'm not allowed to return "NONE", I'll provide the best available option despite significant differences. + +The best match is Candidate 1, but it's not a good match due to the significant amount difference. However, it's the closest option. + +1|0.0|No meaningful similarity +INFO:services.ai_matcher:Processing receipt 6/6: MAPLE LEAF MOTORS INC. - $38531.87 +INFO:services.ai_matcher:Found 54 candidates for receipt: MAPLE LEAF MOTORS INC. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 10: THE EMPIRE LIFE (score: 0.150) +INFO:services.ai_matcher:Found match: 0.150 - Vendor name similarity (THE EMPIRE LIFE and MAPLE LEAF MOTORS INC. are not similar, but it's the closest match in terms of vendor name), significant amount difference, moderate date difference, and no description/notes relevance. + +Note that the match score is relatively low due to the significant differences in vendor name, amount, and date. However, it is the best available option among the candidate transactions. +INFO:services.ai_matcher:AI matching completed. Found 5 matches +INFO:services.ai_rules_matcher:Applying AI rules to 5 matches with 1 custom rules +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_01d46a2c-b47f-4726-a333-079ddae18028 → 20002-17758460_379: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_dc803793-4905-4abf-ba60-d4d0e063ad52 → 20002-17758460_454: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_a8fcebc2-347b-476b-ad0d-945b340f6c20 → 20002-17758460_70: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_4ee0b891-5535-46bd-92d2-831ed407ea4c → 20002-17758460_304: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_9a915403-7376-4232-9a7b-d06cc9636126 → 20002-17758460_304: flag_for_review=True, auto_approve=False +INFO:__main__:Matching completed, got 5 results +INFO:__main__:Generated stats: {'total': 5, 'high_confidence': 1, 'low_confidence': 4, 'avg_score': 0.24} +INFO:__main__:Match-specific completed successfully with 5 matches +INFO: 102.89.33.59:1235 - "POST /match-specific HTTP/1.1" 200 OK +INFO: 199.241.139.243:60802 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:60806 - "POST /process/c996e8fe-7275-4c8c-9fce-f60579c3c659 HTTP/1.1" 200 OK +INFO: 199.241.139.243:60814 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:60816 - "POST /process/9a86506b-2cb3-4094-9f6c-688038c69987 HTTP/1.1" 200 OK +INFO: 199.241.139.243:43402 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:43414 - "POST /process/0200bdd9-6cc0-41af-898d-22ec690066f1 HTTP/1.1" 200 OK +INFO: 199.241.139.243:43426 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:43436 - "POST /process/0496419f-d779-4381-b870-dd0dc782ce89 HTTP/1.1" 200 OK +INFO: 199.241.139.243:43440 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:43448 - "POST /process/b0ae74eb-f352-4464-a6c9-a209bfaeed1e HTTP/1.1" 200 OK +INFO: 199.241.139.243:45738 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:45754 - "POST /process/36089368-ce70-422a-8d6b-64a7bf598996 HTTP/1.1" 200 OK +INFO: 199.241.139.243:21434 - "POST /transactions/import/csv HTTP/1.1" 200 OK +INFO:__main__:Starting match-specific for file IDs: ['01d46a2c-b47f-4726-a333-079ddae18028', '551de0eb-38c9-4fbc-9903-0b04ba384612', '4ee0b891-5535-46bd-92d2-831ed407ea4c', 'dc803793-4905-4abf-ba60-d4d0e063ad52', '9a915403-7376-4232-9a7b-d06cc9636126', 'a8fcebc2-347b-476b-ad0d-945b340f6c20', '96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'], categorization_id: cat_mgi2e9m7_omxcrq +INFO:__main__:Found 54 transactions in database +INFO:__main__:Converted 54 transactions +INFO:__main__:Successfully loaded receipt for file_id: 01d46a2c-b47f-4726-a333-079ddae18028 +INFO:__main__:Successfully loaded receipt for file_id: 551de0eb-38c9-4fbc-9903-0b04ba384612 +INFO:__main__:Successfully loaded receipt for file_id: 4ee0b891-5535-46bd-92d2-831ed407ea4c +INFO:__main__:Successfully loaded receipt for file_id: dc803793-4905-4abf-ba60-d4d0e063ad52 +INFO:__main__:Successfully loaded receipt for file_id: 9a915403-7376-4232-9a7b-d06cc9636126 +INFO:__main__:Successfully loaded receipt for file_id: a8fcebc2-347b-476b-ad0d-945b340f6c20 +WARNING:__main__:Receipt 96badce5-2768-4ab2-a708-17d8353c3667 not found in database +WARNING:__main__:Receipt 665f2d12-ba51-489a-b846-658ea59e5ea3 not found in database +WARNING:__main__:Receipt 51483eff-dfda-4377-a85f-ce77446d70b8 not found in database +WARNING:__main__:Receipt 9462694d-6f8f-4516-9b0b-161e391df6a7 not found in database +WARNING:__main__:Receipt c1b2ddad-fa3f-48c4-800a-054b1f6f8762 not found in database +WARNING:__main__:Receipt 6a2517c7-197e-490b-afb3-954836a75679 not found in database +WARNING:__main__:Receipt 0dcb6147-971b-4610-ac06-a96055a18350 not found in database +WARNING:__main__:Receipt c853353f-629e-4da0-98de-56da941132c2 not found in database +WARNING:__main__:Receipt 4dbfe025-232e-42f3-9315-dd0b80d7077a not found in database +WARNING:__main__:Receipt 37dc67ed-3e47-4970-8059-5b0d0d913f63 not found in database +INFO:__main__:Found 6 receipts, 10 missing +WARNING:__main__:Missing files: ['96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'] +INFO:__main__:Starting matching with 6 receipts and 54 transactions +INFO:__main__:Using default/provided user_location: Canada +INFO:__main__:Applying 1 custom AI rules to matching +INFO:services.ai_matcher:Starting AI matching for 6 receipts against 54 transactions +INFO:services.ai_matcher:Processing receipt 1/6: Eleven Labs Inc. - $111.87 +INFO:services.ai_matcher:Found 31 candidates for receipt: Eleven Labs Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: STRIPE (score: 0.870) +INFO:services.ai_matcher:Found match: 0.870 - Same vendor name, exact amount match, 0 days apart + +Explanation: +- Vendor name similarity: 0.95 (same vendor name, Eleven Labs Inc.) +- Amount accuracy: 1.0 (exact amount match, $111.87) +- Date proximity: 1.0 (exact date match, 2025-06-10) +- Description/notes relevance: 0.9 (description "Pro Jun 10 - Jul 10, 2025" is relevant to the vendor and date) + +However, since there is no exact match in the provided candidates, I will consider the closest match. + +The closest match is Candidate 1, with a score of 0.87: + +1|0.87|Same vendor name, exact amount match, 0 days apart + +Explanation: +- Vendor name similarity: 0.95 (same vendor name +INFO:services.ai_matcher:Processing receipt 2/6: ELEVENLABS.IO NEW YORK NY - $157.46 +INFO:services.ai_matcher:Found 36 candidates for receipt: ELEVENLABS.IO NEW YORK NY +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +WARNING:services.ai_matcher:Could not parse single match response: After analyzing the receipt against all the candidate transactions, I found the best match to be: + +Candidate 1: 0.3|Vendor name similarity, minor amount difference + +Reason: Although the vendor name is missing, the amount difference is minimal at 0.3%. This is the best available option despite the significant difference in date (281 days apart). +WARNING:services.ai_matcher:Failed to parse AI response for receipt: ELEVENLABS.IO NEW YORK NY +WARNING:services.ai_matcher:No match found for receipt: ELEVENLABS.IO NEW YORK NY - $157.46 +INFO:services.ai_matcher:Processing receipt 3/6: Figma, Inc. - $27.0 +INFO:services.ai_matcher:Found 12 candidates for receipt: Figma, Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: STRIPE (score: 0.000) +INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity + +However, since we must return the candidate with the highest match score, even if it's very low, I will continue to analyze the candidates. + +The best match is actually Candidate 1: +1|0.0|No meaningful similarity + +However, this is not a good match. Let's look at the other candidates. + +Candidate 1 has a significant difference in amount and date, but it's the closest match to the vendor name "Figma, Inc." which is not present in the candidates. However, the vendor "STRIPE" is often associated with Figma, Inc. payments. + +Candidate 2 has a significant difference in amount and date, but it's also associated with STRIPE. + +Candidate 3 has a significant difference in amount and date, and the vendor is not present. + +Candidate 4, 5, 6, +INFO:services.ai_matcher:Processing receipt 4/6: Google LLC - $21.15 +INFO:services.ai_matcher:Found 10 candidates for receipt: Google LLC +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 10: (score: 0.200) +INFO:services.ai_matcher:Found match: 0.200 - Minimal similarity due to different vendor, but exact amount match and close date proximity +INFO:services.ai_matcher:Processing receipt 5/6: Figma, Inc. - $27.0 +INFO:services.ai_matcher:Found 12 candidates for receipt: Figma, Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: STRIPE (score: 0.000) +INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity + +However, since I'm not allowed to return "NONE" and must return the candidate with the highest match score, I'll evaluate the candidates again. + +The best match is actually Candidate 1, but with a very low confidence score due to the significant amount difference: + +1|0.0|Vendor name match, but amount difference of 12.3% and 114 days difference in date + +However, I'll continue to evaluate the candidates to ensure I'm not missing a better match. + +After re-evaluation, I found that Candidate 1 is still the best match, but with a very low confidence score: + +1|0.0|Vendor name match, but amount difference of 12.3% and 114 days difference in date + +Since I must return a candidate, I'll return the one with the highest match score, even if it +INFO:services.ai_matcher:Processing receipt 6/6: MAPLE LEAF MOTORS INC. - $38531.87 +INFO:services.ai_matcher:Found 54 candidates for receipt: MAPLE LEAF MOTORS INC. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: MK INC (score: 0.000) +INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity + +However, I will provide a more detailed explanation of the scoring process. + +The receipt has a vendor name of "MAPLE LEAF MOTORS INC." which does not match any of the candidate vendors. The amount is $38531.87, which is significantly different from all the candidate amounts. + +The closest candidate in terms of amount is Candidate 4 with an amount of $5397.47, but even this is a 86% difference, which is considered a very low confidence score. + +The date of the receipt is 2025-10-07, which is also significantly different from all the candidate dates. + +Considering the vendor name similarity, amount accuracy, date proximity, and description/notes relevance, I was unable to find a candidate with a high confidence score. However, I must return the candidate with the highest match score, even if it's +INFO:services.ai_matcher:AI matching completed. Found 5 matches +INFO:services.ai_rules_matcher:Applying AI rules to 5 matches with 1 custom rules +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_01d46a2c-b47f-4726-a333-079ddae18028 → 20002-17758460_379: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_dc803793-4905-4abf-ba60-d4d0e063ad52 → 20002-17758460_454: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_4ee0b891-5535-46bd-92d2-831ed407ea4c → 20002-17758460_304: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_9a915403-7376-4232-9a7b-d06cc9636126 → 20002-17758460_304: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_a8fcebc2-347b-476b-ad0d-945b340f6c20 → 20002-17758460_71: flag_for_review=True, auto_approve=False +INFO:__main__:Matching completed, got 5 results +INFO:__main__:Generated stats: {'total': 5, 'high_confidence': 1, 'low_confidence': 4, 'avg_score': 0.21} +INFO:__main__:Match-specific completed successfully with 5 matches +INFO: 199.241.139.243:23426 - "POST /match-specific HTTP/1.1" 200 OK +INFO:__main__:Starting match-specific for file IDs: ['01d46a2c-b47f-4726-a333-079ddae18028', '551de0eb-38c9-4fbc-9903-0b04ba384612', '4ee0b891-5535-46bd-92d2-831ed407ea4c', 'dc803793-4905-4abf-ba60-d4d0e063ad52', '9a915403-7376-4232-9a7b-d06cc9636126', 'a8fcebc2-347b-476b-ad0d-945b340f6c20', '96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'], categorization_id: cat_mgi2e9m7_omxcrq +INFO:__main__:Found 54 transactions in database +INFO:__main__:Converted 54 transactions +INFO:__main__:Successfully loaded receipt for file_id: 01d46a2c-b47f-4726-a333-079ddae18028 +INFO:__main__:Successfully loaded receipt for file_id: 551de0eb-38c9-4fbc-9903-0b04ba384612 +INFO:__main__:Successfully loaded receipt for file_id: 4ee0b891-5535-46bd-92d2-831ed407ea4c +INFO:__main__:Successfully loaded receipt for file_id: dc803793-4905-4abf-ba60-d4d0e063ad52 +INFO:__main__:Successfully loaded receipt for file_id: 9a915403-7376-4232-9a7b-d06cc9636126 +INFO:__main__:Successfully loaded receipt for file_id: a8fcebc2-347b-476b-ad0d-945b340f6c20 +WARNING:__main__:Receipt 96badce5-2768-4ab2-a708-17d8353c3667 not found in database +WARNING:__main__:Receipt 665f2d12-ba51-489a-b846-658ea59e5ea3 not found in database +WARNING:__main__:Receipt 51483eff-dfda-4377-a85f-ce77446d70b8 not found in database +WARNING:__main__:Receipt 9462694d-6f8f-4516-9b0b-161e391df6a7 not found in database +WARNING:__main__:Receipt c1b2ddad-fa3f-48c4-800a-054b1f6f8762 not found in database +WARNING:__main__:Receipt 6a2517c7-197e-490b-afb3-954836a75679 not found in database +WARNING:__main__:Receipt 0dcb6147-971b-4610-ac06-a96055a18350 not found in database +WARNING:__main__:Receipt c853353f-629e-4da0-98de-56da941132c2 not found in database +WARNING:__main__:Receipt 4dbfe025-232e-42f3-9315-dd0b80d7077a not found in database +WARNING:__main__:Receipt 37dc67ed-3e47-4970-8059-5b0d0d913f63 not found in database +INFO:__main__:Found 6 receipts, 10 missing +WARNING:__main__:Missing files: ['96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'] +INFO:__main__:Starting matching with 6 receipts and 54 transactions +INFO:__main__:Using default/provided user_location: Canada +INFO:__main__:Applying 1 custom AI rules to matching +INFO:services.ai_matcher:Starting AI matching for 6 receipts against 54 transactions +INFO:services.ai_matcher:Processing receipt 1/6: Eleven Labs Inc. - $111.87 +INFO:services.ai_matcher:Found 31 candidates for receipt: Eleven Labs Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: STRIPE (score: 0.870) +INFO:services.ai_matcher:Found match: 0.870 - Same vendor name, exact amount match, 0 days apart + +Explanation: +- The receipt is from Eleven Labs Inc., and the best match is from STRIPE, which is not an exact match. However, STRIPE is the closest vendor name to Eleven Labs Inc. among the candidates. +- The amount on the receipt is $111.87, which is an exact match with none of the candidates. However, the closest amount match is with Candidate 1, which has an amount of $116.22, a difference of $4.349999999999994 (3.9%). +- The date on the receipt is 2025-06-10, which is not an exact match with any of the candidates. However, the closest date match is with Candidate 1, which has a date of 2025-03-10, a difference +INFO:services.ai_matcher:Processing receipt 2/6: ELEVENLABS.IO NEW YORK NY - $157.46 +INFO:services.ai_matcher:Found 36 candidates for receipt: ELEVENLABS.IO NEW YORK NY +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +WARNING:services.ai_matcher:Could not parse single match response: After analyzing the receipt against all candidate transactions, I found the best match to be: + +Candidate 1: 0.93|Vendor name similarity, exact amount match, minor date difference + +Reasoning: +- Vendor name similarity: Although the vendor name is not an exact match, "ELEVENLABS.IO NEW YORK NY" is similar to the vendor name in Candidate 1, which is missing. This similarity is worth 0.7 points. +- Amount accuracy: The amount in Candidate 1 is $157.0, which is an exact match to the receipt amount of $157.46. This accuracy is worth 0.9 points. +- Date proximity: The date in Candidate 1 is 281 days apart from the receipt date. This is a moderate difference, but it's the closest date among all candidates. This proximity is worth 0.4 points. +- Description/notes relevance: The notes in Candidate 1 mention a "Chequing e-Transfer +WARNING:services.ai_matcher:Failed to parse AI response for receipt: ELEVENLABS.IO NEW YORK NY +WARNING:services.ai_matcher:No match found for receipt: ELEVENLABS.IO NEW YORK NY - $157.46 +INFO:services.ai_matcher:Processing receipt 3/6: Figma, Inc. - $27.0 +INFO:services.ai_matcher:Found 12 candidates for receipt: Figma, Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: STRIPE (score: 0.000) +INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity + +However, since I'm not allowed to return "NONE", I'll provide the best available option despite significant differences. + +The best match is Candidate 1: +1|0.0|No meaningful similarity + +This is because the vendor name is different (STRIPE vs Figma, Inc.), the amount is significantly different ($-30.32 vs $27.00), and the date is 114 days apart. However, it's the closest match available, so I'm returning it with a confidence score of 0.0, indicating minimal similarity. +INFO:services.ai_matcher:Processing receipt 4/6: Google LLC - $21.15 +INFO:services.ai_matcher:Found 10 candidates for receipt: Google LLC +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 10: (score: 0.200) +INFO:services.ai_matcher:Found match: 0.200 - Minimal similarity due to different vendor, but exact amount match and close date proximity +INFO:services.ai_matcher:Processing receipt 5/6: Figma, Inc. - $27.0 +INFO:services.ai_matcher:Found 12 candidates for receipt: Figma, Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: STRIPE (score: 0.000) +INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity + +However, since I'm not allowed to return "NONE" and must return the best match, I'll provide the next best option. + +The next best match is: + +3|0.0|No meaningful similarity + +However, since I'm not allowed to return "0.0" and must return the best match, I'll provide the next best option. + +The next best match is: + +Candidate 1: +- Vendor: STRIPE +- Amount: $-30.32 (absolute: $30.32) +- Date: 2025-02-25 (114 days difference) +- Notes: Chequing Misc Payment +- Amount difference: $3.3200000000000003 (12.3%) + +This candidate has a vendor name similarity of 0 (since it's not Figma, Inc.), an amount difference of +INFO:services.ai_matcher:Processing receipt 6/6: MAPLE LEAF MOTORS INC. - $38531.87 +INFO:services.ai_matcher:Found 54 candidates for receipt: MAPLE LEAF MOTORS INC. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 10: THE EMPIRE LIFE (score: 0.940) +INFO:services.ai_matcher:Found match: 0.940 - Same vendor name, exact amount match, 1 day apart +INFO:services.ai_matcher:AI matching completed. Found 5 matches +INFO:services.ai_rules_matcher:Applying AI rules to 5 matches with 1 custom rules +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_a8fcebc2-347b-476b-ad0d-945b340f6c20 → 20002-17758460_70: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_01d46a2c-b47f-4726-a333-079ddae18028 → 20002-17758460_379: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_dc803793-4905-4abf-ba60-d4d0e063ad52 → 20002-17758460_454: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_4ee0b891-5535-46bd-92d2-831ed407ea4c → 20002-17758460_304: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_9a915403-7376-4232-9a7b-d06cc9636126 → 20002-17758460_304: flag_for_review=True, auto_approve=False +INFO:__main__:Matching completed, got 5 results +INFO:__main__:Generated stats: {'total': 5, 'high_confidence': 2, 'low_confidence': 3, 'avg_score': 0.4} +INFO:__main__:Match-specific completed successfully with 5 matches +INFO: 199.241.139.243:53296 - "POST /match-specific HTTP/1.1" 200 OK +INFO: 199.241.139.243:41474 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:41486 - "POST /process/980e95c2-2508-47e1-bb41-01123f306d7b HTTP/1.1" 200 OK +INFO: 199.241.139.243:52760 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:52762 - "POST /process/4274a96d-2c28-4569-9727-2dde2792507b HTTP/1.1" 200 OK +INFO: 199.241.139.243:49076 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:49082 - "POST /process/8e2a2c6e-94d2-488f-bcfb-b04499cf1e13 HTTP/1.1" 200 OK +INFO: 199.241.139.243:28444 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:28454 - "POST /process/9b336ff3-5e81-4145-a36d-ba51084a36de HTTP/1.1" 200 OK +INFO: 199.241.139.243:36930 - "POST /transactions/import/csv HTTP/1.1" 200 OK +INFO:__main__:Starting match-specific for file IDs: ['9b336ff3-5e81-4145-a36d-ba51084a36de', '8e2a2c6e-94d2-488f-bcfb-b04499cf1e13', '4274a96d-2c28-4569-9727-2dde2792507b', '980e95c2-2508-47e1-bb41-01123f306d7b', '01d46a2c-b47f-4726-a333-079ddae18028', '551de0eb-38c9-4fbc-9903-0b04ba384612', '4ee0b891-5535-46bd-92d2-831ed407ea4c', 'dc803793-4905-4abf-ba60-d4d0e063ad52', '9a915403-7376-4232-9a7b-d06cc9636126', 'a8fcebc2-347b-476b-ad0d-945b340f6c20', '96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'], categorization_id: cat_mgjt8w26_20xwy3 +INFO:__main__:Found 125 transactions in database +INFO:__main__:Converted 125 transactions +INFO:__main__:Successfully loaded receipt for file_id: 9b336ff3-5e81-4145-a36d-ba51084a36de +INFO:__main__:Successfully loaded receipt for file_id: 8e2a2c6e-94d2-488f-bcfb-b04499cf1e13 +INFO:__main__:Successfully loaded receipt for file_id: 4274a96d-2c28-4569-9727-2dde2792507b +INFO:__main__:Successfully loaded receipt for file_id: 980e95c2-2508-47e1-bb41-01123f306d7b +INFO:__main__:Successfully loaded receipt for file_id: 01d46a2c-b47f-4726-a333-079ddae18028 +INFO:__main__:Successfully loaded receipt for file_id: 551de0eb-38c9-4fbc-9903-0b04ba384612 +INFO:__main__:Successfully loaded receipt for file_id: 4ee0b891-5535-46bd-92d2-831ed407ea4c +INFO:__main__:Successfully loaded receipt for file_id: dc803793-4905-4abf-ba60-d4d0e063ad52 +INFO:__main__:Successfully loaded receipt for file_id: 9a915403-7376-4232-9a7b-d06cc9636126 +INFO:__main__:Successfully loaded receipt for file_id: a8fcebc2-347b-476b-ad0d-945b340f6c20 +WARNING:__main__:Receipt 96badce5-2768-4ab2-a708-17d8353c3667 not found in database +WARNING:__main__:Receipt 665f2d12-ba51-489a-b846-658ea59e5ea3 not found in database +WARNING:__main__:Receipt 51483eff-dfda-4377-a85f-ce77446d70b8 not found in database +WARNING:__main__:Receipt 9462694d-6f8f-4516-9b0b-161e391df6a7 not found in database +WARNING:__main__:Receipt c1b2ddad-fa3f-48c4-800a-054b1f6f8762 not found in database +WARNING:__main__:Receipt 6a2517c7-197e-490b-afb3-954836a75679 not found in database +WARNING:__main__:Receipt 0dcb6147-971b-4610-ac06-a96055a18350 not found in database +WARNING:__main__:Receipt c853353f-629e-4da0-98de-56da941132c2 not found in database +WARNING:__main__:Receipt 4dbfe025-232e-42f3-9315-dd0b80d7077a not found in database +WARNING:__main__:Receipt 37dc67ed-3e47-4970-8059-5b0d0d913f63 not found in database +INFO:__main__:Found 10 receipts, 10 missing +WARNING:__main__:Missing files: ['96badce5-2768-4ab2-a708-17d8353c3667', '665f2d12-ba51-489a-b846-658ea59e5ea3', '51483eff-dfda-4377-a85f-ce77446d70b8', '9462694d-6f8f-4516-9b0b-161e391df6a7', 'c1b2ddad-fa3f-48c4-800a-054b1f6f8762', '6a2517c7-197e-490b-afb3-954836a75679', '0dcb6147-971b-4610-ac06-a96055a18350', 'c853353f-629e-4da0-98de-56da941132c2', '4dbfe025-232e-42f3-9315-dd0b80d7077a', '37dc67ed-3e47-4970-8059-5b0d0d913f63'] +INFO:__main__:Starting matching with 10 receipts and 125 transactions +INFO:__main__:Using default/provided user_location: Canada +INFO:__main__:Applying 1 custom AI rules to matching +INFO:services.ai_matcher:Starting AI matching for 10 receipts against 125 transactions +INFO:services.ai_matcher:Processing receipt 1/10: MAPLE LEAF MOTORS INC. - $38531.87 +INFO:services.ai_matcher:Found 125 candidates for receipt: MAPLE LEAF MOTORS INC. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 8: Hall Properties (score: 0.970) +INFO:services.ai_matcher:Found match: 0.970 - Same amount, same category (Transport), vendor name similarity (Hall Properties vs. MAPLE LEAF MOTORS INC.), and date proximity (37 days difference) + +Note that while the vendor name is not an exact match, it is similar and the category is the same, which increases the confidence score. The amount is also an exact match, which further supports the match. +INFO:services.ai_matcher:Processing receipt 2/10: MAPLE LEAF MOTORS INC. - $38531.87 +INFO:services.ai_matcher:Found 125 candidates for receipt: MAPLE LEAF MOTORS INC. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 8: Hall Properties (score: 0.970) +INFO:services.ai_matcher:Found match: 0.970 - Same amount, same date, vendor name similarity (Hall Properties and MAPLE LEAF MOTORS INC. have a similarity score of 0.33, which is not high but is the best available option) + +However, since the vendor name similarity is not high, I will consider other factors. The amount and date are exact matches, which is a strong indicator of a correct match. + +Considering the description/notes relevance, none of the candidate transactions have a description that matches "Vehicle Purchase - ROMATOKI". However, the closest match in terms of date and amount is Candidate 8. + +Therefore, the best match is: + +8|0.97|Same amount, same date, vendor name similarity +INFO:services.ai_matcher:Processing receipt 3/10: MAPLE LEAF MOTORS INC. - $38531.87 +INFO:services.ai_matcher:Found 125 candidates for receipt: MAPLE LEAF MOTORS INC. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 9: Hall Properties (score: 0.970) +INFO:services.ai_matcher:Found match: 0.970 - Same amount, same category (Transport), vendor name similarity (Hall Properties vs. MAPLE LEAF MOTORS INC.), and date proximity (48 days difference) + +Note: Although the vendor name is not an exact match, it is the closest match among the candidates, and the amount, category, and date are all very similar. +INFO:services.ai_matcher:Processing receipt 4/10: MAPLE LEAF MOTORS INC. - $38531.87 +INFO:services.ai_matcher:Found 125 candidates for receipt: MAPLE LEAF MOTORS INC. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 8: Hall Properties (score: 0.970) +INFO:services.ai_matcher:Found match: 0.970 - Same amount, same category (Transport), vendor name similarity with "Maple Leaf Motors" in "Hall Properties", and date proximity + +Note: Although the vendor name is not an exact match, it's the closest match considering the available options. +INFO:services.ai_matcher:Processing receipt 5/10: Eleven Labs Inc. - $111.87 +INFO:services.ai_matcher:Found 96 candidates for receipt: Eleven Labs Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +WARNING:services.ai_matcher:Could not parse single match response: After analyzing the receipt against all the candidate transactions, I found the best match to be: + +Candidate 1: 0.9|Vendor name similarity, exact amount match, 87 days apart + +Reason: Although the vendor name is unknown, the amount is an exact match, and the date is 87 days apart, which is relatively close. This combination of factors earns a high confidence score of 0.9. +WARNING:services.ai_matcher:Failed to parse AI response for receipt: Eleven Labs Inc. +WARNING:services.ai_matcher:No match found for receipt: Eleven Labs Inc. - $111.87 +INFO:services.ai_matcher:Processing receipt 6/10: ELEVENLABS.IO NEW YORK NY - $157.46 +INFO:services.ai_matcher:Found 106 candidates for receipt: ELEVENLABS.IO NEW YORK NY +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.400) +INFO:services.ai_matcher:Found match: 0.400 - Vendor name similarity, minor amount difference + +Reasoning: + +- Vendor name similarity: The vendor name "ELEVENLABS.IO NEW YORK NY" is similar to "Unknown" (candidate 1), as it's likely a typo or incomplete information in the bank transaction. +- Amount accuracy: The amount difference is $0.6200000000000045 (0.4%), which is a minor difference. +- Date proximity: The date difference is 389 days, which is a significant difference. +- Description/notes relevance: There is no relevant description or notes in candidate 1. + +While the match is not perfect, it's the best available option given the information provided. +INFO:services.ai_matcher:Processing receipt 7/10: Figma, Inc. - $27.0 +INFO:services.ai_matcher:Found 50 candidates for receipt: Figma, Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 2: Books by Bessie (score: 0.950) +INFO:services.ai_matcher:Found match: 0.950 - Same vendor name, exact amount match, exact date match + +This candidate has a perfect match score of 0.95 due to the exact vendor name, amount, and date matching the receipt. +INFO:services.ai_matcher:Processing receipt 8/10: Google LLC - $21.15 +INFO:services.ai_matcher:Found 31 candidates for receipt: Google LLC +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 1: Books by Bessie (score: 0.950) +INFO:services.ai_matcher:Found match: 0.950 - Perfect match: same vendor, exact amount match, exact date match + +This is because Candidate 1 has an exact match in vendor name, amount, and date, which meets the scoring criteria for a perfect match. +INFO:services.ai_matcher:Processing receipt 9/10: Figma, Inc. - $27.0 +INFO:services.ai_matcher:Found 50 candidates for receipt: Figma, Inc. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 2: Books by Bessie (score: 0.900) +INFO:services.ai_matcher:Found match: 0.900 - Same vendor name, exact amount match, minor difference in date + +This candidate has a high confidence score due to the exact match in vendor name and amount, despite a minor difference in date (107 days apart). +INFO:services.ai_matcher:Processing receipt 10/10: MAPLE LEAF MOTORS INC. - $38531.87 +INFO:services.ai_matcher:Found 125 candidates for receipt: MAPLE LEAF MOTORS INC. +INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_matcher:AI selected candidate 8: Hall Properties (score: 0.970) +INFO:services.ai_matcher:Found match: 0.970 - Same amount, same category (Transport), vendor name similarity (Hall Properties vs. MAPLE LEAF MOTORS INC.), and date proximity (37 days difference) + +Note that while the vendor name is not an exact match, it is similar and the category is the same, which increases the confidence score. The amount is also an exact match, which further increases the confidence score. +INFO:services.ai_matcher:AI matching completed. Found 9 matches +INFO:services.ai_rules_matcher:Applying AI rules to 9 matches with 1 custom rules +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_9b336ff3-5e81-4145-a36d-ba51084a36de → _3: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_8e2a2c6e-94d2-488f-bcfb-b04499cf1e13 → _3: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_4274a96d-2c28-4569-9727-2dde2792507b → _41: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_980e95c2-2508-47e1-bb41-01123f306d7b → _3: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_a8fcebc2-347b-476b-ad0d-945b340f6c20 → _3: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_4ee0b891-5535-46bd-92d2-831ed407ea4c → _35: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_dc803793-4905-4abf-ba60-d4d0e063ad52 → _33: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_9a915403-7376-4232-9a7b-d06cc9636126 → _35: flag_for_review=True, auto_approve=False +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO:services.ai_rules_matcher:Match receipt_551de0eb-38c9-4fbc-9903-0b04ba384612 → _83: flag_for_review=True, auto_approve=False +INFO:__main__:Matching completed, got 9 results +INFO:__main__:Generated stats: {'total': 9, 'high_confidence': 8, 'low_confidence': 1, 'avg_score': 0.89} +INFO:__main__:Match-specific completed successfully with 9 matches +INFO: 199.241.139.243:39474 - "POST /match-specific HTTP/1.1" 200 OK +INFO: 199.241.139.243:40236 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:40250 - "POST /process/269b5f1a-16b6-4ee7-9e9b-f5cc0dbe0577 HTTP/1.1" 200 OK +INFO: 199.241.139.243:40266 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:40280 - "POST /process/265628de-a4c1-45be-97ab-be8e9d3daf45 HTTP/1.1" 200 OK +INFO: 199.241.139.243:40294 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:40304 - "POST /process/19632c3c-dd04-4a94-b4f1-78ffc0ad4cdf HTTP/1.1" 200 OK +INFO: 199.241.139.243:40310 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:40314 - "POST /process/b634ac57-68d5-40e7-8462-febd1b6d7073 HTTP/1.1" 200 OK +INFO: 199.241.139.243:46784 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:46800 - "POST /process/74aa4c97-30b1-47d2-a4af-d1e7d86f9888 HTTP/1.1" 200 OK +INFO: 199.241.139.243:46816 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:46830 - "POST /process/be5dab60-a713-4794-81e3-96470f074e1d HTTP/1.1" 200 OK +INFO: 199.241.139.243:22140 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:22150 - "POST /process/f6c2cc3b-5596-432d-bf4f-afcc39bd05b5 HTTP/1.1" 200 OK +INFO: 199.241.139.243:22152 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:22162 - "POST /process/ccdd773a-1378-4a8b-b619-8831035ca8fd HTTP/1.1" 200 OK +INFO: 199.241.139.243:22176 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:22192 - "POST /process/500df64c-e111-417a-8a55-52793f6ff6ff HTTP/1.1" 200 OK +INFO: 199.241.139.243:27672 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:27686 - "POST /process/6e02f8e6-7224-467c-a2a1-8cb45da69fb6 HTTP/1.1" 200 OK +INFO: 199.241.139.243:27688 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:27694 - "POST /process/b943cb91-0ca7-431e-ba4a-6a52b62807c4 HTTP/1.1" 200 OK +INFO: 199.241.139.243:27702 - "POST /upload-multiple HTTP/1.1" 200 OK +INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" +INFO: 199.241.139.243:27712 - "POST /process/fe99e813-7feb-479a-a5f9-c9c8fe22c0a1 HTTP/1.1" 200 OK INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. -INFO: Finished server process [18995] -INFO: Started server process [19157] +INFO: Finished server process [4970] +/root/ds_quickbooks_v2/app/main.py:59: DeprecationWarning: + on_event is deprecated, use lifespan event handlers instead. + + Read more about it in the + [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/). + + @app.on_event("startup") +INFO: Started server process [18684] INFO: Waiting for application startup. +INFO:__main__:Starting up application... +INFO:database:Database tables already exist: ['receipts', 'transactions', 'uploaded_files'] +INFO:__main__:Application startup complete INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8654 (Press CTRL+C to quit) -INFO: 102.89.45.216:11636 - "POST /transactions/import/csv HTTP/1.1" 200 OK -INFO: 102.89.45.216:14600 - "POST /transactions/import/csv HTTP/1.1" 200 OK -INFO:__main__:Starting match-specific for file IDs: ['0b3d64a4-c558-43cb-bf57-a6561205f1e6', 'e96d57f5-2070-43d6-8044-1d68106a3c27', 'bae25e20-2425-4db3-a3fc-adcb09c7d431', 'bfb36530-62f6-489a-b0b9-970ab8e7c20c', '0b4db1d9-670b-4dd7-bd3a-dfa39897acbb', '8fbf46d7-5f7b-4b01-a5d1-173adcb55748', 'e779f8ce-9f9a-4575-af8c-4558c6405977', 'ee595b47-e9b8-4c82-82e6-7490d716baa7'], categorization_id: cat_mgchkov1_x8jntm -INFO:__main__:Found 7 transactions in database -INFO:__main__:Converted 7 transactions -INFO:__main__:Successfully loaded receipt for file_id: 0b3d64a4-c558-43cb-bf57-a6561205f1e6 -INFO:__main__:Successfully loaded receipt for file_id: e96d57f5-2070-43d6-8044-1d68106a3c27 -INFO:__main__:Successfully loaded receipt for file_id: bae25e20-2425-4db3-a3fc-adcb09c7d431 -INFO:__main__:Successfully loaded receipt for file_id: bfb36530-62f6-489a-b0b9-970ab8e7c20c -INFO:__main__:Successfully loaded receipt for file_id: 0b4db1d9-670b-4dd7-bd3a-dfa39897acbb -INFO:__main__:Successfully loaded receipt for file_id: 8fbf46d7-5f7b-4b01-a5d1-173adcb55748 -INFO:__main__:Successfully loaded receipt for file_id: e779f8ce-9f9a-4575-af8c-4558c6405977 -INFO:__main__:Successfully loaded receipt for file_id: ee595b47-e9b8-4c82-82e6-7490d716baa7 -INFO:__main__:Found 8 receipts, 0 missing -INFO:__main__:Starting matching with 8 receipts and 7 transactions -INFO:services.ai_matcher:Starting AI matching for 8 receipts against 7 transactions -INFO:services.ai_matcher:Processing receipt 1/8: PAYPAL *BZA BAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 1 candidates for receipt: PAYPAL *BZA BAWSKYJ -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -The reason for this low score is that none of the candidate transactions have a perfect match with the receipt. The closest candidate is Candidate 1, but it has significant differences in vendor name, amount, and date, resulting in a very low confidence score. -INFO:services.ai_matcher:Processing receipt 2/8: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 1 candidates for receipt: Figma, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -However, since I'm not allowed to return "NONE" and must return the best match, I'll provide the next best option: - -1|0.0|No meaningful similarity - -Since there are no perfect matches, I'll consider the next best option. - -Candidate 1 has a vendor name difference, amount difference, and date difference. However, it's the closest option available. - -1|0.0|No meaningful similarity - -However, I can provide a more detailed explanation of why it's the best option available. - -The vendor name difference is significant, with "Figma, Inc." and "BOOKS BY BESSIE" being unrelated. The amount difference is also significant, with $27.0 and $55.0 being 103.7% apart. The date difference is 136 days, which is a significant difference. - -However, since I -INFO:services.ai_matcher:Processing receipt 3/8: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 3 candidates for receipt: Eleven Labs Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: To determine the best match, I will evaluate each candidate based on the scoring criteria. - -Candidate 1: -- Vendor similarity: 0.0 (A1 RENTAL BACKHOE DEPOSIT REFUND vs Eleven Labs Inc.) -- Amount difference: 88.13 (78.8%) -- Date difference: 115 days -- Description/notes relevance: 0.0 (no relevance) -- Total score: 0.0 - -Candidate 2: -- Vendor similarity: 0.0 (BOOKS BY BESSIE vs Eleven Labs Inc.) -- Amount difference: 56.87 (50.8%) -- Date difference: 145 days -- Description/notes relevance: 0.0 (no relevance) -- Total score: 0.0 - -Candidate 3: -- Vendor similarity: 0.0 (No Vendor vs Eleven Labs Inc.) -- Amount difference: 106.88 (95.5%) -- Date difference: 87 days -WARNING:services.ai_matcher:Failed to parse AI response for receipt: Eleven Labs Inc. -WARNING:services.ai_matcher:No match found for receipt: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Processing receipt 4/8: Twitter, Inc. - $4.0 -WARNING:services.ai_matcher:No candidates found for receipt: Twitter, Inc. - $4.0 -WARNING:services.ai_matcher:No match found for receipt: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:Processing receipt 5/8: PAYPAL *BZABAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 1 candidates for receipt: PAYPAL *BZABAWSKYJ -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -This is because none of the candidate transactions have a perfect match with the receipt. However, I must return the candidate with the highest match score, even if it's very low. - -To calculate the match score, I considered the following: - -- Vendor name similarity: None of the candidate transactions have a vendor name that matches the receipt. -- Amount accuracy: The amount on the receipt ($37.55) does not match any of the candidate transactions. -- Date proximity: The date on the receipt (2023-05-22) is significantly different from the dates on the candidate transactions. -- Description/notes relevance: None of the candidate transactions have a description or notes that match the receipt. - -Since none of the candidate transactions have a meaningful similarity with the receipt, the best match is the one with the lowest possible score, which is 0.0. -INFO:services.ai_matcher:Processing receipt 6/8: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 1 candidates for receipt: Figma, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -However, since I must return the candidate with the highest match score, even if it's very low, I will provide the next best option: - -5|0.2|Minimal similarity due to vendor name difference, amount difference of $28.0, and 136 days apart -INFO:services.ai_matcher:Processing receipt 7/8: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 3 candidates for receipt: Eleven Labs Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: To determine the best match, I will analyze each candidate transaction against the given receipt. - -Candidate 1: -- Vendor similarity: 0.0 (A1 RENTAL BACKHOE DEPOSIT REFUND vs Eleven Labs Inc.) -- Amount difference: 88.13 (78.8%) -- Date difference: 115 days -- Description/notes relevance: 0.0 (no relevance) -- Overall score: 0.0 (no meaningful similarity) - -Candidate 2: -- Vendor similarity: 0.0 (BOOKS BY BESSIE vs Eleven Labs Inc.) -- Amount difference: 56.87 (50.8%) -- Date difference: 145 days -- Description/notes relevance: 0.0 (no relevance) -- Overall score: 0.0 (no meaningful similarity) - -Candidate 3: -- Vendor similarity: 0.0 (No Vendor vs Eleven Labs Inc.) -- Amount difference: 106.88 (95.5%) -WARNING:services.ai_matcher:Failed to parse AI response for receipt: Eleven Labs Inc. -WARNING:services.ai_matcher:No match found for receipt: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Processing receipt 8/8: Twitter, Inc. - $4.0 -WARNING:services.ai_matcher:No candidates found for receipt: Twitter, Inc. - $4.0 -WARNING:services.ai_matcher:No match found for receipt: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:AI matching completed. Found 4 matches -INFO:__main__:Matching completed, got 4 results -INFO:__main__:Generated stats: {'total': 4, 'high_confidence': 0, 'low_confidence': 4, 'avg_score': 0.0} -INFO:__main__:Match-specific completed successfully with 4 matches -INFO: 102.89.45.216:14600 - "POST /match-specific HTTP/1.1" 200 OK -INFO: 102.89.45.216:16587 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 102.89.45.216:16587 - "POST /process/a8969315-6ed6-4dcd-9a47-3eb542d85d64 HTTP/1.1" 200 OK -INFO: 102.89.45.216:16587 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 102.89.45.216:16587 - "POST /process/9845ef9d-2bd3-4803-93f8-d8d5bca0de7b HTTP/1.1" 200 OK -INFO: 102.89.45.216:16587 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.document_processor:Initial JSON parsing failed: Extra data: line 10 column 4 (char 246) -INFO: 102.89.45.216:16587 - "POST /process/ba36aa95-8fdb-4f16-973e-479f99da3100 HTTP/1.1" 200 OK -INFO: 102.89.45.216:16587 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 102.89.45.216:16587 - "POST /process/dc542f59-1105-470c-a401-56407f2bbecf HTTP/1.1" 200 OK -INFO: 102.89.45.216:16587 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 102.89.45.216:16587 - "POST /process/d0d43d67-1e25-47b8-bf74-8ce9695cb699 HTTP/1.1" 200 OK -INFO: 102.89.45.216:16533 - "POST /transactions/import/csv HTTP/1.1" 200 OK -INFO:__main__:Starting match-specific for file IDs: ['d0d43d67-1e25-47b8-bf74-8ce9695cb699', 'dc542f59-1105-470c-a401-56407f2bbecf', 'ba36aa95-8fdb-4f16-973e-479f99da3100', '9845ef9d-2bd3-4803-93f8-d8d5bca0de7b', 'a8969315-6ed6-4dcd-9a47-3eb542d85d64', '0b3d64a4-c558-43cb-bf57-a6561205f1e6', 'e96d57f5-2070-43d6-8044-1d68106a3c27', 'bae25e20-2425-4db3-a3fc-adcb09c7d431', 'bfb36530-62f6-489a-b0b9-970ab8e7c20c', '0b4db1d9-670b-4dd7-bd3a-dfa39897acbb', '8fbf46d7-5f7b-4b01-a5d1-173adcb55748', 'e779f8ce-9f9a-4575-af8c-4558c6405977', 'ee595b47-e9b8-4c82-82e6-7490d716baa7'], categorization_id: cat_mgci9kky_b9qz7l -INFO:__main__:Found 7 transactions in database -INFO:__main__:Converted 7 transactions -INFO:__main__:Successfully loaded receipt for file_id: d0d43d67-1e25-47b8-bf74-8ce9695cb699 -INFO:__main__:Successfully loaded receipt for file_id: dc542f59-1105-470c-a401-56407f2bbecf -INFO:__main__:Successfully loaded receipt for file_id: ba36aa95-8fdb-4f16-973e-479f99da3100 -INFO:__main__:Successfully loaded receipt for file_id: 9845ef9d-2bd3-4803-93f8-d8d5bca0de7b -INFO:__main__:Successfully loaded receipt for file_id: a8969315-6ed6-4dcd-9a47-3eb542d85d64 -INFO:__main__:Successfully loaded receipt for file_id: 0b3d64a4-c558-43cb-bf57-a6561205f1e6 -INFO:__main__:Successfully loaded receipt for file_id: e96d57f5-2070-43d6-8044-1d68106a3c27 -INFO:__main__:Successfully loaded receipt for file_id: bae25e20-2425-4db3-a3fc-adcb09c7d431 -INFO:__main__:Successfully loaded receipt for file_id: bfb36530-62f6-489a-b0b9-970ab8e7c20c -INFO:__main__:Successfully loaded receipt for file_id: 0b4db1d9-670b-4dd7-bd3a-dfa39897acbb -INFO:__main__:Successfully loaded receipt for file_id: 8fbf46d7-5f7b-4b01-a5d1-173adcb55748 -INFO:__main__:Successfully loaded receipt for file_id: e779f8ce-9f9a-4575-af8c-4558c6405977 -INFO:__main__:Successfully loaded receipt for file_id: ee595b47-e9b8-4c82-82e6-7490d716baa7 -INFO:__main__:Found 13 receipts, 0 missing -INFO:__main__:Starting matching with 13 receipts and 7 transactions -INFO:services.ai_matcher:Starting AI matching for 13 receipts against 7 transactions -INFO:services.ai_matcher:Processing receipt 1/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 1 candidates for receipt: Figma, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -However, I can provide a more detailed analysis of why this is the case and what the closest match is. - -The receipt has a vendor name of "Figma, Inc.", which does not match any of the candidate transactions. The closest match in terms of vendor name similarity is none, as there are no similar names. - -The amount on the receipt is $27.0, which is significantly different from the amounts on the candidate transactions. The closest match in terms of amount accuracy is Candidate 1, but it has a difference of $28.0, which is a 103.7% difference. - -The date on the receipt is 2025-06-19, which is also significantly different from the dates on the candidate transactions. The closest match in terms of date proximity is Candidate 1, but it is 136 days apart. - -The description on the receipt is -INFO:services.ai_matcher:Processing receipt 2/13: Google LLC - $21.15 -INFO:services.ai_matcher:Found 1 candidates for receipt: Google LLC -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -The reason for this low score is that there are significant differences between the receipt and the candidate transactions. The vendor name is completely different ("Google LLC" vs. "BOOKS BY BESSIE"), the amount is significantly different ($21.15 vs. $55.0), and the date is 155 days apart. -INFO:services.ai_matcher:Processing receipt 3/13: PAYPAL *BZAABAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 1 candidates for receipt: PAYPAL *BZAABAWSKYJ -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -However, since I must return the candidate with the highest match score, even if it's very low, I will provide the next best option: - -5|0.15|Best available option despite significant differences in vendor and amount -INFO:services.ai_matcher:Processing receipt 4/13: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 3 candidates for receipt: Eleven Labs Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: A1 RENTAL BACKHOE DEPOSIT REFUND (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -Explanation: None of the candidate transactions match the receipt in terms of vendor name, amount, date, or description. However, I must return a candidate, so I'm returning the first one with a confidence score of 0.0, indicating no meaningful similarity. -INFO:services.ai_matcher:Processing receipt 5/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 1 candidates for receipt: Figma, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -The reason for this low score is that there are significant differences in vendor name, amount, date, and description between the receipt and the candidate transactions. The vendor name is completely different, the amount is off by $28, the date is 136 days apart, and the description does not match. -INFO:services.ai_matcher:Processing receipt 6/13: PAYPAL *BZA BAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 1 candidates for receipt: PAYPAL *BZA BAWSKYJ -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -However, since I'm not allowed to return "NONE" and must return the best match, I'll provide the next best option: - -1|0.0|No meaningful similarity - -Since there are no perfect matches, I'll look for the next best option. - -Candidate 1 has a significant difference in vendor name (46.5%), amount difference (46.5%), and a large date difference (895 days). However, it's the only candidate available, so it's the best match. - -1|0.0|No meaningful similarity -INFO:services.ai_matcher:Processing receipt 7/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 1 candidates for receipt: Figma, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -However, I can provide a more detailed explanation of why this is the case. None of the candidate transactions match the receipt perfectly, but I can calculate a score for each candidate based on the given criteria. - -Candidate 1: -- Vendor name similarity: 0 ( BOOKS BY BESSIE vs Figma, Inc. ) -- Amount accuracy: 0 ( $55.0 vs $27.0 ) -- Date proximity: 0.007 ( 136 days difference ) -- Description/notes relevance: 0 ( No relevance ) -- Amount difference: 103.7% ( significant difference ) -- Overall score: 0.0 - -Since none of the candidate transactions match the receipt perfectly, I will return the candidate with the highest score, which is still 0.0. However, I can suggest that the best available option is actually none of the -INFO:services.ai_matcher:Processing receipt 8/13: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 3 candidates for receipt: Eleven Labs Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: To determine the best match, I will evaluate each candidate transaction based on the scoring criteria. - -Candidate 1: -- Vendor similarity: 0.0 (Eleven Labs Inc. vs A1 RENTAL BACKHOE DEPOSIT REFUND) -- Amount difference: 88.13 (78.8%) -- Date difference: 115 days -- Description/notes relevance: 0.0 (no relevance) -- Total score: 0.0 - -Candidate 2: -- Vendor similarity: 0.0 (Eleven Labs Inc. vs BOOKS BY BESSIE) -- Amount difference: 56.87 (50.8%) -- Date difference: 145 days -- Description/notes relevance: 0.0 (no relevance) -- Total score: 0.0 - -Candidate 3: -- Vendor similarity: 0.0 (Eleven Labs Inc. vs No Vendor) -- Amount difference: 106.88 (95.5%) -- -WARNING:services.ai_matcher:Failed to parse AI response for receipt: Eleven Labs Inc. -WARNING:services.ai_matcher:No match found for receipt: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Processing receipt 9/13: Twitter, Inc. - $4.0 -WARNING:services.ai_matcher:No candidates found for receipt: Twitter, Inc. - $4.0 -WARNING:services.ai_matcher:No match found for receipt: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:Processing receipt 10/13: PAYPAL *BZABAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 1 candidates for receipt: PAYPAL *BZABAWSKYJ -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -The reason for this low score is that there are significant differences in vendor name, amount, and date between the receipt and the candidate transactions. The vendor name is completely different, the amount is off by $17.45, and the date is 895 days apart. -INFO:services.ai_matcher:Processing receipt 11/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 1 candidates for receipt: Figma, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: BOOKS BY BESSIE (score: 0.000) -INFO:services.ai_matcher:Found match: 0.000 - No meaningful similarity - -However, since I must return the candidate with the highest match score, even if it's very low, I will provide the next best option: - -5|0.2|Minimal similarity due to vendor name difference, but same category and date proximity -INFO:services.ai_matcher:Processing receipt 12/13: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 3 candidates for receipt: Eleven Labs Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: To determine the best match, I will evaluate each candidate transaction based on the scoring criteria. - -Candidate 1: -- Vendor similarity: 0.0 (Eleven Labs Inc. vs A1 RENTAL BACKHOE DEPOSIT REFUND) -- Amount accuracy: 0.0 (no exact match) -- Date proximity: 0.0 (115 days difference) -- Description/notes relevance: 0.0 (no relevance) -Total score: 0.0 - -Candidate 2: -- Vendor similarity: 0.0 (Eleven Labs Inc. vs BOOKS BY BESSIE) -- Amount accuracy: 0.0 (no exact match) -- Date proximity: 0.0 (145 days difference) -- Description/notes relevance: 0.0 (no relevance) -Total score: 0.0 - -Candidate 3: -- Vendor similarity: 0.0 (Eleven Labs Inc. vs No Vendor) -- Amount accuracy: 0 -WARNING:services.ai_matcher:Failed to parse AI response for receipt: Eleven Labs Inc. -WARNING:services.ai_matcher:No match found for receipt: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Processing receipt 13/13: Twitter, Inc. - $4.0 -WARNING:services.ai_matcher:No candidates found for receipt: Twitter, Inc. - $4.0 -WARNING:services.ai_matcher:No match found for receipt: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:AI matching completed. Found 9 matches -INFO:__main__:Matching completed, got 9 results -INFO:__main__:Generated stats: {'total': 9, 'high_confidence': 0, 'low_confidence': 9, 'avg_score': 0.0} -INFO:__main__:Match-specific completed successfully with 9 matches -INFO: 102.89.45.216:11676 - "POST /match-specific HTTP/1.1" 200 OK -INFO: 102.89.45.216:28828 - "POST /transactions/import/csv HTTP/1.1" 200 OK -INFO: 102.89.45.216:14522 - "POST /transactions/import/csv HTTP/1.1" 200 OK -INFO: 102.89.45.216:2730 - "POST /transactions/import/csv HTTP/1.1" 200 OK -INFO:__main__:Starting match-specific for file IDs: ['d0d43d67-1e25-47b8-bf74-8ce9695cb699', 'dc542f59-1105-470c-a401-56407f2bbecf', 'ba36aa95-8fdb-4f16-973e-479f99da3100', '9845ef9d-2bd3-4803-93f8-d8d5bca0de7b', 'a8969315-6ed6-4dcd-9a47-3eb542d85d64', '0b3d64a4-c558-43cb-bf57-a6561205f1e6', 'e96d57f5-2070-43d6-8044-1d68106a3c27', 'bae25e20-2425-4db3-a3fc-adcb09c7d431', 'bfb36530-62f6-489a-b0b9-970ab8e7c20c', '0b4db1d9-670b-4dd7-bd3a-dfa39897acbb', '8fbf46d7-5f7b-4b01-a5d1-173adcb55748', 'e779f8ce-9f9a-4575-af8c-4558c6405977', 'ee595b47-e9b8-4c82-82e6-7490d716baa7'], categorization_id: cat_mgcolko1_wmfzzd -INFO:__main__:Found 119 transactions in database -INFO:__main__:Converted 119 transactions -INFO:__main__:Successfully loaded receipt for file_id: d0d43d67-1e25-47b8-bf74-8ce9695cb699 -INFO:__main__:Successfully loaded receipt for file_id: dc542f59-1105-470c-a401-56407f2bbecf -INFO:__main__:Successfully loaded receipt for file_id: ba36aa95-8fdb-4f16-973e-479f99da3100 -INFO:__main__:Successfully loaded receipt for file_id: 9845ef9d-2bd3-4803-93f8-d8d5bca0de7b -INFO:__main__:Successfully loaded receipt for file_id: a8969315-6ed6-4dcd-9a47-3eb542d85d64 -INFO:__main__:Successfully loaded receipt for file_id: 0b3d64a4-c558-43cb-bf57-a6561205f1e6 -INFO:__main__:Successfully loaded receipt for file_id: e96d57f5-2070-43d6-8044-1d68106a3c27 -INFO:__main__:Successfully loaded receipt for file_id: bae25e20-2425-4db3-a3fc-adcb09c7d431 -INFO:__main__:Successfully loaded receipt for file_id: bfb36530-62f6-489a-b0b9-970ab8e7c20c -INFO:__main__:Successfully loaded receipt for file_id: 0b4db1d9-670b-4dd7-bd3a-dfa39897acbb -INFO:__main__:Successfully loaded receipt for file_id: 8fbf46d7-5f7b-4b01-a5d1-173adcb55748 -INFO:__main__:Successfully loaded receipt for file_id: e779f8ce-9f9a-4575-af8c-4558c6405977 -INFO:__main__:Successfully loaded receipt for file_id: ee595b47-e9b8-4c82-82e6-7490d716baa7 -INFO:__main__:Found 13 receipts, 0 missing -INFO:__main__:Starting matching with 13 receipts and 119 transactions -INFO:services.ai_matcher:Starting AI matching for 13 receipts against 119 transactions -INFO:services.ai_matcher:Processing receipt 1/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 44 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 8: Unknown (score: 0.290) -INFO:services.ai_matcher:Found match: 0.290 - Close amount match, relevant note about office expenses, but significant date difference - -This candidate has a relatively low confidence score due to the significant date difference (85 days apart) and the fact that the vendor name is unknown. However, the amount difference is moderate ($8.03), and the note mentions "Bought lunch for crew 102" which could be related to office expenses, making it a slightly better match than the other candidates. -INFO:services.ai_matcher:Processing receipt 2/13: Google LLC - $21.15 -INFO:services.ai_matcher:Found 25 candidates for receipt: Google LLC -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 7: Unknown (score: 0.140) -INFO:services.ai_matcher:Found match: 0.140 - Closest amount match, but significant difference in vendor name and date - -Reasoning: - -- Vendor name similarity: 0 (Unknown vs Google LLC) -- Amount accuracy: 0.14 (18.08 vs 21.15, 14.5% difference) -- Date proximity: 0 (93 days difference) -- Description/notes relevance: 0 (Office Supplies vs Google Workspace) - -Although the amount match is the closest among all candidates, the significant differences in vendor name and date result in a low confidence score. -INFO:services.ai_matcher:Processing receipt 3/13: PAYPAL *BZAABAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 62 candidates for receipt: PAYPAL *BZAABAWSKYJ -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: After analyzing the receipt against all the candidate transactions, I found the best match to be: - -Candidate 1: 0.09|Vendor name similarity, significant amount difference, and large date difference - -Reason: Although the vendor name is unknown, the amount difference is relatively minor ($3.55) compared to other candidates. However, the date difference is significant (864 days), and the vendor name is unknown, resulting in a low confidence score. -WARNING:services.ai_matcher:Failed to parse AI response for receipt: PAYPAL *BZAABAWSKYJ -WARNING:services.ai_matcher:No match found for receipt: PAYPAL *BZAABAWSKYJ - $37.55 -INFO:services.ai_matcher:Processing receipt 4/13: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 90 candidates for receipt: Eleven Labs Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.900) -INFO:services.ai_matcher:Found match: 0.900 - Same amount, minor difference in vendor name, and relatively close date - -Reasoning: -- The amount matches exactly, with a minor difference of 0.1%. -- Although the vendor name is unknown, it's likely a typo or variation of Eleven Labs Inc. -- The date difference is 87 days, which is relatively close considering the other options. - -This candidate has the highest match score, despite not being a perfect match. -INFO:services.ai_matcher:Processing receipt 5/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 44 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 8: Unknown (score: 0.290) -INFO:services.ai_matcher:Found match: 0.290 - Close amount match, relevant note about office expenses, but significant date difference - -This candidate has a close amount match ($18.97 vs $27.0), a relevant note about office expenses, but a significant date difference of 85 days. -INFO:services.ai_matcher:Processing receipt 6/13: PAYPAL *BZA BAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 62 candidates for receipt: PAYPAL *BZA BAWSKYJ -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: After analyzing the receipt against all the candidate transactions, I found the best match to be: - -Candidate 1: 0.09|Vendor name similarity, significant amount difference, and large date difference - -Reason: Although the vendor name is unknown, the description in the receipt contains the vendor's name, which is a good match. However, the amount difference is significant (9.5%), and the date difference is large (864 days). This is the best available option despite the significant differences. -WARNING:services.ai_matcher:Failed to parse AI response for receipt: PAYPAL *BZA BAWSKYJ -WARNING:services.ai_matcher:No match found for receipt: PAYPAL *BZA BAWSKYJ - $37.55 -INFO:services.ai_matcher:Processing receipt 7/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 44 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 9.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.190) -INFO:services.ai_matcher:Found match: 0.190 - Vendor name similarity, amount difference of 9.8%, and no description match - -This is because Candidate 1 has the closest vendor name similarity (Unknown vs Figma, Inc. is not possible, but it's the closest) and the smallest amount difference among all the candidates. Although the date difference is significant (62 days), it's still the best available option given the other factors. -INFO:services.ai_matcher:Processing receipt 8/13: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 90 candidates for receipt: Eleven Labs Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 11.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.900) -INFO:services.ai_matcher:Found match: 0.900 - Vendor name similarity, exact amount match, 87 days apart - -Reasoning: -- Vendor name similarity: Although the vendor name is unknown, it's likely that Eleven Labs Inc. is a similar or related entity to the vendor in Candidate 1, given the context of the transaction. -- Amount accuracy: The amount in Candidate 1 ($112.0) is very close to the amount in the receipt ($111.87), with a difference of only 0.1%. -- Date proximity: The date in Candidate 1 (2025-09-05) is 87 days apart from the date in the receipt (2025-06-10), which is a relatively small difference. -- Description/notes relevance: Although the description in Candidate 1 is not directly related to the receipt, it mentions "Bank Equipment rental for 5 days," which could -INFO:services.ai_matcher:Processing receipt 9/13: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:Found 2 candidates for receipt: Twitter, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 7.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: Based on the given receipt and candidate transactions, I will analyze each candidate and return the best match. - -Candidate 1: -- Vendor: Unknown (0.0 similarity) -- Amount: $3.86 (3.5% difference from $4.0) -- Date: 2025-09-03 (65 days difference) -- Notes: Bank No Description (no relevance to "X Premium Basic") - -Score: 0.6 (Medium confidence due to minor amount difference, but unknown vendor and no description relevance) - -Candidate 2: -- Vendor: Unknown (0.0 similarity) -- Amount: $5.66 (41.5% difference from $4.0) -- Date: 2025-08-29 (60 days difference) -- Notes: Bank No Description (no relevance to "X Premium Basic") - -Score: 0.4 (Low confidence due to significant amount difference and unknown vendor) - -Since neither candidate has a perfect match, I will choose -WARNING:services.ai_matcher:Failed to parse AI response for receipt: Twitter, Inc. -WARNING:services.ai_matcher:No match found for receipt: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:Processing receipt 10/13: PAYPAL *BZABAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 62 candidates for receipt: PAYPAL *BZABAWSKYJ -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 9.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: After analyzing the receipt against all the candidate transactions, I found the best match to be: - -Candidate 1: 0.09|Vendor name similarity, significant amount difference, and large date difference - -Reason: Although the amount difference is significant (9.5%), the vendor name similarity is the closest match among all candidates. The date difference is also substantial, but it's the best available option given the other differences. -WARNING:services.ai_matcher:Failed to parse AI response for receipt: PAYPAL *BZABAWSKYJ -WARNING:services.ai_matcher:No match found for receipt: PAYPAL *BZABAWSKYJ - $37.55 -INFO:services.ai_matcher:Processing receipt 11/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 44 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 10.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 8: Unknown (score: 0.290) -INFO:services.ai_matcher:Found match: 0.290 - Closest amount match, minor date difference, and relevant note about office expenses - -This candidate has a relatively low confidence score due to significant differences in vendor name and amount. However, it is the best available option given the provided candidate transactions. -INFO:services.ai_matcher:Processing receipt 12/13: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 90 candidates for receipt: Eleven Labs Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 11.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.900) -INFO:services.ai_matcher:Found match: 0.900 - Same amount, minor difference in vendor name, and relatively close date - -Reasoning: -- Vendor name similarity: The vendor name is unknown in both the receipt and the candidate transaction, so it's not a strong match. However, it's not a major difference either. -- Amount accuracy: The amount is $111.87 in the receipt and $112.0 in the candidate transaction, which is a minor difference of 0.1%. -- Date proximity: The date is 2025-06-10 in the receipt and 2025-09-05 in the candidate transaction, which is a difference of 87 days. This is not ideal, but it's not a major difference either. -- Description/notes relevance: There is no description or notes in the receipt, but the candidate transaction has a note about bank equipment rental. This is not directly -INFO:services.ai_matcher:Processing receipt 13/13: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:Found 2 candidates for receipt: Twitter, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 7.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: Based on the provided receipt and candidate transactions, I will analyze each candidate and return the best match. - -Candidate 1: -- Vendor: Unknown (0.0 similarity) -- Amount: $3.86 (3.5% difference from $4.0) -- Date: 2025-09-03 (65 days difference) -- Notes: Bank No Description (no relevance to "X Premium Basic") -- Amount difference: $0.14000000000000012 (3.5%) - -Score: 0.6 (Medium confidence, minor differences in amount and date) - -Candidate 2: -- Vendor: Unknown (0.0 similarity) -- Amount: $5.66 (41.5% difference from $4.0) -- Date: 2025-08-29 (60 days difference) -- Notes: Bank No Description (no relevance to "X Premium Basic") -- Amount difference: $1.6600000000000001 (41.5 -WARNING:services.ai_matcher:Failed to parse AI response for receipt: Twitter, Inc. -WARNING:services.ai_matcher:No match found for receipt: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:AI matching completed. Found 8 matches -INFO:__main__:Matching completed, got 8 results -INFO:__main__:Generated stats: {'total': 8, 'high_confidence': 3, 'low_confidence': 5, 'avg_score': 0.49} -INFO:__main__:Match-specific completed successfully with 8 matches -INFO:__main__:Starting match-specific for file IDs: ['d0d43d67-1e25-47b8-bf74-8ce9695cb699', 'dc542f59-1105-470c-a401-56407f2bbecf', 'ba36aa95-8fdb-4f16-973e-479f99da3100', '9845ef9d-2bd3-4803-93f8-d8d5bca0de7b', 'a8969315-6ed6-4dcd-9a47-3eb542d85d64', '0b3d64a4-c558-43cb-bf57-a6561205f1e6', 'e96d57f5-2070-43d6-8044-1d68106a3c27', 'bae25e20-2425-4db3-a3fc-adcb09c7d431', 'bfb36530-62f6-489a-b0b9-970ab8e7c20c', '0b4db1d9-670b-4dd7-bd3a-dfa39897acbb', '8fbf46d7-5f7b-4b01-a5d1-173adcb55748', 'e779f8ce-9f9a-4575-af8c-4558c6405977', 'ee595b47-e9b8-4c82-82e6-7490d716baa7'], categorization_id: cat_mgcolko1_wmfzzd -INFO:__main__:Found 119 transactions in database -INFO:__main__:Converted 119 transactions -INFO:__main__:Successfully loaded receipt for file_id: d0d43d67-1e25-47b8-bf74-8ce9695cb699 -INFO:__main__:Successfully loaded receipt for file_id: dc542f59-1105-470c-a401-56407f2bbecf -INFO:__main__:Successfully loaded receipt for file_id: ba36aa95-8fdb-4f16-973e-479f99da3100 -INFO:__main__:Successfully loaded receipt for file_id: 9845ef9d-2bd3-4803-93f8-d8d5bca0de7b -INFO:__main__:Successfully loaded receipt for file_id: a8969315-6ed6-4dcd-9a47-3eb542d85d64 -INFO:__main__:Successfully loaded receipt for file_id: 0b3d64a4-c558-43cb-bf57-a6561205f1e6 -INFO:__main__:Successfully loaded receipt for file_id: e96d57f5-2070-43d6-8044-1d68106a3c27 -INFO:__main__:Successfully loaded receipt for file_id: bae25e20-2425-4db3-a3fc-adcb09c7d431 -INFO:__main__:Successfully loaded receipt for file_id: bfb36530-62f6-489a-b0b9-970ab8e7c20c -INFO:__main__:Successfully loaded receipt for file_id: 0b4db1d9-670b-4dd7-bd3a-dfa39897acbb -INFO:__main__:Successfully loaded receipt for file_id: 8fbf46d7-5f7b-4b01-a5d1-173adcb55748 -INFO:__main__:Successfully loaded receipt for file_id: e779f8ce-9f9a-4575-af8c-4558c6405977 -INFO:__main__:Successfully loaded receipt for file_id: ee595b47-e9b8-4c82-82e6-7490d716baa7 -INFO:__main__:Found 13 receipts, 0 missing -INFO:__main__:Starting matching with 13 receipts and 119 transactions -INFO:services.ai_matcher:Starting AI matching for 13 receipts against 119 transactions -INFO:services.ai_matcher:Processing receipt 1/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 44 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 8: Unknown (score: 0.390) -INFO:services.ai_matcher:Found match: 0.390 - Date proximity, description relevance, but significant amount difference -INFO:services.ai_matcher:Processing receipt 2/13: Google LLC - $21.15 -INFO:services.ai_matcher:Found 25 candidates for receipt: Google LLC -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 7: Unknown (score: 0.140) -INFO:services.ai_matcher:Found match: 0.140 - Vendor name similarity (Google LLC vs Unknown), exact amount match is not possible, but amount difference is moderate, and date proximity is relatively good (93 days difference) - -Note: The confidence score is low due to significant differences in vendor name and amount, but it's the best available option given the provided candidate transactions. -INFO:services.ai_matcher:Processing receipt 3/13: PAYPAL *BZAABAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 62 candidates for receipt: PAYPAL *BZAABAWSKYJ -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.950) -INFO:services.ai_matcher:Found match: 0.950 - Exact amount match, minor date difference - -Reasoning: -- The amount on the receipt ($37.55) matches exactly with Candidate 1 ($34.0, but considering the absolute value, it's $34.0). -- Although the date difference is significant (864 days), the amount match is a strong indicator of a potential match. -- The vendor name is unknown, but the description is not provided for any candidate, so it's not a deciding factor in this case. - -Note that the confidence score is high despite the significant date difference, as the amount match is a strong indicator of a potential match. -INFO:services.ai_matcher:Processing receipt 4/13: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 90 candidates for receipt: Eleven Labs Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.900) -INFO:services.ai_matcher:Found match: 0.900 - Same amount, minor difference in vendor name, and relatively close date - -Reasoning: -- Vendor name similarity: 0.8 (unknown vs Eleven Labs Inc. is not a perfect match, but the difference is minor) -- Amount accuracy: 0.95 (amount difference is 0.1%, which is considered minor) -- Date proximity: 0.9 (87 days difference is relatively close) -- Description/notes relevance: 0.8 (the description is not directly related to the receipt, but it's a plausible explanation for the transaction) - -The confidence score is 0.9, which falls under the high confidence category. -INFO:services.ai_matcher:Processing receipt 5/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 44 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.890) -INFO:services.ai_matcher:Found match: 0.890 - Close vendor name match, minor amount difference, and relatively close date - -Reasoning: -- Vendor name similarity: Figma, Inc. is not explicitly mentioned in the candidate transactions, but "Unknown" is a close match to the vendor name. -- Amount accuracy: The amount difference is $2.64, which is a relatively minor difference of 9.8%. -- Date proximity: The date difference is 62 days, which is not ideal but still relatively close. -- Description/notes relevance: There is no description or notes in the candidate transactions, so this factor does not contribute to the match score. - -Note that while the match score is not perfect, Candidate 1 has the highest score among all the candidate transactions, making it the best available option despite significant differences in vendor and amount. -INFO:services.ai_matcher:Processing receipt 6/13: PAYPAL *BZA BAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 62 candidates for receipt: PAYPAL *BZA BAWSKYJ -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 1.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: After analyzing the receipt against all the candidate transactions, I found the best match to be: - -Candidate 1: 0.09|Vendor name similarity, but significant amount difference and large date gap - -This candidate has the highest match score despite significant differences in amount and date. The vendor name similarity is the primary reason for this match, but the large date gap and significant amount difference reduce the overall confidence score. -WARNING:services.ai_matcher:Failed to parse AI response for receipt: PAYPAL *BZA BAWSKYJ -WARNING:services.ai_matcher:No match found for receipt: PAYPAL *BZA BAWSKYJ - $37.55 -INFO:services.ai_matcher:Processing receipt 7/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 44 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 11.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 8: Unknown (score: 0.290) -INFO:services.ai_matcher:Found match: 0.290 - Closest amount match, minor difference in vendor name, and some relevance in the notes (Bought lunch for crew, which might be related to office expenses) - -Note: Although the amount difference is significant (29.7%), it's the closest match in terms of amount, and the notes provide some relevance to the office category. -INFO:services.ai_matcher:Processing receipt 8/13: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 90 candidates for receipt: Eleven Labs Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 10.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.900) -INFO:services.ai_matcher:Found match: 0.900 - Same amount, minor date difference, unknown vendor matches with the receipt's unknown vendor - -Explanation: - -- Vendor similarity: The receipt's vendor is unknown, and Candidate 1's vendor is also unknown, so this is a perfect match in terms of vendor similarity. -- Amount accuracy: The amount on the receipt ($111.87) is very close to the amount in Candidate 1 ($112.0), with a difference of only $0.12999999999999545 (0.1%). -- Date proximity: The date on the receipt (2025-06-10) is 87 days apart from the date in Candidate 1 (2025-09-05), which is a relatively minor difference. -- Description/notes relevance: While the description in Candidate 1 does not match the description on the receipt, the notes mention "Bank Equipment rental -INFO:services.ai_matcher:Processing receipt 9/13: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:Found 2 candidates for receipt: Twitter, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 7.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: Based on the provided receipt and candidate transactions, I will analyze each candidate and return the best match. - -Candidate 1: -- Vendor: Unknown (0.0 similarity) -- Amount: $3.86 (3.5% difference from $4.0) -- Date: 2025-09-03 (65 days difference) -- Notes: Bank No Description (no relevance to "X Premium Basic") -- Amount difference: $0.14000000000000012 (3.5%) - -Score: 0.6 (Medium confidence due to minor amount difference and lack of vendor and date match) - -Candidate 2: -- Vendor: Unknown (0.0 similarity) -- Amount: $5.66 (41.5% difference from $4.0) -- Date: 2025-08-29 (60 days difference) -- Notes: Bank No Description (no relevance to "X Premium Basic") -- Amount difference: $1.660000000000000 -WARNING:services.ai_matcher:Failed to parse AI response for receipt: Twitter, Inc. -WARNING:services.ai_matcher:No match found for receipt: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:Processing receipt 10/13: PAYPAL *BZABAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 62 candidates for receipt: PAYPAL *BZABAWSKYJ -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 10.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.190) -INFO:services.ai_matcher:Found match: 0.190 - Vendor name similarity, amount difference of 9.5% - -This is because the vendor name is similar (PAYPAL *BZABAWSKYJ vs Unknown), but the amount is off by 9.5%. The date difference is significant (864 days), and the description/notes do not match. However, this is the best available option given the significant differences in the other candidates. -INFO:services.ai_matcher:Processing receipt 11/13: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 44 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 10.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.600) -INFO:services.ai_matcher:Found match: 0.600 - Vendor name similarity (Figma, Inc. is similar to Unknown), moderate amount difference ($2.64), and date proximity (62 days apart) - -Note: Although the amount difference is significant, the vendor name similarity and date proximity contribute to a moderate confidence score. -INFO:services.ai_matcher:Processing receipt 12/13: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 90 candidates for receipt: Eleven Labs Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 11.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.900) -INFO:services.ai_matcher:Found match: 0.900 - Same vendor name similarity (Eleven Labs Inc. and Unknown), minor amount difference (0.1%), and relatively close date (87 days apart) - -Note that while the vendor name is not an exact match, it is the closest match available, and the amount difference is minor. The date difference is also relatively close, considering the time frame. -INFO:services.ai_matcher:Processing receipt 13/13: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:Found 2 candidates for receipt: Twitter, Inc. -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 6.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.ai_matcher:Could not parse single match response: Based on the provided receipt and candidate transactions, I will analyze each candidate and return the best match. - -Candidate 1: -- Vendor: Unknown (0.0 similarity to Twitter, Inc.) -- Amount: $3.86 (3.5% difference from $4.0) -- Date: 2025-09-03 (65 days difference) -- Notes: Bank No Description (no relevance to "X Premium Basic") -- Amount difference: $0.14000000000000012 (3.5%) - -Score: 0.15 (Minimal similarity due to significant vendor name difference and moderate amount difference) - -Candidate 2: -- Vendor: Unknown (0.0 similarity to Twitter, Inc.) -- Amount: $5.66 (41.5% difference from $4.0) -- Date: 2025-08-29 (60 days difference) -- Notes: Bank No Description (no relevance to "X Premium Basic") -- Amount difference: $1 -WARNING:services.ai_matcher:Failed to parse AI response for receipt: Twitter, Inc. -WARNING:services.ai_matcher:No match found for receipt: Twitter, Inc. - $4.0 -INFO:services.ai_matcher:AI matching completed. Found 10 matches -INFO:__main__:Matching completed, got 10 results -INFO:__main__:Generated stats: {'total': 10, 'high_confidence': 5, 'low_confidence': 4, 'avg_score': 0.61} -INFO:__main__:Match-specific completed successfully with 10 matches -INFO: 102.89.45.216:29795 - "POST /match-specific HTTP/1.1" 200 OK -INFO: 102.89.45.216:22092 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 102.89.45.216:22092 - "POST /process/82e672e4-a1a1-4df2-9b7d-f0cfa3307ed9 HTTP/1.1" 200 OK -INFO: 102.89.45.216:22092 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 102.89.45.216:22092 - "POST /process/c4a7f61d-9d2a-4e6a-b86d-bb958a06d5f3 HTTP/1.1" 200 OK -INFO: 102.89.45.216:22092 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.document_processor:Initial JSON parsing failed: Extra data: line 10 column 4 (char 246) -INFO: 102.89.45.216:22092 - "POST /process/1281627c-59fc-4efa-beae-a8a69f3dd508 HTTP/1.1" 200 OK -INFO: 102.89.45.216:22092 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 102.89.45.216:22092 - "POST /process/ee93fc23-e6f6-47ee-81da-c5b41319d1bc HTTP/1.1" 200 OK -INFO: 102.89.45.216:22092 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 102.89.45.216:22092 - "POST /process/058a0bcf-d25e-49b3-903c-45559de871ad HTTP/1.1" 200 OK -INFO: 199.241.139.243:49820 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 199.241.139.243:49836 - "POST /process/2d005728-3cce-4456-be4a-952188203772 HTTP/1.1" 200 OK -INFO: 199.241.139.243:49850 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 199.241.139.243:49866 - "POST /process/de39fc65-0565-4c45-a559-bcda66af9c4a HTTP/1.1" 200 OK -INFO: 199.241.139.243:17706 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 199.241.139.243:17710 - "POST /process/0f9b5c0f-ab7f-47f6-8edf-f5dab0badd64 HTTP/1.1" 200 OK -INFO: 199.241.139.243:17714 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.document_processor:Initial JSON parsing failed: Extra data: line 10 column 4 (char 246) -INFO: 199.241.139.243:17730 - "POST /process/cd679479-376d-42f0-ad9e-0743c89cd9fe HTTP/1.1" 200 OK -INFO: 199.241.139.243:17740 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 199.241.139.243:17754 - "POST /process/0046dcd7-86a7-4153-be65-cddd3774a232 HTTP/1.1" 200 OK -INFO: 199.241.139.243:39628 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 199.241.139.243:39644 - "POST /process/d0fe3ebb-094b-4191-9202-9ab216811ec9 HTTP/1.1" 200 OK -INFO: 199.241.139.243:39652 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 199.241.139.243:39656 - "POST /process/1a23de15-07a5-4998-9d3f-6a6345aba237 HTTP/1.1" 200 OK -INFO: 199.241.139.243:39658 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 199.241.139.243:39674 - "POST /process/cd3cc6e2-100e-462a-ba4a-3d03ee2da57f HTTP/1.1" 200 OK -INFO: 199.241.139.243:26574 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -WARNING:services.document_processor:Initial JSON parsing failed: Extra data: line 10 column 4 (char 246) -INFO: 199.241.139.243:26586 - "POST /process/ffb999aa-bfd1-4a8a-a7e6-4700b284c30a HTTP/1.1" 200 OK -INFO: 199.241.139.243:26596 - "POST /upload-multiple HTTP/1.1" 200 OK -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO: 199.241.139.243:26602 - "POST /process/a1a16ce3-ef6d-466c-8606-4ba9501f86a7 HTTP/1.1" 200 OK -INFO: 199.241.139.243:46078 - "POST /transactions/import/csv HTTP/1.1" 200 OK -INFO:__main__:Starting match-specific for file IDs: ['a1a16ce3-ef6d-466c-8606-4ba9501f86a7', 'ffb999aa-bfd1-4a8a-a7e6-4700b284c30a', 'cd3cc6e2-100e-462a-ba4a-3d03ee2da57f', '1a23de15-07a5-4998-9d3f-6a6345aba237', 'd0fe3ebb-094b-4191-9202-9ab216811ec9', '0046dcd7-86a7-4153-be65-cddd3774a232', 'cd679479-376d-42f0-ad9e-0743c89cd9fe', '0f9b5c0f-ab7f-47f6-8edf-f5dab0badd64', 'de39fc65-0565-4c45-a559-bcda66af9c4a', '2d005728-3cce-4456-be4a-952188203772'], categorization_id: cat_mgcvsk8r_6upxfy -INFO:__main__:Found 123 transactions in database -INFO:__main__:Converted 123 transactions -INFO:__main__:Successfully loaded receipt for file_id: a1a16ce3-ef6d-466c-8606-4ba9501f86a7 -INFO:__main__:Successfully loaded receipt for file_id: ffb999aa-bfd1-4a8a-a7e6-4700b284c30a -INFO:__main__:Successfully loaded receipt for file_id: cd3cc6e2-100e-462a-ba4a-3d03ee2da57f -INFO:__main__:Successfully loaded receipt for file_id: 1a23de15-07a5-4998-9d3f-6a6345aba237 -INFO:__main__:Successfully loaded receipt for file_id: d0fe3ebb-094b-4191-9202-9ab216811ec9 -INFO:__main__:Successfully loaded receipt for file_id: 0046dcd7-86a7-4153-be65-cddd3774a232 -INFO:__main__:Successfully loaded receipt for file_id: cd679479-376d-42f0-ad9e-0743c89cd9fe -INFO:__main__:Successfully loaded receipt for file_id: 0f9b5c0f-ab7f-47f6-8edf-f5dab0badd64 -INFO:__main__:Successfully loaded receipt for file_id: de39fc65-0565-4c45-a559-bcda66af9c4a -INFO:__main__:Successfully loaded receipt for file_id: 2d005728-3cce-4456-be4a-952188203772 -INFO:__main__:Found 10 receipts, 0 missing -INFO:__main__:Starting matching with 10 receipts and 123 transactions -INFO:services.ai_matcher:Starting AI matching for 10 receipts against 123 transactions -INFO:services.ai_matcher:Processing receipt 1/10: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 94 candidates for receipt: Eleven Labs Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.870) -INFO:services.ai_matcher:Found match: 0.870 - Same vendor name, exact amount match, 87 days apart - -Reasoning: -- Vendor name similarity: 0.95 (perfect match) -- Amount accuracy: 0.95 (exact match) -- Date proximity: 0.8 (87 days apart, which is a relatively minor difference) -- Description/notes relevance: 0.8 (no direct relevance, but the vendor name is the same) - -The candidate with the highest match score is Candidate 1, with a confidence score of 0.87. -INFO:services.ai_matcher:Processing receipt 2/10: PAYPAL *BZAABAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 66 candidates for receipt: PAYPAL *BZAABAWSKYJ -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Books by Bessie (score: 0.950) -INFO:services.ai_matcher:Found match: 0.950 - Perfect match in vendor name, exact amount match, and exact date match. - -This is because Candidate 1 has a perfect match in vendor name, amount, and date, which is the highest scoring criteria. -INFO:services.ai_matcher:Processing receipt 3/10: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 48 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Books by Bessie (score: 0.950) -INFO:services.ai_matcher:Found match: 0.950 - Same vendor name, exact amount match, exact date match - -This is because Candidate 1 has the exact same vendor name, amount, and date as the receipt, resulting in a perfect match score of 0.95. -INFO:services.ai_matcher:Processing receipt 4/10: Google LLC - $21.15 -INFO:services.ai_matcher:Found 29 candidates for receipt: Google LLC -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Books by Bessie (score: 0.950) -INFO:services.ai_matcher:Found match: 0.950 - Perfect match in vendor name, exact amount match, and exact date match -INFO:services.ai_matcher:Processing receipt 5/10: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 48 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Books by Bessie (score: 0.950) -INFO:services.ai_matcher:Found match: 0.950 - Perfect match in vendor name, exact amount match, and exact date match -INFO:services.ai_matcher:Processing receipt 6/10: Eleven Labs Inc. - $111.87 -INFO:services.ai_matcher:Found 94 candidates for receipt: Eleven Labs Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Unknown (score: 0.870) -INFO:services.ai_matcher:Found match: 0.870 - Same vendor name, exact amount match, 87 days apart - -Reasoning: -- Vendor name similarity: 0.95 (same vendor name, Eleven Labs Inc.) -- Amount accuracy: 0.95 (exact amount match, $111.87) -- Date proximity: 0.85 (87 days apart, which is a relatively small difference) -- Description/notes relevance: 0.80 (no direct match, but the transaction is related to a bank equipment rental) - -The candidate with the highest match score is Candidate 1, with a confidence score of 0.87. -INFO:services.ai_matcher:Processing receipt 7/10: PAYPAL *BZA BAWSKYJ - $37.55 -INFO:services.ai_matcher:Found 66 candidates for receipt: PAYPAL *BZA BAWSKYJ -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 11.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Books by Bessie (score: 0.950) -INFO:services.ai_matcher:Found match: 0.950 - Perfect match in vendor name, exact amount match, and exact date match - -This is because Candidate 1 has a perfect match in vendor name ("PAYPAL *BZA BAWSKYJ" vs "PAYPAL *BZABAWSKYJ"), exact amount match ($37.55), and exact date match (2023-05-22). -INFO:services.ai_matcher:Processing receipt 8/10: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 48 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 11.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Books by Bessie (score: 0.950) -INFO:services.ai_matcher:Found match: 0.950 - Perfect match in vendor name, exact amount match, and exact date match -INFO:services.ai_matcher:Processing receipt 9/10: Google LLC - $21.15 -INFO:services.ai_matcher:Found 29 candidates for receipt: Google LLC -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 11.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Books by Bessie (score: 0.950) -INFO:services.ai_matcher:Found match: 0.950 - Perfect match: same vendor, amount, and date - -This candidate has a perfect match score of 0.95 due to the exact match in vendor name, amount, and date. -INFO:services.ai_matcher:Processing receipt 10/10: Figma, Inc. - $27.0 -INFO:services.ai_matcher:Found 48 candidates for receipt: Figma, Inc. -INFO:services.ai_matcher:Limited candidates to top 10 by amount similarity -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 429 Too Many Requests" -INFO:groq._base_client:Retrying request to /openai/v1/chat/completions in 10.000000 seconds -INFO:httpx:HTTP Request: POST https://api.groq.com/openai/v1/chat/completions "HTTP/1.1 200 OK" -INFO:services.ai_matcher:AI selected candidate 1: Books by Bessie (score: 0.950) -INFO:services.ai_matcher:Found match: 0.950 - Same vendor name, exact amount match, exact date match - -This is because Candidate 1 has an exact match in vendor name, amount, and date, which meets the scoring criteria for a perfect match. -INFO:services.ai_matcher:AI matching completed. Found 10 matches -INFO:__main__:Matching completed, got 10 results -INFO:__main__:Generated stats: {'total': 10, 'high_confidence': 10, 'low_confidence': 0, 'avg_score': 0.97} -INFO:__main__:Match-specific completed successfully with 10 matches -INFO: 199.241.139.243:50450 - "POST /match-specific HTTP/1.1" 200 OK