Mistral
Provider mistral. Adapter over the official mistralai SDK (not the
OpenAI-compatible path). It gives you Mistral's models through the same LLM(...),
with text, vision, streaming, structured output, function calling, embeddings,
OCR/Document AI and audio transcription (Voxtral).
pip install "jangada-ai[mistral]"provider=:"mistral"- Authentication: the
MISTRAL_API_KEYenvironment variable (orapi_key=in the constructor). - Model: a Mistral id, e.g.
mistral-large-latest,mistral-medium-latest,mistral-small-latest,ministral-8b-latest,codestral-latest,mistral-embed,mistral-ocr-latest,voxtral-mini-latest.
from jangada_ai import LLM
llm = LLM("mistral", "mistral-large-latest")
resp = llm.complete("Summarize {{ topic }} in one sentence.", topic="rafts")
print(resp.text, resp.cost)Configuration via environment
In .env (or process variables):
MISTRAL_API_KEY=...What it does
- Text and streaming via
chat.complete/chat.stream(and async variants). - Structured output (
parse): nativechat.parse(response_format=Model)helper — takes the Pydantic model directly and returnsmessage.parsed. - Tools (
tools=/tool_choice=): OpenAI format;tool_choiceacceptsauto/none/any/requiredor a function name (forces the call). - Vision (
images=): multimodal models (Pixtral/medium/large). - Embeddings (
embed/aembed) withmistral-embed. - OCR / Document AI (
ocr/aocr) withmistral-ocr-latest: PDF/image → per-page markdown, bounding boxes and extracted images. - Transcription (
transcribe/atranscribe) with Voxtral.
# OCR: accepts a URL, path, bytes, an ImagePart or an API `document` dict.
ocr = LLM("mistral", "mistral-ocr-latest")
doc = ocr.ocr("https://arxiv.org/pdf/2310.06825.pdf", include_images=True)
print(len(doc.pages), doc.pages[0].markdown)
# Transcription (Voxtral).
stt = LLM("mistral", "voxtral-mini-latest")
print(stt.transcribe("audio.mp3", language="en").text)Quirks
- Mistral uses
random_seed(jangada maps the canonicalseed) and has notop_k(dropped). Streaming deltas come inevent.data.choices[0].delta.content. - Server-side MCP is not supported here — use the client-side
MCPClientor the Anthropic/OpenAI/Groq providers for remote MCP by URL.
See Providers and Capabilities matrix.
What changed in 1.9.0
- Native tools via the Conversations API:
web_search()(orweb_search(premium=True)),code_execution(),image_generation()andfile_search(stores=[...])(document library) route the call throughbeta.conversations. User function tools work alongside; with native tools,streamandparseare not supported. Withparams={"store": True}, the next turn continues the conversation server-side. See Native tools. - Batched embeddings: large lists are split into several requests.
- An empty response becomes
ServerError; tool arguments with invalid JSON are kept inmetadata["raw_arguments"].
Gemini
Provider gemini. Adapter over the google-genai SDK. It has a single Client; the async one lives in client.aio.
OpenRouter
Provider openrouter. A gateway to hundreds of models (OpenAI, Anthropic, Google, Meta...) speaking the OpenAI chat.completions dialect — reuses the openai SDK pointed at OpenRouter's base_url.