"""LLM abstractions that aren't obstructions.

This module provides a unified interface for interacting with different LLM providers,
including messages, tools, response formatting, and streaming. It allows you to write
code that works with multiple LLM providers without changing your application logic.
"""

# TODO: Across the API, audit docstrings to ensure they are compliant Google-style docstrings
# (Write some tooling to ensure this happens consistently + in CI)

from contextlib import suppress

from . import (
    calls,
    content,
    exceptions,
    formatting,
    messages,
    models,
    prompts,
    providers,
    responses,
    retries,
    tools,
    types,
)

with suppress(ImportError):
    from . import mcp
from .calls import AsyncCall, AsyncContextCall, Call, CallDecorator, ContextCall, call
from .content import (
    AssistantContentChunk,
    AssistantContentPart,
    Audio,
    Base64AudioSource,
    Base64ImageSource,
    Document,
    Image,
    Text,
    TextChunk,
    TextEndChunk,
    TextStartChunk,
    Thought,
    ThoughtChunk,
    ThoughtEndChunk,
    ThoughtStartChunk,
    ToolCall,
    ToolCallChunk,
    ToolCallEndChunk,
    ToolCallStartChunk,
    ToolOutput,
    URLImageSource,
    UserContentPart,
)
from .context import Context, DepsT
from .exceptions import (
    APIError,
    AuthenticationError,
    BadRequestError,
    ConnectionError,
    Error,
    FeatureNotSupportedError,
    MissingAPIKeyError,
    NoRegisteredProviderError,
    NotFoundError,
    ParseError,
    PermissionError,
    ProviderError,
    RateLimitError,
    ResponseValidationError,
    RetriesExhausted,
    ServerError,
    StreamRestarted,
    TimeoutError,
    ToolError,
    ToolExecutionError,
    ToolNotFoundError,
)
from .formatting import (
    Format,
    FormatSpec,
    FormattableT,
    FormattingMode,
    OutputParser,
    Partial,
    format,
    output_parser,
)
from .messages import (
    AssistantContent,
    AssistantMessage,
    Message,
    SystemContent,
    SystemMessage,
    UserContent,
    UserMessage,
)
from .models import (
    Model,
    Params,
    ThinkingConfig,
    ThinkingLevel,
    model,
    model_from_context,
    use_model,
)
from .prompts import (
    AsyncContextPrompt,
    AsyncPrompt,
    ContextPrompt,
    Prompt,
    PromptDecorator,
    prompt,
)
from .providers import (
    ModelId,
    Provider,
    ProviderId,
    register_provider,
    reset_provider_registry,
)
from .responses import (
    AnyResponse,
    AsyncChunkIterator,
    AsyncContextResponse,
    AsyncContextStreamResponse,
    AsyncResponse,
    AsyncStream,
    AsyncStreamResponse,
    AsyncTextStream,
    AsyncThoughtStream,
    AsyncToolCallStream,
    ChunkIterator,
    ContextResponse,
    ContextStreamResponse,
    FinishReason,
    ProviderToolUsage,
    RawMessageChunk,
    Response,
    RootResponse,
    Stream,
    StreamResponse,
    StreamResponseChunk,
    TextStream,
    ThoughtStream,
    ToolCallStream,
    Usage,
    UsageDeltaChunk,
)
from .retries import (
    AsyncContextRetryResponse,
    AsyncContextRetryStreamResponse,
    AsyncRetryCall,
    AsyncRetryPrompt,
    AsyncRetryResponse,
    AsyncRetryStreamResponse,
    ContextRetryResponse,
    ContextRetryStreamResponse,
    RetryCall,
    RetryConfig,
    RetryModel,
    RetryModelParams,
    RetryPrompt,
    RetryResponse,
    RetryStreamResponse,
    retry,
    retry_model,
)
from .tools import (
    AnyToolFn,
    AnyTools,
    AnyToolSchema,
    AsyncContextTool,
    AsyncContextToolkit,
    AsyncContextTools,
    AsyncTool,
    AsyncToolkit,
    AsyncTools,
    BaseToolkit,
    ContextTool,
    ContextToolkit,
    ContextTools,
    ProviderTool,
    Tool,
    Toolkit,
    ToolkitT,
    Tools,
    ToolSchema,
    WebSearchTool,
    tool,
)
from .types import Jsonable

