fix: modifies openai request logic for reasoning models (#4221) #4294
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.
This is a first take at fixing the issue described in #4221 where the logic used in the litellm provider to create the requests is the same as the openai format, which has significant bias towards openai models. I've added a GOOSE-level configuration, GOOSE_REASONING_EFFORT, that forces goose to use the reasoning level provided, or it falls back to the previous parsing style for the model name. The name-based parsing uses more specific schemes, calling out o{1..4} instead of just "o" as the starting char.
I also split the logic for "is this a reasoning model" and "is this an ox model" as those have different implications for the built request. I'm open to the idea of a better way to distinguish whether or not a model is reasoning for models other than openai-specific ones, as I'm not really sure - user config parameter, enumerate the most common reasoning models and try to parse them, not sure what else.