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

from __future__ import annotations
from .anthropiccachecontroldirective import (
    AnthropicCacheControlDirective,
    AnthropicCacheControlDirectiveTypedDict,
)
from .anthropictextblockparam import (
    AnthropicTextBlockParam,
    AnthropicTextBlockParamTypedDict,
)
from openrouter.types import BaseModel
from typing import List, Literal, Optional
from typing_extensions import NotRequired, TypedDict


class AnthropicSearchResultBlockParamCitationsTypedDict(TypedDict):
    enabled: NotRequired[bool]


class AnthropicSearchResultBlockParamCitations(BaseModel):
    enabled: Optional[bool] = None


AnthropicSearchResultBlockParamType = Literal["search_result",]


class AnthropicSearchResultBlockParamTypedDict(TypedDict):
    content: List[AnthropicTextBlockParamTypedDict]
    source: str
    title: str
    type: AnthropicSearchResultBlockParamType
    cache_control: NotRequired[AnthropicCacheControlDirectiveTypedDict]
    r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""
    citations: NotRequired[AnthropicSearchResultBlockParamCitationsTypedDict]


class AnthropicSearchResultBlockParam(BaseModel):
    content: List[AnthropicTextBlockParam]

    source: str

    title: str

    type: AnthropicSearchResultBlockParamType

    cache_control: Optional[AnthropicCacheControlDirective] = None
    r"""Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models."""

    citations: Optional[AnthropicSearchResultBlockParamCitations] = None
