feat: add Claude Haiku model#99
Conversation
Confidence Score: 5/5Safe to merge; one minor logic edge-case in _fix_malformed_json that only affects a narrow error-recovery path. All findings are P2 or lower. The core model wiring (model name, base URL, skipping response_format, API key provider) is correct. The only issue is that first_brace is computed but not used in the slice inside _fix_malformed_json, which only matters when Claude returns preamble text before a JSON-like response ending in ']' — an unlikely real-world case that still fails loudly rather than silently. transaction_parser/transaction_parser/ai_integration/parser.py — _fix_malformed_json slice logic (lines 213–218).
|
| Filename | Overview |
|---|---|
| transaction_parser/transaction_parser/ai_integration/models.py | Adds ClaudeHaiku dataclass with correct Anthropic OpenAI-compatible base_url, TEXT response format, and supports_response_format=False; registered as "Claude Haiku-4.5" in MODELS dict. |
| transaction_parser/transaction_parser/ai_integration/parser.py | Adds supports_response_format guard and new _parse_content/_fix_malformed_json methods to handle Claude's text responses; first_brace variable computed but unused in slice (see comment). |
| transaction_parser/transaction_parser/doctype/transaction_parser_settings/transaction_parser_settings.json | Adds "Claude Haiku-4.5" option to the default_ai_model Select field options. |
| transaction_parser/transaction_parser/doctype/transaction_parser_settings/transaction_parser_settings.py | Auto-generated type stubs updated to include "Claude Haiku-4.5" in the default_ai_model Literal type; no logic changes. |
| transaction_parser/transaction_parser/doctype/transaction_parser_api_key_item/transaction_parser_api_key_item.json | Adds "Anthropic" to the service_provider Select field options, enabling Anthropic API key configuration. |
| transaction_parser/transaction_parser/doctype/transaction_parser_api_key_item/transaction_parser_api_key_item.py | Auto-generated type stubs updated to include "Anthropic" in the service_provider Literal type; no logic changes. |
| transaction_parser/parser_benchmark/doctype/parser_benchmark_dataset/parser_benchmark_dataset.json | Adds claude_haiku_45 checkbox field and column_break_clde to the AI Models section of the benchmark dataset DocType. |
| transaction_parser/parser_benchmark/doctype/parser_benchmark_dataset/parser_benchmark_dataset.py | Adds claude_haiku_45 → "Claude Haiku-4.5" mapping to AI_MODEL_FIELD_MAP and updates auto-generated type stubs. |
| transaction_parser/parser_benchmark/doctype/parser_benchmark_log/parser_benchmark_log.json | Adds "Claude Haiku-4.5" to the ai_model Select field options in the benchmark log DocType. |
| transaction_parser/parser_benchmark/doctype/parser_benchmark_log/parser_benchmark_log.py | Auto-generated type stubs updated to include "Claude Haiku-4.5" in the ai_model Literal type; no logic changes. |
| transaction_parser/parser_benchmark/doctype/parser_benchmark_token_cost/parser_benchmark_token_cost.json | Adds "Claude Haiku-4.5" to the ai_model Select field options in the token cost DocType. |
| transaction_parser/parser_benchmark/doctype/parser_benchmark_token_cost/parser_benchmark_token_cost.py | Auto-generated type stubs updated to include "Claude Haiku-4.5" in the ai_model Literal type; no logic changes. |
| transaction_parser/parser_benchmark/report/transaction_parser_accuracy_analysis/transaction_parser_accuracy_analysis.py | Adds "Claude Haiku-4.5" at index 6 in _AI_MODEL_ORDER for report sorting; no other logic changes. |
| transaction_parser/parser_benchmark/report/transaction_parser_accuracy_analysis/transaction_parser_accuracy_analysis.js | Adds "Claude Haiku-4.5" to the AI_MODELS filter list. |
| transaction_parser/parser_benchmark/report/transaction_parser_benchmark_log_detail/transaction_parser_benchmark_log_detail.js | Adds "Claude Haiku-4.5" to the AI_MODELS filter list. |
| transaction_parser/parser_benchmark/report/transaction_parser_version_comparison/transaction_parser_version_comparison.py | Adds "Claude Haiku-4.5" at index 6 in _AI_MODEL_ORDER for report sorting; no other logic changes. |
| transaction_parser/parser_benchmark/report/transaction_parser_version_comparison/transaction_parser_version_comparison.js | Adds "Claude Haiku-4.5" to the AI_MODELS filter list. |
Comments Outside Diff (1)
-
transaction_parser/transaction_parser/ai_integration/parser.py, line 213-218 (link)first_bracecomputed but not used in slicefirst_braceis found to locate the start of the JSON object, butcontent = "[" + contentprepends[to the full string rather than tocontent[first_brace:]. If Claude returns a response like"Here is the parsed data: {...}]", the fixed string becomes"[Here is the parsed data: {...}]"which is still invalid JSON, soto_dictthrows and the caller surfaces "Failed to parse response content" to the user.
Reviews (1): Last reviewed commit: "feat: update Claude Haiku model configur..." | Re-trigger Greptile
📝 WalkthroughWalkthroughThis pull request adds Claude Haiku-4.5 as a supported AI model across the system. Changes include registering the new model in the AI integration configuration with Anthropic as the service provider, adding it to all DocType field options and type definitions for benchmark datasets and logs, extending report filter options, and updating model ordering in reports. A new 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
transaction_parser/parser_benchmark/report/transaction_parser_accuracy_analysis/transaction_parser_accuracy_analysis.py (1)
28-30: Consider centralizing AI model ordering to avoid drift.The updated order is correct, but this dictionary is duplicated across multiple report modules. Moving
_AI_MODEL_ORDERto a shared constant would prevent future mismatches.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3836317d-7766-4f82-9abf-a4902c8cf6b6
📒 Files selected for processing (17)
transaction_parser/parser_benchmark/doctype/parser_benchmark_dataset/parser_benchmark_dataset.jsontransaction_parser/parser_benchmark/doctype/parser_benchmark_dataset/parser_benchmark_dataset.pytransaction_parser/parser_benchmark/doctype/parser_benchmark_log/parser_benchmark_log.jsontransaction_parser/parser_benchmark/doctype/parser_benchmark_log/parser_benchmark_log.pytransaction_parser/parser_benchmark/doctype/parser_benchmark_token_cost/parser_benchmark_token_cost.jsontransaction_parser/parser_benchmark/doctype/parser_benchmark_token_cost/parser_benchmark_token_cost.pytransaction_parser/parser_benchmark/report/transaction_parser_accuracy_analysis/transaction_parser_accuracy_analysis.jstransaction_parser/parser_benchmark/report/transaction_parser_accuracy_analysis/transaction_parser_accuracy_analysis.pytransaction_parser/parser_benchmark/report/transaction_parser_benchmark_log_detail/transaction_parser_benchmark_log_detail.jstransaction_parser/parser_benchmark/report/transaction_parser_version_comparison/transaction_parser_version_comparison.jstransaction_parser/parser_benchmark/report/transaction_parser_version_comparison/transaction_parser_version_comparison.pytransaction_parser/transaction_parser/ai_integration/models.pytransaction_parser/transaction_parser/ai_integration/parser.pytransaction_parser/transaction_parser/doctype/transaction_parser_api_key_item/transaction_parser_api_key_item.jsontransaction_parser/transaction_parser/doctype/transaction_parser_api_key_item/transaction_parser_api_key_item.pytransaction_parser/transaction_parser/doctype/transaction_parser_settings/transaction_parser_settings.jsontransaction_parser/transaction_parser/doctype/transaction_parser_settings/transaction_parser_settings.py
Uh oh!
There was an error while loading. Please reload this page.