From c41ede1e67d8d840f4bf735239246cb01c3f45b6 Mon Sep 17 00:00:00 2001 From: somebodyawesome-dev Date: Fri, 7 Mar 2025 10:57:47 +0100 Subject: [PATCH] fix TypeError: 'type' object is not subscriptable when importing component from mistralai module --- src/mistralai/extra/utils/response_format.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mistralai/extra/utils/response_format.py b/src/mistralai/extra/utils/response_format.py index f9ded3ff..67e15912 100644 --- a/src/mistralai/extra/utils/response_format.py +++ b/src/mistralai/extra/utils/response_format.py @@ -1,5 +1,5 @@ from pydantic import BaseModel -from typing import TypeVar, Any, Type +from typing import TypeVar, Any, Type, Dict from ...models import JSONSchema, ResponseFormat from ._pydantic_helper import rec_strict_json_schema @@ -7,7 +7,7 @@ def response_format_from_pydantic_model( - model: type[CustomPydanticModel], + model: Type[CustomPydanticModel], ) -> ResponseFormat: """Generate a strict JSON schema from a pydantic model.""" model_schema = rec_strict_json_schema(model.model_json_schema()) @@ -18,7 +18,7 @@ def response_format_from_pydantic_model( def pydantic_model_from_json( - json_data: dict[str, Any], pydantic_model: Type[CustomPydanticModel] + json_data: Dict[str, Any], pydantic_model: Type[CustomPydanticModel] ) -> CustomPydanticModel: """Parse a JSON schema into a pydantic model.""" return pydantic_model.model_validate(json_data)