Repository navigation
fix(brain): Claude as the brain — temperature is optional, refused params are learned - #74
Merged
Merged
Conversation
…rams are learned Opus 5.5 (and the other current Claude models), also through Anthropic's OpenAI-compatible endpoint, answer every request that carries a temperature with 400 "`temperature` is deprecated for this model". The brain sent a hardcoded 0.7, and its 400 retry only dropped response_format — so the retry failed the same way and the dog never got an answer. - LLM_TEMPERATURE (default 0.7, "off" sends none). - The 400 retry drops whichever optional parameter the error names (temperature or response_format; response_format if it names none) and remembers it, so later sentences pay no extra round trip. - install-brain.sh's template shows the Claude setup, and warns that a Claude subscription token (sk-ant-oat...) is not an API key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y why, budget hint - request_llm loops until no refusable parameter is left, so a turn where the endpoint refuses temperature and then response_format still answers. - A 400 with nothing left to drop carries the endpoint's own words instead of a bare "Bad Request". - An empty answer with finish_reason "length" says to raise the new LLM_MAX_TOKENS (Opus 5.5 always thinks first), not to switch to llama3.2. - LLM_TEMPERATURE="abc"/"0,7"/"nan" fails naming the setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Review folded in: both refused params are dropped within one turn (loop), an unknown 400 now shows the endpoint's message, empty answers with |
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.
Setting up the brain on the Pi 5 with Claude Opus 5.5 (via
https://api.anthropic.com/v1/chat/completions), verified against the live endpoint:The brain hardcoded
"temperature": 0.7, and its existing 400 retry only removedresponse_format— so the retry failed identically and every voice turn ended in "LLM API error".Changes
LLM_TEMPERATUREenv (default0.7,offsends none)temperature/response_format; falls back toresponse_formatas before), and remembers it for the process — no double round trip per sentence, which matters for voice latencyinstall-brain.shtemplate: Claude example, plus a warning that a Claude subscription token (sk-ant-oat…) is not an API key (found on the real machine: OpenClaw's token getsinvalid x-api-keyon the API)Tests
tests/test_llm_compat.py: verbatim Claude error → dropped + remembered,response_formatsurvives;offsends none; an unrelated 400 is not retried endlessly; autouse fixture isolates the learned set. 656 passed, ruff: no new findings.🤖 Generated with Claude Code