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

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


class CompositeRetrievedTextNode(UniversalBaseModel):
    id: str = pydantic.Field()
    """
    The ID of the retrieved node.
    """

    retriever_id: str = pydantic.Field()
    """
    The ID of the retriever this node was retrieved from.
    """

    retriever_pipeline_name: str = pydantic.Field()
    """
    The name of the retrieval pipeline this node was retrieved from.
    """

    pipeline_id: str = pydantic.Field()
    """
    The ID of the pipeline this node was retrieved from.
    """

    metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Metadata associated with the retrieved node.
    """

    text: str = pydantic.Field()
    """
    The text of the retrieved node.
    """

    start_char_idx: typing.Optional[int] = pydantic.Field(default=None)
    """
    The start character index of the retrieved node in the document
    """

    end_char_idx: typing.Optional[int] = pydantic.Field(default=None)
    """
    The end character index of the retrieved node in the document
    """

    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
