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 11from pydantic import BaseModel
2- from typing import TypeVar , Any , Type
2+ from typing import TypeVar , Any , Type , Dict
33from ...models import JSONSchema , ResponseFormat
44from ._pydantic_helper import rec_strict_json_schema
55
66CustomPydanticModel = TypeVar ("CustomPydanticModel" , bound = BaseModel )
77
88
99def response_format_from_pydantic_model (
10- model : type [CustomPydanticModel ],
10+ model : Type [CustomPydanticModel ],
1111) -> ResponseFormat :
1212 """Generate a strict JSON schema from a pydantic model."""
1313 model_schema = rec_strict_json_schema (model .model_json_schema ())
@@ -18,7 +18,7 @@ def response_format_from_pydantic_model(
1818
1919
2020def pydantic_model_from_json (
21- json_data : dict [str , Any ], pydantic_model : Type [CustomPydanticModel ]
21+ json_data : Dict [str , Any ], pydantic_model : Type [CustomPydanticModel ]
2222) -> CustomPydanticModel :
2323 """Parse a JSON schema into a pydantic model."""
2424 return pydantic_model .model_validate (json_data )
You can’t perform that action at this time.
0 commit comments