# 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
from .merging_strategy import MergingStrategy
from .multi_source_config_json import MultiSourceConfigJson
from .source_config_json import SourceConfigJson


class SearchDocumentationToolConfigOutput(UncheckedBaseModel):
    """
    System tool for searching ElevenLabs documentation using RAG.

    This tool provides access to:
    - Product documentation
    - API references
    - Pricing information
    - Troubleshooting guides
    - Best practices

    It uses a flexible multi-source approach with configurable:
    - Document sources with per-source k for dense/keyword retrieval
    - Merging strategies (RRF, top-K per source, weighted interleave)
    - Query decomposition and reformulation
    - LLM synthesis vs raw chunks
    """

    use_multi_source: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Use the new multi-source retrieval engine
    """

    multi_source_config: typing.Optional[MultiSourceConfigJson] = pydantic.Field(default=None)
    """
    Full multi-source configuration as JSON. Takes precedence over individual fields. Example: {'source_names': ['chunks'], 'use_decomposition': true, 'final_top_k': 5}
    """

    use_decomposition: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Decompose complex queries into sub-queries
    """

    use_reformulation: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Use LLM to reformulate query for better retrieval
    """

    synthesize_response: typing.Optional[bool] = pydantic.Field(default=None)
    """
    True = LLM generates answer, False = return raw chunks
    """

    merging_strategy: typing.Optional[MergingStrategy] = pydantic.Field(default=None)
    """
    Strategy for merging results: 'top_k_per_source' (concatenate), 'rank_fusion' (RRF), 'weighted_interleave'
    """

    final_top_k: typing.Optional[int] = pydantic.Field(default=None)
    """
    Final number of chunks after merging
    """

    source_names: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    List of source names to use (e.g., ['chunks', 'products']). Defaults to both 'products' and 'chunks'. Unknown sources are ignored with a warning.
    """

    source_overrides: typing.Optional[typing.List[SourceConfigJson]] = pydantic.Field(default=None)
    """
    Per-source parameter overrides as JSON. Example: [{'name': 'chunks', 'k_dense': 10, 'k_keyword': 5}]
    """

    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
