Stop defaulting temperature in Raix::Configuration#50
Merged
Conversation
The Configuration#initialize line `self.temperature = DEFAULT_TEMPERATURE`
forced `temperature: 0.0` into every chat_completion request whose caller
hadn't set a temperature explicitly. With `provider.require_parameters: true`
— which Raix sets automatically whenever `json: true` is passed — OpenRouter
rejects the request 404 "No endpoints found that can handle the requested
parameters" for any provider whose `supported_parameters` list omits
`temperature`. Anthropic's Claude 4.7 models (opus-4.7, opus-4.7-fast) are
exactly that case, so `chat_completion(json: true)` against
`anthropic/claude-opus-4-7` failed in production.
Drop the default. When temperature is unset, the request omits it and the
provider applies its own server-side default. Callers wanting deterministic
output set it explicitly (`self.temperature = 0.0` per-class, or
`Raix.configure { |c| c.temperature = 0.0 }` globally).
Adds spec/raix/default_temperature_spec.rb covering:
- no with_temperature call when nothing is set
- explicit `temperature = 0.0` still forwards
- class-level configured temperature still forwards
- fresh Configuration#temperature is nil; other defaults unchanged
Note for upgraders: requests that previously ran at temperature 0.0 will now
run at the provider's default (typically 1.0). Pin temperature explicitly if
you relied on the old behavior.
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
Raix::Configuration#initializeno longer setstemperature = 0.0. Callers who want a specific temperature now have to set one explicitly (or rely on the provider's server-side default).spec/raix/default_temperature_spec.rbcovering both directions: the parameter is now omitted when unset, and an explicit value (including class-levelconfigure) still flows through toRubyLLM::Chat#with_temperature.Why
Production hit
RubyLLM::Error: No endpoints found that can handle the requested parametersfrom a routinechat_completion(json: true)call against `anthropic/claude-opus-4-7`. Sentry: INGENIUM-6.Tracing through Raix + RubyLLM + OpenRouter:
Verified locally with the exact production payload via `curl`: removing the `temperature: 0.0` field is the difference between success and the 404. Repro'd in Raix and confirmed the fix unblocks it.
Temperature is the only knob the Configuration was forcing on. Every other parameter (`top_p`, `frequency_penalty`, `presence_penalty`, etc.) is nil by default and is only serialized when the caller sets it. This change makes temperature consistent with the rest.
Breaking change note
Requests that previously ran at temperature 0.0 will now run at the provider's default (typically ~1.0). Pin explicitly if you relied on the old behavior:
```ruby
Raix.configure { |c| c.temperature = 0.0 } # global
or
class MyAgent
include Raix::ChatCompletion
self.temperature = 0.0 # per-class
end
```
Test plan