"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from .mistralazureerror import MistralAzureError
from typing import TYPE_CHECKING
from importlib import import_module
import builtins
import sys

if TYPE_CHECKING:
    from .assistantmessage import (
        AssistantMessage,
        AssistantMessageContent,
        AssistantMessageContentTypedDict,
        AssistantMessageRole,
        AssistantMessageTypedDict,
    )
    from .chatcompletionchoice import (
        ChatCompletionChoice,
        ChatCompletionChoiceFinishReason,
        ChatCompletionChoiceTypedDict,
    )
    from .chatcompletionrequest import (
        ChatCompletionRequest,
        ChatCompletionRequestMessages,
        ChatCompletionRequestMessagesTypedDict,
        ChatCompletionRequestStop,
        ChatCompletionRequestStopTypedDict,
        ChatCompletionRequestToolChoice,
        ChatCompletionRequestToolChoiceTypedDict,
        ChatCompletionRequestTypedDict,
    )
    from .chatcompletionresponse import (
        ChatCompletionResponse,
        ChatCompletionResponseTypedDict,
    )
    from .chatcompletionstreamrequest import (
        ChatCompletionStreamRequest,
        ChatCompletionStreamRequestToolChoice,
        ChatCompletionStreamRequestToolChoiceTypedDict,
        ChatCompletionStreamRequestTypedDict,
        Messages,
        MessagesTypedDict,
        Stop,
        StopTypedDict,
    )
    from .completionchunk import CompletionChunk, CompletionChunkTypedDict
    from .completionevent import CompletionEvent, CompletionEventTypedDict
    from .completionresponsestreamchoice import (
        CompletionResponseStreamChoice,
        CompletionResponseStreamChoiceTypedDict,
        FinishReason,
    )
    from .contentchunk import ContentChunk, ContentChunkTypedDict
    from .deltamessage import (
        Content,
        ContentTypedDict,
        DeltaMessage,
        DeltaMessageTypedDict,
    )
    from .documenturlchunk import (
        DocumentURLChunk,
        DocumentURLChunkType,
        DocumentURLChunkTypedDict,
    )
    from .filechunk import FileChunk, FileChunkTypedDict
    from .function import Function, FunctionTypedDict
    from .functioncall import (
        Arguments,
        ArgumentsTypedDict,
        FunctionCall,
        FunctionCallTypedDict,
    )
    from .functionname import FunctionName, FunctionNameTypedDict
    from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
    from .imageurl import ImageURL, ImageURLTypedDict
    from .imageurlchunk import (
        ImageURLChunk,
        ImageURLChunkImageURL,
        ImageURLChunkImageURLTypedDict,
        ImageURLChunkType,
        ImageURLChunkTypedDict,
    )
    from .jsonschema import JSONSchema, JSONSchemaTypedDict
    from .mistralpromptmode import MistralPromptMode
    from .no_response_error import NoResponseError
    from .ocrimageobject import OCRImageObject, OCRImageObjectTypedDict
    from .ocrpagedimensions import OCRPageDimensions, OCRPageDimensionsTypedDict
    from .ocrpageobject import OCRPageObject, OCRPageObjectTypedDict
    from .ocrrequest import (
        Document,
        DocumentTypedDict,
        OCRRequest,
        OCRRequestTypedDict,
        TableFormat,
    )
    from .ocrresponse import OCRResponse, OCRResponseTypedDict
    from .ocrtableobject import Format, OCRTableObject, OCRTableObjectTypedDict
    from .ocrusageinfo import OCRUsageInfo, OCRUsageInfoTypedDict
    from .prediction import Prediction, PredictionTypedDict
    from .referencechunk import (
        ReferenceChunk,
        ReferenceChunkType,
        ReferenceChunkTypedDict,
    )
    from .responseformat import ResponseFormat, ResponseFormatTypedDict
    from .responseformats import ResponseFormats
    from .responsevalidationerror import ResponseValidationError
    from .sdkerror import SDKError
    from .security import Security, SecurityTypedDict
    from .systemmessage import (
        Role,
        SystemMessage,
        SystemMessageContent,
        SystemMessageContentTypedDict,
        SystemMessageTypedDict,
    )
    from .systemmessagecontentchunks import (
        SystemMessageContentChunks,
        SystemMessageContentChunksTypedDict,
    )
    from .textchunk import TextChunk, TextChunkTypedDict, Type
    from .thinkchunk import (
        ThinkChunk,
        ThinkChunkType,
        ThinkChunkTypedDict,
        Thinking,
        ThinkingTypedDict,
    )
    from .tool import Tool, ToolTypedDict
    from .toolcall import ToolCall, ToolCallTypedDict
    from .toolchoice import ToolChoice, ToolChoiceTypedDict
    from .toolchoiceenum import ToolChoiceEnum
    from .toolmessage import (
        ToolMessage,
        ToolMessageContent,
        ToolMessageContentTypedDict,
        ToolMessageRole,
        ToolMessageTypedDict,
    )
    from .tooltypes import ToolTypes
    from .usageinfo import UsageInfo, UsageInfoTypedDict
    from .usermessage import (
        UserMessage,
        UserMessageContent,
        UserMessageContentTypedDict,
        UserMessageRole,
        UserMessageTypedDict,
    )
    from .validationerror import (
        Loc,
        LocTypedDict,
        ValidationError,
        ValidationErrorTypedDict,
    )

