Repository navigation
fix(py/openai): fail locally when tools are sent to reasoning models without reasoning_effort='none' - #271
Closed
pcbeingused33 wants to merge 1 commit into
Conversation
…without reasoning_effort='none'
gpt-5.6-{sol,terra,luna}, gpt-6-{sol,luna} and gpt-6.1-terra (and their dated
snapshots) accept function tools on Chat Completions only with
reasoning_effort='none'. Raise INVALID_ARGUMENT before the request when the
OpenAI plugin sends tools without it, reading config and extra. OpenAI-compatible
hosts are not checked.
Fixes genkit-ai#194
|
Thanks for your interest in Genkit. We're closing this pull request because we can't accept it in its current form. If you'd like to contribute, please start a discussion with the maintainers on an issue first; see CONTRIBUTING.md. |
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.
Fixes #194
On Chat Completions,
gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna,gpt-6-sol,gpt-6-lunaandgpt-6.1-terraaccept function tools only withreasoning_effort='none', and they do not default to it. Their catalog info advertisestools=True, so a call such asai.generate(model=OpenAI.gpt('gpt-6-sol'), prompt='...', tools=['get_weather'])goes out withtoolsand noreasoning_effort, and the API answers with a 400.This follows the proposal in #194. When the request has tools and the target is OpenAI's own endpoint,
OpenAIModelraisesGenkitError(INVALID_ARGUMENT)namingreasoning_effort='none'before the request is sent, the same way the GPT Imagexhigh/maxcheck works.-YYYY-MM-DD), using the effective model (config.model/config.version/ the model name).reasoning_effortfromconfigand fromextra.extragoes out asextra_body, which replaces the top-level field, soextrawins when both are set.OpenAICompatibleand for Mistral, since other hosts may serve the same ids under different rules.OpenAIpassesopenai=TruetoOpenAIModel; everything else keeps the old behaviour.reasoning_effort='none'was rejected in the issue because it changes reasoning without the user asking, so it is not done here.Tests (
openai_tools_reasoning_effort_test.py, 21 cases; the full OpenAI plugin suite passes, 1077 tests): four of the listed ids plus a dated snapshot, each with no config, a non-noneeffort inconfig, and a non-noneeffort inextrafails withINVALID_ARGUMENTand sends no request;noneinconfigorextragoes through withtoolsandreasoning_effort='none';extraoverridesconfig; no tools, other models andOpenAICompatibleare untouched.AI assistance was used to prepare this change.