Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/mistralai/__init__.py", line 3, in <module>
from .sdk import *
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/mistralai/sdk.py", line 3, in <module>
from .basesdk import BaseSDK
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/mistralai/basesdk.py", line 3, in <module>
from .sdkconfiguration import SDKConfiguration
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/mistralai/sdkconfiguration.py", line 8, in <module>
from mistralai import models
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/mistralai/models/__init__.py", line 3, in <module>
from .agentscompletionrequest import AgentsCompletionRequest, AgentsCompletionRequestMessages, AgentsCompletionRequestMessagesTypedDict, AgentsCompletionRequestStop, AgentsCompletionRequestStopTypedDict, AgentsCompletionRequestToolChoice, AgentsCompletionRequestTypedDict
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/mistralai/models/agentscompletionrequest.py", line 8, in <module>
from .usermessage import UserMessage, UserMessageTypedDict
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/mistralai/models/usermessage.py", line 4, in <module>
from .textchunk import TextChunk, TextChunkTypedDict
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/mistralai/models/textchunk.py", line 14, in <module>
class TextChunk(BaseModel):
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 200, in __new__
set_model_fields(cls, bases, config_wrapper, types_namespace)
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 469, in set_model_fields
fields, class_vars = collect_model_fields(cls, bases, config_wrapper, types_namespace, typevars_map=typevars_map)
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_fields.py", line 132, in collect_model_fields
type_hints = get_cls_type_hints_lenient(cls, types_namespace)
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 228, in get_cls_type_hints_lenient
hints[name] = eval_type_lenient(value, globalns, localns)
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 240, in eval_type_lenient
return eval_type_backport(value, globalns, localns)
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 264, in eval_type_backport
return typing._eval_type( # type: ignore
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/typing.py", line 292, in _eval_type
return t._evaluate(globalns, localns, recursive_guard)
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/typing.py", line 554, in _evaluate
eval(self.__forward_code__, globalns, localns),
File "<string>", line 1, in <module>
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/typing.py", line 277, in inner
return func(*args, **kwds)
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/typing.py", line 1339, in __class_getitem__
origin = _type_check(params[0], msg)
File "/Users/tcapelle/miniforge3/envs/py39/lib/python3.9/typing.py", line 158, in _type_check
raise TypeError(f"{arg} is not valid as type argument")
TypeError: typing.Final[typing.Optional[str]] is not valid as type argument
Fresh python 3.9.10 env, we catched this on our CI, I was using newer pythons on my computer.
Python -VV
Pip Freeze
Reproduction Steps
python -c "import mistralai"you get:
Expected Behavior
Should just work
Additional Context
Fresh python 3.9.10 env, we catched this on our CI, I was using newer pythons on my computer.
Suggested Solutions
bump requirements or change
Final[Optional]