__all__ = [
    "Arguments",
    "ArgumentsTypedDict",
    "AssistantMessage",
    "AssistantMessageContent",
    "AssistantMessageContentTypedDict",
    "AssistantMessageRole",
    "AssistantMessageTypedDict",
    "ChatCompletionChoice",
    "ChatCompletionChoiceFinishReason",
    "ChatCompletionChoiceTypedDict",
    "ChatCompletionRequest",
    "ChatCompletionRequestMessages",
    "ChatCompletionRequestMessagesTypedDict",
    "ChatCompletionRequestStop",
    "ChatCompletionRequestStopTypedDict",
    "ChatCompletionRequestToolChoice",
    "ChatCompletionRequestToolChoiceTypedDict",
    "ChatCompletionRequestTypedDict",
    "ChatCompletionResponse",
    "ChatCompletionResponseTypedDict",
    "ChatCompletionStreamRequest",
    "ChatCompletionStreamRequestToolChoice",
    "ChatCompletionStreamRequestToolChoiceTypedDict",
    "ChatCompletionStreamRequestTypedDict",
    "CompletionChunk",
    "CompletionChunkTypedDict",
    "CompletionEvent",
    "CompletionEventTypedDict",
    "CompletionResponseStreamChoice",
    "CompletionResponseStreamChoiceTypedDict",
    "Content",
    "ContentChunk",
    "ContentChunkTypedDict",
    "ContentTypedDict",
    "DeltaMessage",
    "DeltaMessageTypedDict",
    "Document",
    "DocumentTypedDict",
    "DocumentURLChunk",
    "DocumentURLChunkType",
    "DocumentURLChunkTypedDict",
    "FileChunk",
    "FileChunkTypedDict",
    "FinishReason",
    "Format",
    "Function",
    "FunctionCall",
    "FunctionCallTypedDict",
    "FunctionName",
    "FunctionNameTypedDict",
    "FunctionTypedDict",
    "HTTPValidationError",
    "HTTPValidationErrorData",
    "ImageURL",
    "ImageURLChunk",
    "ImageURLChunkImageURL",
    "ImageURLChunkImageURLTypedDict",
    "ImageURLChunkType",
    "ImageURLChunkTypedDict",
    "ImageURLTypedDict",
    "JSONSchema",
    "JSONSchemaTypedDict",
    "Loc",
    "LocTypedDict",
    "Messages",
    "MessagesTypedDict",
    "MistralAzureError",
    "MistralPromptMode",
    "NoResponseError",
    "OCRImageObject",
    "OCRImageObjectTypedDict",
    "OCRPageDimensions",
    "OCRPageDimensionsTypedDict",
    "OCRPageObject",
    "OCRPageObjectTypedDict",
    "OCRRequest",
    "OCRRequestTypedDict",
    "OCRResponse",
    "OCRResponseTypedDict",
    "OCRTableObject",
    "OCRTableObjectTypedDict",
    "OCRUsageInfo",
    "OCRUsageInfoTypedDict",
    "Prediction",
    "PredictionTypedDict",
    "ReferenceChunk",
    "ReferenceChunkType",
    "ReferenceChunkTypedDict",
    "ResponseFormat",
    "ResponseFormatTypedDict",
    "ResponseFormats",
    "ResponseValidationError",
    "Role",
    "SDKError",
    "Security",
    "SecurityTypedDict",
    "Stop",
    "StopTypedDict",
    "SystemMessage",
    "SystemMessageContent",
    "SystemMessageContentChunks",
    "SystemMessageContentChunksTypedDict",
    "SystemMessageContentTypedDict",
    "SystemMessageTypedDict",
    "TableFormat",
    "TextChunk",
    "TextChunkTypedDict",
    "ThinkChunk",
    "ThinkChunkType",
    "ThinkChunkTypedDict",
    "Thinking",
    "ThinkingTypedDict",
    "Tool",
    "ToolCall",
    "ToolCallTypedDict",
    "ToolChoice",
    "ToolChoiceEnum",
    "ToolChoiceTypedDict",
    "ToolMessage",
    "ToolMessageContent",
    "ToolMessageContentTypedDict",
    "ToolMessageRole",
    "ToolMessageTypedDict",
    "ToolTypedDict",
    "ToolTypes",
    "Type",
    "UsageInfo",
    "UsageInfoTypedDict",
    "UserMessage",
    "UserMessageContent",
    "UserMessageContentTypedDict",
    "UserMessageRole",
    "UserMessageTypedDict",
    "ValidationError",
    "ValidationErrorTypedDict",
]

