Fix: retry without temperature for models that only accept the default - #7
Merged
Merged
Conversation
Some models (e.g. OpenAI's o1 / gpt-5 series such as gpt-5.6-sol) only
accept the default temperature and return a BadRequestError for any
explicit value:
OpenAIException - Unsupported value: 'temperature' does not support
0.7 with this model. Only the default (1) value is supported.
_complete() now catches a temperature-related BadRequestError and retries
once without the temperature parameter, letting the model use its default,
instead of failing the whole request. Unrelated BadRequestErrors are
re-raised unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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
Newer models (e.g. OpenAI's o1 / gpt-5 series, such as
gpt-5.6-sol) only accept the default temperature and reject any explicit value:Our
_complete()helper always passestemperature=0.7/0.8, so playlist generation fails outright with these models.Fix
_complete()now catches a temperature-relatedBadRequestErrorand retries once without thetemperatureparameter, letting the model use its own default. Any otherBadRequestError(e.g. context-length) is re-raised unchanged, so we don't mask real failures.This keeps the tuned temperatures for models that support them (most of them) while degrading gracefully for those that don't — no per-model allowlist to maintain.
Testing
temperatureand succeeds.BadRequestErrorstill propagates.🤖 Generated with Claude Code