__all__ = [
    "APIError",
    "AnyResponse",
    "AnyToolFn",
    "AnyToolSchema",
    "AnyTools",
    "AssistantContent",
    "AssistantContentChunk",
    "AssistantContentPart",
    "AssistantMessage",
    "AsyncCall",
    "AsyncChunkIterator",
    "AsyncContextCall",
    "AsyncContextPrompt",
    "AsyncContextResponse",
    "AsyncContextRetryResponse",
    "AsyncContextRetryStreamResponse",
    "AsyncContextStreamResponse",
    "AsyncContextTool",
    "AsyncContextToolkit",
    "AsyncContextTools",
    "AsyncPrompt",
    "AsyncResponse",
    "AsyncRetryCall",
    "AsyncRetryPrompt",
    "AsyncRetryResponse",
    "AsyncRetryStreamResponse",
    "AsyncStream",
    "AsyncStreamResponse",
    "AsyncTextStream",
    "AsyncThoughtStream",
    "AsyncTool",
    "AsyncToolCallStream",
    "AsyncToolkit",
    "AsyncTools",
    "Audio",
    "AuthenticationError",
    "BadRequestError",
    "Base64AudioSource",
    "Base64ImageSource",
    "BaseToolkit",
    "Call",
    "CallDecorator",
    "ChunkIterator",
    "ConnectionError",
    "Context",
    "ContextCall",
    "ContextPrompt",
    "ContextResponse",
    "ContextRetryResponse",
    "ContextRetryStreamResponse",
    "ContextStreamResponse",
    "ContextTool",
    "ContextToolkit",
    "ContextTools",
    "DepsT",
    "Document",
    "Error",
    "FeatureNotSupportedError",
    "FinishReason",
    "Format",
    "FormatSpec",
    "FormattableT",
    "FormattingMode",
    "Image",
    "Jsonable",
    "Message",
    "MissingAPIKeyError",
    "Model",
    "ModelId",
    "NoRegisteredProviderError",
    "NotFoundError",
    "OutputParser",
    "Params",
    "ParseError",
    "Partial",
    "PermissionError",
    "Prompt",
    "PromptDecorator",
    "Provider",
    "ProviderError",
    "ProviderId",
    "ProviderTool",
    "ProviderToolUsage",
    "RateLimitError",
    "RawMessageChunk",
    "Response",
    "ResponseValidationError",
    "RetriesExhausted",
    "RetryCall",
    "RetryConfig",
    "RetryModel",
    "RetryModelParams",
    "RetryPrompt",
    "RetryResponse",
    "RetryStreamResponse",
    "RootResponse",
    "ServerError",
    "Stream",
    "StreamResponse",
    "StreamResponseChunk",
    "StreamRestarted",
    "SystemContent",
    "SystemMessage",
    "Text",
    "TextChunk",
    "TextEndChunk",
    "TextStartChunk",
    "TextStream",
    "ThinkingConfig",
    "ThinkingLevel",
    "Thought",
    "ThoughtChunk",
    "ThoughtEndChunk",
    "ThoughtStartChunk",
    "ThoughtStream",
    "TimeoutError",
    "Tool",
    "ToolCall",
    "ToolCallChunk",
    "ToolCallEndChunk",
    "ToolCallStartChunk",
    "ToolCallStream",
    "ToolError",
    "ToolExecutionError",
    "ToolNotFoundError",
    "ToolOutput",
    "ToolSchema",
    "Toolkit",
    "ToolkitT",
    "Tools",
    "URLImageSource",
    "Usage",
    "UsageDeltaChunk",
    "UserContent",
    "UserContentPart",
    "UserMessage",
    "WebSearchTool",
    "WebSearchTool",
    "call",
    "calls",
    "content",
    "exceptions",
    "format",
    "formatting",
    "mcp",
    "messages",
    "model",
    "model_from_context",
    "models",
    "output_parser",
    "prompt",
    "prompts",
    "providers",
    "register_provider",
    "reset_provider_registry",
    "responses",
    "retries",
    "retry",
    "retry_model",
    "tool",
    "tools",
    "types",
    "use_model",
]
