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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel


class SourceConfigJson(UncheckedBaseModel):
    """
    JSON-serializable source configuration for tool configs.

    This can override existing sources or define entirely new ones.
    For new sources, collection_name is required.
    """

    name: str = pydantic.Field()
    """
    Source name (can be existing or new)
    """

    db_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    MongoDB database name. Default: eleven_customer_support
    """

    collection_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    MongoDB collection name. Required for new sources.
    """

    k_dense: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of chunks from vector search
    """

    k_keyword: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of chunks from BM25 search
    """

    dense_weight: typing.Optional[float] = pydantic.Field(default=None)
    """
    Weight for vector results
    """

    keyword_weight: typing.Optional[float] = pydantic.Field(default=None)
    """
    Weight for BM25 results
    """

    source_weight: typing.Optional[float] = pydantic.Field(default=None)
    """
    Weight for cross-source merging
    """

    vector_index_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Vector search index name. Default: 'default'
    """

    embedding_field: typing.Optional[str] = pydantic.Field(default=None)
    """
    Field containing embeddings. Default: 'embedding'
    """

    content_field: typing.Optional[str] = pydantic.Field(default=None)
    """
    Field containing text content. Default: 'content'
    """

    enabled: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether this source is active
    """

    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
