Fix: Ensure OpenAI SDK extra_body fields can correctly merge into request #1119
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.
🔧 Description:
This PR fixes an issue where requests using the
extra_body
parameter with the OpenAI Python SDK do not function as intended.extra_body
fields into the top-level JSON payload. As a result, on the backend, theExtraBody
field in our request struct remains empty, and the extra parameters (such asguided_choice
,guided_json
, etc.) are ignored.This behavior is identical to using the
requests
to send these parameters at the root of the payload, which is also a valid and common way users interact with the API.Previously, we relied on the presence of
ExtraBody
in the parsed request struct, which remains empty in this case, leading to missing parameters when forwarding the request upstream.✅ Fix:
extra_body
.💡 Why this matters:
Without this patch, SDK users (and native
requests
users sendingguided_*
orresponse_format
directly in the root) will experience confusing failures, where valid parameters are silently dropped. This fix ensures full compatibility with both SDK usage patterns and manual requests.