Repository navigation
Conversation
Recording tool calls and non-text message content called the deprecated Pydantic v2 `dict()` method, which emits `PydanticDeprecatedSince20`. `openai-agents` requires Pydantic v2 in every supported version, so `model_dump()` is always available.
Recording Responses API tool calls and non-text message content called the deprecated Pydantic v2 `dict()` method, which emits `PydanticDeprecatedSince20`. `openai`'s `BaseModel` defines `model_dump()` under Pydantic v1 in every supported version from `1.0.0`, so the call works with both Pydantic majors.
fbartho
marked this pull request as ready for review
October 14, 2026 00:14
Author
|
Sorry, I didn't realize you had already fixed the main issue I was experiencing |
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.
Description
OpenAIIntegration(Responses API) andOpenAIAgentsIntegrationserialize tool calls and non-text message content with the deprecated Pydantic v2dict()method, so every response containing a function call or a refusal emitsPydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead.when outputs are recorded.Changes:
openai: replace the fourdict()calls in_set_common_output_datawithmodel_dump().openai-agents: replace the twodict()calls in_set_output_datawithmodel_dump().test_responses_api_output_serialization_emits_no_pydantic_deprecation_warning(openai, both thedata_collectionandsend_default_piipaths) andtest_response_output_serialization_emits_no_pydantic_deprecation_warning(openai-agents), which assert noPydanticDeprecatedSince20is emitted.On Pydantic v1:
openai'sBaseModeldefinesmodel_dump()when Pydantic v1 is installed, delegating todict(), in every version from1.0.0, the integration's minimum. The Chat Completions path in the same function already callschoice.message.model_dump()on that basis.openai-agentsrequirespydantic>=2.10.https://github.com/openai/openai-python/blob/becc1d20eed83c1b8d85e15dc131a372d9dc7813/src/openai/_models.py#L296-L372
The tox matrix pins Pydantic v2, so I also ran
tests/integrations/openai/test_openai.pyagainstopenai3.29.0 withpydantic1.10.26: everything passes, and the new test skips.Issues
Closes #7827