# 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 StreamTextResponse(UniversalBaseModel):
    """
    Contains a fragment of generated text. Note that text fragments may be split at arbitrary points, not necessarily at word or sentence boundaries.
    """

    event_type: typing.Optional[str] = pydantic.Field(default=None)
    """
    This field is always set to `text_generation` for this event.
    """

    text: typing.Optional[str] = pydantic.Field(default=None)
    """
    A fragment of the generated text.
    """

    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
