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

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


class MaxCharsChunkingStrategy(UniversalBaseModel):
    """
    Sets a chunking strategy that limits the number of maximum characters per chunk.
    The chunks do not cross section boundaries.
    """

    type: typing.Literal["max_chars_chunking_strategy"] = "max_chars_chunking_strategy"
    max_chars_per_chunk: int = pydantic.Field()
    """
    Specifies the maximum number of characters per chunk.
    
    The platform adds sentences to a chunk until the total number of characters exceeds the limit.
    
    If a single sentence exceeds the limit, it splits the sentence across chunks.
    Note: This is the only case where the chunk may not contain a complete sentence.
    """

    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
