Repository navigation
fix(mistral): support both the 1.x and the 2.x+ client layouts - #12
Merged
Jeomon merged 1 commit intoOct 27, 2026
Merged
Conversation
The two generations of the mistralai client have mutually exclusive import paths for the same class: | import | 1.9.11 | 3.3.0 | | ---------------------------------- | ------ | ----- | | `from mistralai import Mistral` | ok | error | | `from mistralai.client import ...` | error | ok | | `from mistralai.sdk import ...` | ok | error | 1.9.11 keeps a deprecated stub in `mistralai.client` and exports the client from the top level. 2.x dropped the top level package and moved the client into `mistralai.client`. main used the 2.x path, which breaks against the version pinned in uv.lock and fails the test job with "cannot import name 'Mistral' from 'mistralai.client'". The released 0.8.1 used the 1.x path, which breaks for anyone who installs a current mistralai. Try the new location first and fall back to the old one, so the provider works on both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The two generations of the
mistralaiclient have mutually exclusive import paths for the same class:from mistralai import Mistralfrom mistralai.client import Mistralfrom mistralai.sdk import Mistralmistralai1.9.11 keeps a deprecated stub inmistralai.clientand exports the client from the top level. 2.x dropped the top level package and moved the client intomistralai.client.maincurrently uses the 2.x path, which breaks against the version pinned inuv.lockand fails the test job:The released 0.8.1 uses the 1.x path, which breaks for anyone who installs a current
mistralaiinstead of the pinned one.This tries the new location first and falls back to the old one, so the provider imports on both.
Because
windows_use/providers/__init__.pyimports every provider eagerly, a broken import here takes downimport windows_usecompletely - hence the regression test.Testing
uv run pytest tests/unit/ -v --tb=short- 109 passed, 5 skipped (was 7 collection errors)import windows_useverified againstmistralai1.9.11 and 3.3.0Related
This is the code half of #11. The other half is a release: the published 0.8.1 still carries the 1.x import, so
pip install windows-usestays broken until a new version is cut.