Python: updated declarative samples and handling of non-pydantic response formats (#5022)

* updated declarative samples and handling of non-pydantic response formats

* fixed from comments

* update docstring
This commit is contained in:
Eduard van Valkenburg
2026-04-01 21:16:00 +02:00
committed by GitHub
Unverified
parent 6acab3d1d6
commit 519bb0cb2b
21 changed files with 370 additions and 90 deletions
@@ -1912,9 +1912,7 @@ class RawOpenAIChatClient( # type: ignore[misc]
args["usage_details"] = usage_details
if structured_response:
args["value"] = structured_response
elif (response_format := options.get("response_format")) and isinstance(response_format, type):
# Only pass response_format to ChatResponse if it's a Pydantic model type,
# not a runtime JSON schema dict
elif response_format := options.get("response_format"):
args["response_format"] = response_format
# Set continuation_token when background operation is still in progress
if response.status and response.status in ("in_progress", "queued"):