Repository navigation
fix: make the API work with current Claude models (temperature 400, content-block 500) - #3
Merged
Merged
Conversation
Claude 4.7 and newer models, including the default claude-haiku-5-5, return 400 invalid_request_error for any temperature other than 1. The API sent temperature=0 on every call, so every chat request failed. LLM_TEMPERATURE now defaults to unset, and the request omits it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XtW6Y5JF5GNt1txL7PriFg
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Current Claude models think adaptively, so a reply can be a list of blocks (thinking, text) instead of a string. Storing that list made GET /api/thread fail with a 500, and research steps fell back because they called .strip() on it. message_text() now returns only the text blocks. max_tokens rises from LangChain's default 1024 to 4096, because thinking counts toward the limit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XtW6Y5JF5GNt1txL7PriFg
This branch was successfully deployed
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.
Summary
Makes the API work with current Claude models. Two problems showed up once a valid key was in place:
400 BadRequestErroron every chat: the API senttemperature=0, and current models (including the defaultclaude-haiku-5-5) reject any temperature other than 1.500onGET /api/thread: current models think adaptively, so a reply can be a list of content blocks (thinking, text) instead of a string. The API stored that list, and the response model, which expects a string, failed. Research steps also broke, because they call.strip()on the reply.Changes
LLM_TEMPERATUREdefaults to unset, so it is left out of the request.message_text()returns only a reply's text blocks. Thinking is never shown to users. It is used in chat, the research steps and the workflow log.LLM_MAX_TOKENSsetting, default 4096 (LangChain's default was 1024), because thinking counts toward the limit..env.example,docker-compose.ymland the README are updated.Verification
pytest -q: 37 passed. New tests cover the request payload (no sampling parameters,max_tokens),message_text, a thinking-block reply through/api/thread, and a thinking-block research report.ruff check app tests: passesAfter merging
Delete
LLM_TEMPERATUREfrom the Vercel project's environment variables if it is set.https://claude.ai/code/session_01XtW6Y5JF5GNt1txL7PriFg
Generated by Claude Code