Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Mistralai Client python Azure Models Init

From Leeroopedia
Revision as of 13:15, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Mistralai_Client_python_Azure_Models_Init.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains SDK_Infrastructure, Cloud_Integration
Last Updated 2026-02-15 14:00 GMT

Overview

Concrete tool for lazy-loading all model types in the Azure variant of the Mistral Python SDK.

Description

The models/__init__.py module serves as the public namespace for all data models in the mistralai_azure package. Auto-generated by Speakeasy, it uses Python's __getattr__ protocol to implement lazy dynamic imports, loading model classes only when first accessed. This avoids importing the entire model graph at startup. It exports 134 symbols covering message types (UserMessage, AssistantMessage, SystemMessage, ToolMessage), request/response models (ChatCompletionRequest, ChatCompletionResponse), OCR types, error classes (MistralAzureError, SDKError), and type aliases.

Usage

Import individual model classes from mistralai_azure.models when constructing requests, processing responses, or handling errors in Azure-specific Mistral API interactions.

Code Reference

Source Location

Signature

# Module-level lazy loading via __getattr__
def __getattr__(attr_name: str) -> object: ...
def __dir__() -> list: ...

# Key exported symbols include:
# ChatCompletionRequest, ChatCompletionResponse, ChatCompletionStreamRequest
# AssistantMessage, UserMessage, SystemMessage, ToolMessage
# OCRRequest, OCRResponse, MistralAzureError, SDKError
# Tool, ToolCall, ToolChoice, FunctionCall, etc.

Import

from mistralai_azure.models import ChatCompletionRequest, UserMessage, AssistantMessage
from mistralai_azure.models import OCRRequest, OCRResponse
from mistralai_azure.models import MistralAzureError, SDKError

I/O Contract

Inputs

Name Type Required Description
attr_name str Yes The name of the model class to import (via __getattr__)

Outputs

Name Type Description
Model class type The requested Pydantic model class, enum, or type alias

Usage Examples

Importing Azure Models

from mistralai_azure.models import (
    ChatCompletionRequest,
    ChatCompletionResponse,
    UserMessage,
    SystemMessage,
    AssistantMessage,
    ToolMessage,
)

# Models are loaded lazily - only imported when accessed
request = ChatCompletionRequest(
    messages=[
        UserMessage(content="What is the capital of France?")
    ]
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment