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 BaseSDK

From Leeroopedia
Knowledge Sources
Domains SDK_Infrastructure, Cloud_Integration
Last Updated 2026-02-15 14:00 GMT

Overview

Concrete tool for building and executing HTTP requests in the Azure variant of the Mistral Python SDK.

Description

The BaseSDK class is the foundational request-handling layer for the mistralai_azure package. Auto-generated by Speakeasy, it encapsulates all HTTP communication logic including URL construction, header management, security credential injection, request body serialization, and response processing. It provides both synchronous (do_request) and asynchronous (do_request_async) execution paths with integrated hook lifecycle support (before_request, after_success, after_error) and configurable retry logic via RetryConfig.

Usage

This class is not imported directly by end users. It serves as the base class for MistralAzure (the top-level Azure SDK client) and the Chat resource class. Understanding its internals is relevant when debugging request failures, implementing custom hooks, or tracing the SDK request lifecycle.

Code Reference

Source Location

Signature

class BaseSDK:
    sdk_configuration: SDKConfiguration
    parent_ref: Optional[object] = None

    def __init__(
        self,
        sdk_config: SDKConfiguration,
        parent_ref: Optional[object] = None,
    ) -> None: ...

    def do_request(
        self,
        hook_ctx,
        request,
        error_status_codes,
        stream=False,
        retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
    ) -> httpx.Response: ...

    async def do_request_async(
        self,
        hook_ctx,
        request,
        error_status_codes,
        stream=False,
        retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
    ) -> httpx.Response: ...

Import

from mistralai_azure.basesdk import BaseSDK

I/O Contract

Inputs

Name Type Required Description
sdk_config SDKConfiguration Yes SDK configuration with client, hooks, and server details
parent_ref Optional[object] No Reference to root SDK instance to prevent garbage collection during streaming
hook_ctx HookContext Yes Context passed through the hook lifecycle
request httpx.Request Yes The built HTTP request to execute
error_status_codes List[str] Yes Status code patterns that indicate errors
stream bool No Whether to stream the response (default False)
retry_config Optional[Tuple[RetryConfig, List[str]]] No Retry configuration and retryable status codes

Outputs

Name Type Description
httpx.Response httpx.Response The HTTP response from the Mistral API

Usage Examples

Internal Usage (how Chat resource uses BaseSDK)

# BaseSDK is used internally by the Chat resource class.
# End users interact with MistralAzure, which inherits from BaseSDK.
from mistralai_azure import MistralAzure

client = MistralAzure(
    azure_api_key="your-api-key",
    azure_endpoint="https://your-endpoint.inference.ai.azure.com"
)

# The chat.complete() method internally calls BaseSDK.do_request()
response = client.chat.complete(
    messages=[{"role": "user", "content": "Hello"}]
)

Related Pages

Page Connections

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