yera.models.interfaces.llms.mistral
Interface to Mistral llms.
This module provides the MistralLLM class for interacting with Mistral's
language models. It supports both standard streaming chat completions and
structured output generation via Mistral's native json_schema response
format, which is available across Mistral's current chat completion models
(unlike OpenAI, there is no per-model date cutoff to detect).
Symbols
MistralLLM
BaseLLMInterfaceInterface to Mistral llms.
Provides a wrapper around the Mistral API client. Structured output uses
Mistral's native json_schema response format directly, since Mistral
does not require the model-version-based fallback that OpenAI/Anthropic
need for their older models.
The client is lazily initialised on start() and must be explicitly shut down via stop().
Attributes
The identifier of the Mistral model to use.
Connection configuration including API key.
Lazy-initialised Mistral API client instance.
Methods
MistralLLM.start
start() → NoneInitialise the Mistral API client.
Creates and stores a Mistral client instance using the configured connection settings (API key). This method must be called before making any API requests via the client property.
MistralLLM.stop
stop() → NoneShut down and clear the Mistral API client.
Releases the Mistral client instance by setting it to None. After calling this method, start() must be called again before further API requests can be made.
MistralLLM.chat
chat(
messages: list[Message],
reasoning_level: ReasoningLevel | None = None,
**overrides,
) → Iterator[LLMToken]Stream a chat completion response from Mistral.
Thinking is only produced when reasoning_effort is set to "high" on a model that supports it.
Parameters
The workspace conversation history.
Set the reasoning effort level overriding the default (medium)
Per-call inference parameters.
MistralLLM.make_struct
make_struct(
messages: list[Message],
reasoning_level: ReasoningLevel | None = None,
**overrides,
) → Iterator[LLMToken]Stream a structured output response conforming to a schema.
Parameters
The workspace conversation history.
A pydantic model class defining the output structure.
Set the reasoning effort level overriding the default (off)
Per-call inference parameters.