You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ImportError: Could not import module aisuite.providers.mistral_provider: No module named 'mistralai'. Please ensure the provider is supported by doing ProviderFactory.get_supported_providers()
#132
Open
zhimin-z opened this issue
Dec 5, 2024
· 2 comments
import aisuite as ai
client = ai.Client()
models = ["mistral:mistral-large-latest"]
messages = [
{"role": "system", "content": "Respond in Pirate English."},
{"role": "user", "content": "Tell me a joke."},
]
for model in models:
response = client.chat.completions.create(
model=model,
messages=messages,
temperature=0.75
)
print(response.choices[0].message.content)
It throws the above error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
File ~/Documents/GitHub/SE-Arena/.venv/lib/python3.12/site-packages/aisuite/provider.py:38, in ProviderFactory.create_provider(cls, provider_key, config)
[37](https://file+.vscode-resource.vscode-cdn.net/Users/jimmy/Documents/GitHub/SE-Arena/~/Documents/GitHub/SE-Arena/.venv/lib/python3.12/site-packages/aisuite/provider.py:37) try:
---> [38](https://file+.vscode-resource.vscode-cdn.net/Users/jimmy/Documents/GitHub/SE-Arena/~/Documents/GitHub/SE-Arena/.venv/lib/python3.12/site-packages/aisuite/provider.py:38) module = importlib.import_module(module_path)
[39](https://file+.vscode-resource.vscode-cdn.net/Users/jimmy/Documents/GitHub/SE-Arena/~/Documents/GitHub/SE-Arena/.venv/lib/python3.12/site-packages/aisuite/provider.py:39) except ImportError as e:
File /opt/homebrew/Cellar/[email protected]/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py:90, in import_module(name, package)
[89](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Cellar/[email protected]/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py:89) level += 1
---> [90](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Cellar/[email protected]/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py:90) return _bootstrap._gcd_import(name[level:], package, level)
File <frozen importlib._bootstrap>:1387, in _gcd_import(name, package, level)
File <frozen importlib._bootstrap>:1360, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:1331, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:935, in _load_unlocked(spec)
File <frozen importlib._bootstrap_external>:995, in exec_module(self, module)
File <frozen importlib._bootstrap>:488, in _call_with_frames_removed(f, *args, **kwds)
File ~/Documents/GitHub/SE-Arena/.venv/lib/python3.12/site-packages/aisuite/providers/mistral_provider.py:3
[1](https://file+.vscode-resource.vscode-cdn.net/Users/jimmy/Documents/GitHub/SE-Arena/~/Documents/GitHub/SE-Arena/.venv/lib/python3.12/site-packages/aisuite/providers/mistral_provider.py:1) import os
...
[42](https://file+.vscode-resource.vscode-cdn.net/Users/jimmy/Documents/GitHub/SE-Arena/~/Documents/GitHub/SE-Arena/.venv/lib/python3.12/site-packages/aisuite/provider.py:42) )
[44](https://file+.vscode-resource.vscode-cdn.net/Users/jimmy/Documents/GitHub/SE-Arena/~/Documents/GitHub/SE-Arena/.venv/lib/python3.12/site-packages/aisuite/provider.py:44) # Instantiate the provider class
[45](https://file+.vscode-resource.vscode-cdn.net/Users/jimmy/Documents/GitHub/SE-Arena/~/Documents/GitHub/SE-Arena/.venv/lib/python3.12/site-packages/aisuite/provider.py:45) provider_class = getattr(module, provider_class_name)
ImportError: Could not import module aisuite.providers.mistral_provider: No module named 'mistralai'. Please ensure the provider is supported by doing ProviderFactory.get_supported_providers()
@zhimin-z With the base install pip install aisuite the library does not come with the various python client SDKs. You can do pip install aisuite[mistralai] if you want only mistral or pip install aisuite[all] to install all the provider SDKs.
@zhimin-z With the base install pip install aisuite the library does not come with the various python client SDKs. You can do pip install aisuite[mistralai] if you want only mistral or pip install aisuite[all] to install all the provider SDKs.
Thanks, but I am pretty sure that I have installed aisuite[all], but it still throws the above error. Only if I install aisuite[mistralai] directly could this error not occur. Does that mean mistral is a plugin not included in the complete package? @ksolo
When I attempt with mistral model as follows:
It throws the above error:
@ksolo @jeffxtang @joaomdmoura @methanet
The text was updated successfully, but these errors were encountered: