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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .custom_dimensions import CustomDimensions
import pydantic
from .search_semantics import SearchSemantics
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class SearchCorpus(UniversalBaseModel):
    custom_dimensions: typing.Optional[CustomDimensions] = None
    metadata_filter: typing.Optional[str] = pydantic.Field(default=None)
    """
    The filter string to narrow the search to according to metadata attributes. The query against this
    corpus will be confined to document parts that match the `metadata_filter`. Only metadata
    set as `filter_attributes` on the corpus can be filtered. Filter syntax is similiar to
    a SQL where clause. See [metadata filters documentation](https://docs.vectara.com/docs/learn/metadata-search-filtering/filter-overview)
    for more information.
    """

    lexical_interpolation: typing.Optional[float] = pydantic.Field(default=None)
    """
    How much to weigh lexical scores compared to the embedding score. 0 means lexical search is not used at all, and 1 means only lexical search is used.
    """

    semantics: typing.Optional[SearchSemantics] = 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
