Implementation:Mistralai Client python Azure Models Init
| 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
- Repository: Mistralai_Client_python
- File: packages/mistralai_azure/src/mistralai_azure/models/__init__.py
- Lines: 1-467
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?")
]
)