fix(openai): suppress native image_generation tool for Codex models (#115)#183
Open
quangdang46 wants to merge 1 commit into
Open
fix(openai): suppress native image_generation tool for Codex models (#115)#183quangdang46 wants to merge 1 commit into
quangdang46 wants to merge 1 commit into
Conversation
In ChatGPT mode, build_response_request unconditionally pushed
{ "type": "image_generation" } onto the request's tool array. The
OpenAI Responses API rejects that tool for codex-family models
(gpt-5.x-codex*, including the [1m] long-context suffix variants)
with HTTP 400 ("unsupported tool image_generation for model …"),
which aborted the entire session for ChatGPT-mode codex users.
Add Self::supports_native_image_generation(model_id) returning false
for any model id whose lower-cased / [1m]-stripped form contains
"codex". Gate the tools.push site by that helper. Non-codex ChatGPT
models (gpt-5.x non-codex, gpt-4o, etc.) still receive the tool.
Two regression tests in src/provider/openai_tests/payloads.rs:
- test_chatgpt_payload_includes_native_image_generation_for_non_codex_models
- test_chatgpt_payload_excludes_native_image_generation_for_codex_models
iterating gpt-5.3-codex, gpt-5.3-codex-spark, and gpt-5.3-codex-spark[1m].
Ports upstream PR 1jehuang#148.
Closes #115
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.
What
In ChatGPT mode,
build_response_requestunconditionally pushed{ "type": "image_generation" }onto the request's tool array. The OpenAI Responses API rejects that tool for codex-family models (gpt-5.x-codex*, including the[1m]long-context suffix variants) with HTTP 400 ("unsupported tool image_generation for model …"), which aborted the entire session for ChatGPT-mode codex users.This addresses issue #115: #115
Changes
Self::supports_native_image_generation(model_id)returningfalsefor any model id whose lower-cased /[1m]-stripped form contains "codex". Gate the existingtools.pushsite by that helper. Non-codex ChatGPT models (gpt-5.xnon-codex,gpt-4o, …) still receive the tool.test_chatgpt_payload_includes_native_image_generation_for_non_codex_models(gpt-5.5)test_chatgpt_payload_excludes_native_image_generation_for_codex_modelsiteratinggpt-5.3-codex,gpt-5.3-codex-spark,gpt-5.3-codex-spark[1m].Tests
Notes
Ports upstream PR 1jehuang#148.