Skip to content

Commit 63af922

Browse files
authored
Fix serializability of ModelRequestParameters (#1690)
1 parent ef07d77 commit 63af922

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

pydantic_ai_slim/pydantic_ai/models/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from dataclasses import dataclass, field
1313
from datetime import datetime
1414
from functools import cache
15-
from typing import TYPE_CHECKING
1615

1716
import httpx
1817
from typing_extensions import Literal, TypeAliasType
@@ -21,12 +20,9 @@
2120
from ..exceptions import UserError
2221
from ..messages import ModelMessage, ModelRequest, ModelResponse, ModelResponseStreamEvent
2322
from ..settings import ModelSettings
23+
from ..tools import ToolDefinition
2424
from ..usage import Usage
2525

26-
if TYPE_CHECKING:
27-
from ..tools import ToolDefinition
28-
29-
3026
KnownModelName = TypeAliasType(
3127
'KnownModelName',
3228
Literal[
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from pydantic import TypeAdapter
2+
3+
from pydantic_ai.models import ModelRequestParameters
4+
5+
6+
def test_model_request_parameters_are_serializable():
7+
params = ModelRequestParameters(function_tools=[], allow_text_output=False, output_tools=[])
8+
assert TypeAdapter(ModelRequestParameters).dump_python(params) == {
9+
'function_tools': [],
10+
'allow_text_output': False,
11+
'output_tools': [],
12+
}

0 commit comments

Comments
 (0)