fix(extra): return ResponseFormatTypedDict from response_format_from_pydantic_model#438
Merged
Nelson-PROIA merged 2 commits intomainfrom Mar 20, 2026
Merged
Conversation
Contributor
|
@Nelson-PROIA have we tested it works on a live azure endpoint? |
e88b68f to
52982af
Compare
louis-sanna-dev
approved these changes
Mar 20, 2026
…pydantic_model response_format_from_pydantic_model now returns a ResponseFormatTypedDict (plain dict) instead of a ResponseFormat model instance. This fixes the type mismatch when passing the result to the Azure SDK, which expects its own ResponseFormat class, and avoids the schema alias data loss issue. Fixes AIR-143 / GitHub #367
Fix mypy list invariance error introduced by SDK 2.1.0 regen where list[Tool] no longer satisfies the broadened tools union type.
52982af to
4fb65be
Compare
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.
Summary
response_format_from_pydantic_modelnow returns aResponseFormatTypedDict(plain dict at runtime) instead of aResponseFormatmodel instanceocr.process()orchat.complete(), which expect their ownResponseFormatclassschemaalias data loss issue (no more need for.model_dump(by_alias=True))schemakey (wire format) so it works both through SDK serialization and when passed directly (batch jobs, raw HTTP)list[Tool]mypy error infunction_calling.pyexample (list invariance with broadened union type from SDK 2.1.0)Test plan
test_utils.py)response_formaton real endpointdocument_annotation_formaton real endpoint (exact issue [BUG CLIENT]: OCR data extraction example gives an ValidationError: 2 validation errors for Unmarshaller Azure Foundry Model #367 scenario)response_formaton real endpointCloses #367