_dynamic_imports: dict[str, str] = {
    "AssistantMessage": ".assistantmessage",
    "AssistantMessageContent": ".assistantmessage",
    "AssistantMessageContentTypedDict": ".assistantmessage",
    "AssistantMessageRole": ".assistantmessage",
    "AssistantMessageTypedDict": ".assistantmessage",
    "ChatCompletionChoice": ".chatcompletionchoice",
    "ChatCompletionChoiceFinishReason": ".chatcompletionchoice",
    "ChatCompletionChoiceTypedDict": ".chatcompletionchoice",
    "ChatCompletionRequest": ".chatcompletionrequest",
    "ChatCompletionRequestMessages": ".chatcompletionrequest",
    "ChatCompletionRequestMessagesTypedDict": ".chatcompletionrequest",
    "ChatCompletionRequestStop": ".chatcompletionrequest",
    "ChatCompletionRequestStopTypedDict": ".chatcompletionrequest",
    "ChatCompletionRequestToolChoice": ".chatcompletionrequest",
    "ChatCompletionRequestToolChoiceTypedDict": ".chatcompletionrequest",
    "ChatCompletionRequestTypedDict": ".chatcompletionrequest",
    "ChatCompletionResponse": ".chatcompletionresponse",
    "ChatCompletionResponseTypedDict": ".chatcompletionresponse",
    "ChatCompletionStreamRequest": ".chatcompletionstreamrequest",
    "ChatCompletionStreamRequestToolChoice": ".chatcompletionstreamrequest",
    "ChatCompletionStreamRequestToolChoiceTypedDict": ".chatcompletionstreamrequest",
    "ChatCompletionStreamRequestTypedDict": ".chatcompletionstreamrequest",
    "Messages": ".chatcompletionstreamrequest",
    "MessagesTypedDict": ".chatcompletionstreamrequest",
    "Stop": ".chatcompletionstreamrequest",
    "StopTypedDict": ".chatcompletionstreamrequest",
    "CompletionChunk": ".completionchunk",
    "CompletionChunkTypedDict": ".completionchunk",
    "CompletionEvent": ".completionevent",
    "CompletionEventTypedDict": ".completionevent",
    "CompletionResponseStreamChoice": ".completionresponsestreamchoice",
    "CompletionResponseStreamChoiceTypedDict": ".completionresponsestreamchoice",
    "FinishReason": ".completionresponsestreamchoice",
    "ContentChunk": ".contentchunk",
    "ContentChunkTypedDict": ".contentchunk",
    "Content": ".deltamessage",
    "ContentTypedDict": ".deltamessage",
    "DeltaMessage": ".deltamessage",
    "DeltaMessageTypedDict": ".deltamessage",
    "DocumentURLChunk": ".documenturlchunk",
    "DocumentURLChunkType": ".documenturlchunk",
    "DocumentURLChunkTypedDict": ".documenturlchunk",
    "FileChunk": ".filechunk",
    "FileChunkTypedDict": ".filechunk",
    "Function": ".function",
    "FunctionTypedDict": ".function",
    "Arguments": ".functioncall",
    "ArgumentsTypedDict": ".functioncall",
    "FunctionCall": ".functioncall",
    "FunctionCallTypedDict": ".functioncall",
    "FunctionName": ".functionname",
    "FunctionNameTypedDict": ".functionname",
    "HTTPValidationError": ".httpvalidationerror",
    "HTTPValidationErrorData": ".httpvalidationerror",
    "ImageURL": ".imageurl",
    "ImageURLTypedDict": ".imageurl",
    "ImageURLChunk": ".imageurlchunk",
    "ImageURLChunkImageURL": ".imageurlchunk",
    "ImageURLChunkImageURLTypedDict": ".imageurlchunk",
    "ImageURLChunkType": ".imageurlchunk",
    "ImageURLChunkTypedDict": ".imageurlchunk",
    "JSONSchema": ".jsonschema",
    "JSONSchemaTypedDict": ".jsonschema",
    "MistralPromptMode": ".mistralpromptmode",
    "NoResponseError": ".no_response_error",
    "OCRImageObject": ".ocrimageobject",
    "OCRImageObjectTypedDict": ".ocrimageobject",
    "OCRPageDimensions": ".ocrpagedimensions",
    "OCRPageDimensionsTypedDict": ".ocrpagedimensions",
    "OCRPageObject": ".ocrpageobject",
    "OCRPageObjectTypedDict": ".ocrpageobject",
    "Document": ".ocrrequest",
    "DocumentTypedDict": ".ocrrequest",
    "OCRRequest": ".ocrrequest",
    "OCRRequestTypedDict": ".ocrrequest",
    "TableFormat": ".ocrrequest",
    "OCRResponse": ".ocrresponse",
    "OCRResponseTypedDict": ".ocrresponse",
    "Format": ".ocrtableobject",
    "OCRTableObject": ".ocrtableobject",
    "OCRTableObjectTypedDict": ".ocrtableobject",
    "OCRUsageInfo": ".ocrusageinfo",
    "OCRUsageInfoTypedDict": ".ocrusageinfo",
    "Prediction": ".prediction",
    "PredictionTypedDict": ".prediction",
    "ReferenceChunk": ".referencechunk",
    "ReferenceChunkType": ".referencechunk",
    "ReferenceChunkTypedDict": ".referencechunk",
    "ResponseFormat": ".responseformat",
    "ResponseFormatTypedDict": ".responseformat",
    "ResponseFormats": ".responseformats",
    "ResponseValidationError": ".responsevalidationerror",
    "SDKError": ".sdkerror",
    "Security": ".security",
    "SecurityTypedDict": ".security",
    "Role": ".systemmessage",
    "SystemMessage": ".systemmessage",
    "SystemMessageContent": ".systemmessage",
    "SystemMessageContentTypedDict": ".systemmessage",
    "SystemMessageTypedDict": ".systemmessage",
    "SystemMessageContentChunks": ".systemmessagecontentchunks",
    "SystemMessageContentChunksTypedDict": ".systemmessagecontentchunks",
    "TextChunk": ".textchunk",
    "TextChunkTypedDict": ".textchunk",
    "Type": ".textchunk",
    "ThinkChunk": ".thinkchunk",
    "ThinkChunkType": ".thinkchunk",
    "ThinkChunkTypedDict": ".thinkchunk",
    "Thinking": ".thinkchunk",
    "ThinkingTypedDict": ".thinkchunk",
    "Tool": ".tool",
    "ToolTypedDict": ".tool",
    "ToolCall": ".toolcall",
    "ToolCallTypedDict": ".toolcall",
    "ToolChoice": ".toolchoice",
    "ToolChoiceTypedDict": ".toolchoice",
    "ToolChoiceEnum": ".toolchoiceenum",
    "ToolMessage": ".toolmessage",
    "ToolMessageContent": ".toolmessage",
    "ToolMessageContentTypedDict": ".toolmessage",
    "ToolMessageRole": ".toolmessage",
    "ToolMessageTypedDict": ".toolmessage",
    "ToolTypes": ".tooltypes",
    "UsageInfo": ".usageinfo",
    "UsageInfoTypedDict": ".usageinfo",
    "UserMessage": ".usermessage",
    "UserMessageContent": ".usermessage",
    "UserMessageContentTypedDict": ".usermessage",
    "UserMessageRole": ".usermessage",
    "UserMessageTypedDict": ".usermessage",
    "Loc": ".validationerror",
    "LocTypedDict": ".validationerror",
    "ValidationError": ".validationerror",
    "ValidationErrorTypedDict": ".validationerror",
}


def dynamic_import(modname, retries=3):
    for attempt in range(retries):
        try:
            return import_module(modname, __package__)
        except KeyError:
            # Clear any half-initialized module and retry
            sys.modules.pop(modname, None)
            if attempt == retries - 1:
                break
    raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")


def __getattr__(attr_name: str) -> object:
    module_name = _dynamic_imports.get(attr_name)
    if module_name is None:
        raise AttributeError(
            f"No {attr_name} found in _dynamic_imports for module name -> {__name__} "
        )

    try:
        module = dynamic_import(module_name)
        result = getattr(module, attr_name)
        return result
    except ImportError as e:
        raise ImportError(
            f"Failed to import {attr_name} from {module_name}: {e}"
        ) from e
    except AttributeError as e:
        raise AttributeError(
            f"Failed to get {attr_name} from {module_name}: {e}"
        ) from e


def __dir__():
    lazy_attrs = builtins.list(_dynamic_imports.keys())
    return builtins.sorted(lazy_attrs)
