Skip to content

Commit a62a221

Browse files
move OutputObjectDefinition from private _output.py to public output.py (#2991)
1 parent 85731ef commit a62a221

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

pydantic_ai_slim/pydantic_ai/_output.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
NativeOutput,
2020
OutputDataT,
2121
OutputMode,
22+
OutputObjectDefinition,
2223
OutputSpec,
2324
OutputTypeOrFunction,
2425
PromptedOutput,
@@ -581,14 +582,6 @@ def mode(self) -> OutputMode:
581582
return 'tool_or_text'
582583

583584

584-
@dataclass
585-
class OutputObjectDefinition:
586-
json_schema: ObjectJsonSchema
587-
name: str | None = None
588-
description: str | None = None
589-
strict: bool | None = None
590-
591-
592585
@dataclass(init=False)
593586
class BaseOutputProcessor(ABC, Generic[OutputDataT]):
594587
@abstractmethod

pydantic_ai_slim/pydantic_ai/output.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from . import _utils
1313
from .messages import ToolCallPart
14-
from .tools import DeferredToolRequests, RunContext, ToolDefinition
14+
from .tools import DeferredToolRequests, ObjectJsonSchema, RunContext, ToolDefinition
1515

1616
__all__ = (
1717
# classes
@@ -20,6 +20,7 @@
2020
'PromptedOutput',
2121
'TextOutput',
2222
'StructuredDict',
23+
'OutputObjectDefinition',
2324
# types
2425
'OutputDataT',
2526
'OutputMode',
@@ -242,6 +243,16 @@ def __init__(
242243
self.template = template
243244

244245

246+
@dataclass
247+
class OutputObjectDefinition:
248+
"""Definition of an output object used for structured output generation."""
249+
250+
json_schema: ObjectJsonSchema
251+
name: str | None = None
252+
description: str | None = None
253+
strict: bool | None = None
254+
255+
245256
@dataclass
246257
class TextOutput(Generic[OutputDataT]):
247258
"""Marker class to use text output for an output function taking a string argument.

0 commit comments

Comments
 (0)