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

from __future__ import annotations
from ..core.pydantic_utilities import UniversalBaseModel
import typing
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class AdvancedModeTransformConfigChunkingConfig_None(UniversalBaseModel):
    """
    Configuration for the chunking.
    """

    mode: typing.Literal["none"] = "none"

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

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


class AdvancedModeTransformConfigChunkingConfig_Character(UniversalBaseModel):
    """
    Configuration for the chunking.
    """

    mode: typing.Literal["character"] = "character"
    chunk_size: typing.Optional[int] = None
    chunk_overlap: typing.Optional[int] = None

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

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


class AdvancedModeTransformConfigChunkingConfig_Token(UniversalBaseModel):
    """
    Configuration for the chunking.
    """

    mode: typing.Literal["token"] = "token"
    chunk_size: typing.Optional[int] = None
    chunk_overlap: typing.Optional[int] = None
    separator: typing.Optional[str] = None

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

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


class AdvancedModeTransformConfigChunkingConfig_Sentence(UniversalBaseModel):
    """
    Configuration for the chunking.
    """

    mode: typing.Literal["sentence"] = "sentence"
    chunk_size: typing.Optional[int] = None
    chunk_overlap: typing.Optional[int] = None
    separator: typing.Optional[str] = None
    paragraph_separator: typing.Optional[str] = None

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

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


class AdvancedModeTransformConfigChunkingConfig_Semantic(UniversalBaseModel):
    """
    Configuration for the chunking.
    """

    mode: typing.Literal["semantic"] = "semantic"
    buffer_size: typing.Optional[int] = None
    breakpoint_percentile_threshold: typing.Optional[int] = None

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

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


AdvancedModeTransformConfigChunkingConfig = typing.Union[
    AdvancedModeTransformConfigChunkingConfig_None,
    AdvancedModeTransformConfigChunkingConfig_Character,
    AdvancedModeTransformConfigChunkingConfig_Token,
    AdvancedModeTransformConfigChunkingConfig_Sentence,
    AdvancedModeTransformConfigChunkingConfig_Semantic,
]
