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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .individual_search_result import IndividualSearchResult


class SearchSpan(UniversalBaseModel):
    """
    The search portion of the query pipeline. This occurs before any reranking span.
    """

    type: typing.Literal["search"] = "search"
    latency_millis: typing.Optional[int] = pydantic.Field(default=None)
    """
    Time taken in milliseconds.
    """

    started_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Indicates when the span started.
    """

    search_results: typing.Optional[typing.List[IndividualSearchResult]] = pydantic.Field(default=None)
    """
    The search results before reranking.
    """

    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
