Repository navigation
fix: keep temperature 0 and forward top_p, top_k and stop_sequences from Claude requests - #149
Merged
lich0821 merged 1 commit intoOct 27, 2026
Conversation
…rom Claude requests Co-Authored-By: Claude Sonnet 5.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.
The Claude -> OpenAI and Claude -> Gemini request converters dropped sampling settings:
temperature: 0was discarded (req.Temperature > 0), so a client asking for deterministic output got the upstream's default temperature instead. The request struct held a plainfloat64, which cannot tell 0 from "not sent".top_p,top_kandstop_sequenceswere not part ofClaudeRequest, so they never reached the upstream.ClaudeRequest.Temperatureis now a*float64and the struct gainsTopP,TopKandStopSequences. The OpenAI converter forwardstemperature,top_pandstop(OpenAIRequestgetsTopPandStop; OpenAI has notop_k), and the Gemini converter writestemperature,topP,topKandstopSequencesintogenerationConfig. Anything the client did not send is still omitted. The Responses API converter is unchanged.Tests:
claude_sampling_test.gocovers both converters with and without the parameters; the two "keeps" cases fail onmaster.go vetandgo test ./internal/...pass. Not run against a live OpenAI or Gemini upstream.This change was prepared with AI assistance (Claude Code).