Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mark some dataclasses as pydantic dataclasses #1131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/agents/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar, Union

import pydantic
from openai.types.responses import (
Response,
ResponseComputerToolCall,
Expand Down Expand Up @@ -212,7 +213,7 @@ class MCPApprovalResponseItem(RunItemBase[McpApprovalResponse]):
"""An item generated by an agent."""


@dataclass
@pydantic.dataclasses.dataclass
class ModelResponse:
output: list[TResponseOutputItem]
"""A list of outputs (messages, tool calls, etc) generated by the model"""
Expand Down
3 changes: 2 additions & 1 deletion src/agents/model_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import dataclasses
from collections.abc import Mapping
from dataclasses import dataclass, fields, replace
from dataclasses import fields, replace
from typing import Annotated, Any, Literal, Union

from openai import Omit as _Omit
from openai._types import Body, Query
from openai.types.responses import ResponseIncludable
from openai.types.shared import Reasoning
from pydantic import BaseModel, GetCoreSchemaHandler
from pydantic.dataclasses import dataclass
from pydantic_core import core_schema
from typing_extensions import TypeAlias

Expand Down
3 changes: 2 additions & 1 deletion src/agents/usage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dataclasses import dataclass, field
from dataclasses import field

from openai.types.responses.response_usage import InputTokensDetails, OutputTokensDetails
from pydantic.dataclasses import dataclass


@dataclass
Expand Down