Skip to content

[BUG CLIENT]: "from mistralai import Mistral" fails with TypeError #203

Open
@RenatoOtescuRW

Description

@RenatoOtescuRW

Python -VV

Running a script that has only the line from mistralai import Mistral in it fails with typeError:

Traceback (most recent call last):
  File "testOCR.py", line 5, in <module>
    from mistralai import Mistral
  File "/home/renato/.local/lib/python3.8/site-packages/mistralai/__init__.py", line 10, in <module>
    from .sdk import *
  File "/home/renato/.local/lib/python3.8/site-packages/mistralai/sdk.py", line 13, in <module>
    from mistralai.chat import Chat
  File "/home/renato/.local/lib/python3.8/site-packages/mistralai/chat.py", line 12, in <module>
    from mistralai.extra import (
  File "/home/renato/.local/lib/python3.8/site-packages/mistralai/extra/__init__.py", line 1, in <module>
    from .struct_chat import ParsedChatCompletionResponse, convert_to_parsed_chat_completion_response
  File "/home/renato/.local/lib/python3.8/site-packages/mistralai/extra/struct_chat.py", line 2, in <module>
    from .utils.response_format import  CustomPydanticModel, pydantic_model_from_json
  File "/home/renato/.local/lib/python3.8/site-packages/mistralai/extra/utils/__init__.py", line 1, in <module>
    from .response_format import response_format_from_pydantic_model
  File "/home/renato/.local/lib/python3.8/site-packages/mistralai/extra/utils/response_format.py", line 10, in <module>
    model: type[CustomPydanticModel],
TypeError: 'type' object is not subscriptable

Pip Freeze

absl-py==1.4.0
aiohttp==3.8.4
aiosignal==1.3.1
annotated-types==0.7.0
anthropic==0.49.0
anyio==4.5.2
astroid==2.9.3
astunparse==1.6.3
async-timeout==4.0.2
attrs==22.2.0
blobfile==2.0.1
cachetools==5.3.0
certifi==2022.12.7
charset-normalizer==3.0.1
defusedxml==0.7.1
distro==1.9.0
dnspython==2.3.0
eval_type_backport==0.2.2
exceptiongroup==1.2.2
filelock==3.9.0
flatbuffers==23.1.21
frozenlist==1.3.3
gast==0.4.0
google-auth==2.16.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
grpcio==1.51.1
h11==0.14.0
h5py==3.8.0
httpcore==1.0.7
httpx==0.28.1
huggingface-hub==0.12.1
idna==3.4
importlib-metadata==6.0.0
isort==5.10.1
jiter==0.8.2
jsonpath-python==1.0.6
keras==2.11.0
lazy-object-proxy==1.7.1
libclang==15.0.6.1
lxml==4.9.2
Markdown==3.4.1
MarkupSafe==2.1.2
mccabe==0.6.1
mistralai==1.5.1
multidict==6.0.4
mypy-extensions==1.0.0
numpy==1.24.2
nvidia-cublas-cu11==11.10.3.66
nvidia-cuda-nvrtc-cu11==11.7.99
nvidia-cuda-runtime-cu11==11.7.99
nvidia-cudnn-cu11==8.5.0.96
oauthlib==3.2.2
openai==1.65.1
opt-einsum==3.3.0
packaging==23.0
platformdirs==2.4.1
protobuf==3.19.6
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycryptodomex==3.17
pydantic==2.10.6
pydantic_core==2.27.2
pylint==2.12.2
pymongo==4.3.3
python-dateutil==2.9.0.post0
PyYAML==6.0
regex==2022.10.31
requests==2.28.2
requests-oauthlib==1.3.1
rsa==4.9
six==1.16.0
sniffio==1.3.1
tensorboard==2.11.2
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow-estimator==2.11.0
tensorflow-io-gcs-filesystem==0.30.0
termcolor==2.2.0
tiktoken==0.2.0
tokenizers==0.13.2
toml==0.10.2
torch==1.13.1
tqdm==4.64.1
transformers==4.26.1
typing-inspect==0.9.0
typing_extensions==4.12.2
urllib3==1.26.14
Werkzeug==2.2.3
wrapt==1.13.3
yarl==1.8.2
youtube-transcript-api==0.6.3
zipp==3.13.0

Reproduction Steps

  1. create a python script (testScript.py) and write only the line from mistralai import Mistral in it
  2. run the script with the command python3.8 testScript.py

Expected Behavior

Successful import of the mistralai python client

Additional Context

No response

Suggested Solutions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions