Repository navigation
fix: use model_dump() instead of deprecated dict() in OpenAI output p… - #7850
Closed
intertermux-code wants to merge 1 commit into
Closed
intertermux-code wants to merge 1 commit into
intertermux-code wants to merge 1 commit into
Conversation
…aths The pydantic v1 .dict() API emits PydanticDeprecatedSince20 on pydantic v2, which breaks anyone running with DeprecationWarnings as errors. Every supported openai/openai-agents version requires pydantic v2, so model_dump() is a drop-in replacement here. Fixes getsentry#7827.
Collaborator
|
Hi @intertermux-code. |
Contributor
Author
|
Done — the four fixes are consolidated in #7857. Sorry for the noise this morning. |
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
_set_output_datain the OpenAI Agents integration (and_set_common_output_datain the OpenAI integration's Responses API path) serialized pydantic models with the v1.dict()API. On pydantic v2 that emitsPydanticDeprecatedSince20, which breaks anyone running withDeprecationWarnings as errors.Every supported
openai/openai-agentsversion requires pydantic v2, so.model_dump()is a drop-in replacement. The OpenAI integration already calls.model_dump()unconditionally a few lines above (chat completions path), and the Anthropic/LiteLLM integrations use the same pattern.Changed:
sentry_sdk/integrations/openai_agents/utils.py: 2 callssentry_sdk/integrations/openai.py: 4 calls (both record-outputs branches of the Responses API path)Added
test_set_output_data_tool_calls_no_pydantic_deprecation, which runs_set_output_datawith a function call plus a message carrying non-text content (the refusal path) underwarnings.simplefilter("error", DeprecationWarning).Issues
PydanticDeprecatedSince20on tool calls -_set_output_datacallsdict()#7827Reminders
uv run ruff.feat:,fix:,meta:)