-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG CLIENT]: Py3.9.10 failing with typing error #142
Comments
I am having a similar issue as well. I am using:
When I run Traceback```sh { "name": "TypeError", "message": "Unable to evaluate type annotation \"Annotated[Final[Optional[ImageURLChunkType]], pydantic.Field(alias='type')]\".", "stack": "--------------------------------------------------------------------------- TypeError Traceback (most recent call last) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/pydantic/_internal/_typing_extra.py:279, in eval_type_backport(value, globalns, localns, type_params) 278 try: --> 279 return _eval_type_backport(value, globalns, localns, type_params) 280 except TypeError as e:File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/pydantic/_internal/_typing_extra.py:303, in _eval_type_backport(value, globalns, localns, type_params) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/pydantic/_internal/_typing_extra.py:332, in _eval_type(value, globalns, localns, type_params) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/typing.py:324, in _eval_type(t, globalns, localns, recursive_guard) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/typing.py:688, in ForwardRef.evaluate(self, globalns, localns, recursive_guard) File :1 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/typing.py:309, in _tp_cache..decorator..inner(*args, **kwds) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/typing.py:1673, in Annotated.class_getitem(cls, params) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/typing.py:165, in _type_check(arg, msg, is_argument, module) TypeError: typing.Final[typing.Optional[typing.Literal['image_url']]] is not valid as type argument The above exception was the direct cause of the following exception: TypeError Traceback (most recent call last) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/mistralai/init.py:3 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/mistralai/sdk.py:3 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/mistralai/basesdk.py:3 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/mistralai/sdkconfiguration.py:7 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/mistralai/models/init.py:3 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/mistralai/models/agentscompletionrequest.py:10 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/mistralai/models/usermessage.py:4 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/mistralai/models/contentchunk.py:4 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/mistralai/models/imageurlchunk.py:25 File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py:219, in ModelMetaclass.new(mcs, cls_name, bases, namespace, pydantic_generic_metadata, pydantic_reset_parent_namespace, _create_model_module, **kwargs) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py:508, in set_model_fields(cls, bases, config_wrapper, types_namespace) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/pydantic/_internal/fields.py:105, in collect_model_fields(cls, bases, config_wrapper, types_namespace, typevars_map) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/pydantic/_internal/_typing_extra.py:245, in get_cls_type_hints_lenient(obj, globalns, mro) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/pydantic/_internal/_typing_extra.py:257, in eval_type_lenient(value, globalns, localns) File ~/miniforge3/envs/env-langmodelling/lib/python3.10/site-packages/pydantic/_internal/_typing_extra.py:293, in eval_type_backport(value, globalns, localns, type_params) TypeError: Unable to evaluate type annotation "Annotated[Final[Optional[ImageURLChunkType]], pydantic.Field(alias='type')]"."
|
I was able to resolve this after creating an entirely new environment with `pip freeze`annotated-types==0.7.0 anyio==4.5.0 appnope @ file:///home/conda/feedstock_root/build_artifacts/appnope_1707233003401/work asttokens @ file:///opt/conda/conda-bld/asttokens_1646925590279/work boto3==1.35.23 botocore==1.35.23 certifi==2024.8.30 charset-normalizer==3.3.2 cohere==5.9.2 comm @ file:///home/conda/feedstock_root/build_artifacts/comm_1710320294760/work debugpy @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_563_nwtkoc/croot/debugpy_1690905063850/work decorator @ file:///opt/conda/conda-bld/decorator_1643638310831/work distro==1.9.0 et-xmlfile==1.1.0 eval_type_backport==0.2.0 exceptiongroup @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_b2258scr33/croot/exceptiongroup_1706031391815/work executing @ file:///opt/conda/conda-bld/executing_1646925071911/work fastavro==1.9.7 filelock==3.16.1 fsspec==2024.9.0 h11==0.14.0 httpcore==1.0.5 httpx==0.27.2 httpx-sse==0.4.0 huggingface-hub==0.25.0 idna==3.10 importlib_metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1726082825846/work ipykernel @ file:///Users/runner/miniforge3/conda-bld/ipykernel_1719845458456/work ipython @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_31k34m3e25/croot/ipython_1726064238879/work jedi @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_194648shy3/croot/jedi_1721058355221/work jiter==0.5.0 jmespath==1.0.1 jsonpath-python==1.0.6 jupyter_client @ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1726610684920/work jupyter_core @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_73nomeum4p/croot/jupyter_core_1718818302815/work matplotlib-inline @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_f6fdc0hldi/croots/recipe/matplotlib-inline_1662014472341/work mistralai==1.0.3 mypy-extensions==1.0.0 nest_asyncio @ file:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1705850609492/work onepassword @ git+https://[email protected]/1Password/onepassword-sdk-python.git@713e09f287bdb0661514aab82e5673839dfeb845 openai==1.46.0 openpyxl @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_96hhik4ygv/croot/openpyxl_1721752931204/work packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1718189413536/work parameterized==0.9.0 parso @ file:///opt/conda/conda-bld/parso_1641458642106/work pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work platformdirs @ file:///home/conda/feedstock_root/build_artifacts/platformdirs_1726613481435/work prompt-toolkit @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_c63v4kqjzr/croot/prompt-toolkit_1704404354115/work psutil @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_1310b568-21f4-4cb0-b0e3-2f3d31e39728k9coaga5/croots/recipe/psutil_1656431280844/work ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl pure-eval @ file:///opt/conda/conda-bld/pure_eval_1646925070566/work pydantic==2.8.2 pydantic_core==2.20.1 Pygments @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_29bs9f_dh9/croot/pygments_1684279974747/work python-dateutil==2.9.0.post0 PyYAML==6.0.2 pyzmq @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_43pxpbos3z/croot/pyzmq_1705605108344/work requests==2.32.3 s3transfer==0.10.2 six @ file:///tmp/build/80754af9/six_1644875935023/work sniffio==1.3.1 stack-data @ file:///opt/conda/conda-bld/stack_data_1646927590127/work tokenizers==0.20.0 tornado @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_a4w03z48br/croot/tornado_1718740114858/work tqdm==4.66.5 traitlets @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_500m2_1wyk/croot/traitlets_1718227071952/work types-requests==2.32.0.20240914 typing-inspect==0.9.0 typing_extensions @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_93dg13ilv4/croot/typing_extensions_1715268840722/work urllib3==2.2.3 wcwidth @ file:///Users/ktietz/demo/mc3/conda-bld/wcwidth_1629357192024/work zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1726248574750/work |
If the package isn't compatible with 3.9, thats fine, but the requirements should be raised on the package then |
Thanks for flagging the issue 🙇 |
Hey 👋 |
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]
The text was updated successfully, but these errors were encountered: