File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
from pydantic import BaseModel
2
- from typing import TypeVar , Any , Type
2
+ from typing import TypeVar , Any , Type , Dict
3
3
from ...models import JSONSchema , ResponseFormat
4
4
from ._pydantic_helper import rec_strict_json_schema
5
5
6
6
CustomPydanticModel = TypeVar ("CustomPydanticModel" , bound = BaseModel )
7
7
8
8
9
9
def response_format_from_pydantic_model (
10
- model : type [CustomPydanticModel ],
10
+ model : Type [CustomPydanticModel ],
11
11
) -> ResponseFormat :
12
12
"""Generate a strict JSON schema from a pydantic model."""
13
13
model_schema = rec_strict_json_schema (model .model_json_schema ())
@@ -18,7 +18,7 @@ def response_format_from_pydantic_model(
18
18
19
19
20
20
def pydantic_model_from_json (
21
- json_data : dict [str , Any ], pydantic_model : Type [CustomPydanticModel ]
21
+ json_data : Dict [str , Any ], pydantic_model : Type [CustomPydanticModel ]
22
22
) -> CustomPydanticModel :
23
23
"""Parse a JSON schema into a pydantic model."""
24
24
return pydantic_model .model_validate (json_data )
You can’t perform that action at this time.
0 commit comments