Update Anthropic model config for current Claude models - #211
Open
hiryanchen wants to merge 1 commit into
Open
Conversation
The pinned model `claude-sonnet-4-20250514` is deprecated (retires 2026-06-15), and the request parameters block upgrading away from it: - `temperature` is rejected by current Claude models and returns a 400, so bumping ANTHROPIC_MODEL alone breaks every query at API-call time. - Newer models run adaptive thinking when `thinking` is omitted, which spends part of the 800-token budget on reasoning the app never reads. Pin `claude-sonnet-5`, drop `temperature`, and set `thinking` to disabled so the full max_tokens budget goes to the response. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
backend/config.pypinsANTHROPIC_MODELtoclaude-sonnet-4-20250514, which is deprecated and retires 2026-06-15. Upgrading off it isn't a one-line change, because two things inAIGenerator.base_paramsare incompatible with current models:temperature: 0returns a 400. Current Claude models reject non-default sampling parameters. BumpingANTHROPIC_MODELon its own makes every query fail at API-call time — the server still starts and ingests documents fine (embeddings are local), so the failure only shows up once you ask a question.thinkingis unset. Newer models run adaptive thinking by default, so part of the 800-tokenmax_tokensbudget goes to reasoning this app never reads.max_tokenscaps thinking plus response text, so answers can get truncated.Change
config.py: pinANTHROPIC_MODELtoclaude-sonnet-5.ai_generator.py: droptemperature, addthinking: {"type": "disabled"}so the fullmax_tokensbudget goes to the response.Two files, no behavior change to the retrieval flow.
Note for maintainers
Both return sites in
ai_generator.py(:90and:138) doresponse.content[0].textunconditionally. That's safe withthinkingdisabled as set here, but it will raise if anyone enables thinking later — a thinking block can land atcontent[0]. Left alone to keep this PR scoped; happy to fix it here or in a follow-up if you'd prefer.🤖 Generated with Claude Code