# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class SemanticCacheConfig(UniversalBaseModel):
    """
    Semantic Cache Configuration
    """

    type: typing.Literal["semantic"] = "semantic"
    similarity_threshold: float = pydantic.Field()
    """
    Similarity threshold for semantic matching (between 0 and 1)
    """

    namespace: typing.Optional[str] = pydantic.Field(default=None)
    """
    Cache namespace (defaults to 'default' if not provided)
    """

    ttl: float = pydantic.Field(default=3600.0)
    """
    Time-to-live for cached entries in seconds (max 3 days)
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow")  # type: ignore # Pydantic v2
    else:

        class Config:
            smart_union = True
            extra = pydantic.Extra.allow
