Skip to content

Commit c9592d6

Browse files
fix TypeError: 'type' object is not subscriptable when importing component from mistralai module (#192)
1 parent 9c37e23 commit c9592d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from pydantic import BaseModel
2-
from typing import TypeVar, Any, Type
2+
from typing import TypeVar, Any, Type, Dict
33
from ...models import JSONSchema, ResponseFormat
44
from ._pydantic_helper import rec_strict_json_schema
55

66
CustomPydanticModel = TypeVar("CustomPydanticModel", bound=BaseModel)
77

88

99
def 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

2020
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]
2222
) -> CustomPydanticModel:
2323
"""Parse a JSON schema into a pydantic model."""
2424
return pydantic_model.model_validate(json_data)

0 commit comments

Comments
 (0)