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

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
import typing
from .text_node_with_score import TextNodeWithScore
from .page_screenshot_node_with_score import PageScreenshotNodeWithScore
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class RetrieveResults(UniversalBaseModel):
    """
    Schema for the result of an retrieval execution.
    """

    pipeline_id: str = pydantic.Field()
    """
    The ID of the pipeline that the query was retrieved against.
    """

    retrieval_nodes: typing.List[TextNodeWithScore] = pydantic.Field()
    """
    The nodes retrieved by the pipeline for the given query.
    """

    image_nodes: typing.Optional[typing.List[PageScreenshotNodeWithScore]] = pydantic.Field(default=None)
    """
    The image nodes retrieved by the pipeline for the given query.
    """

    retrieval_latency: typing.Optional[typing.Dict[str, float]] = pydantic.Field(default=None)
    """
    The end-to-end latency for retrieval and reranking.
    """

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

    class_name: 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
