# 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 .embedding_model_enum import EmbeddingModelEnum


class RagConfigWorkflowOverride(UncheckedBaseModel):
    enabled: typing.Optional[bool] = None
    embedding_model: typing.Optional[EmbeddingModelEnum] = None
    max_vector_distance: typing.Optional[float] = pydantic.Field(default=None)
    """
    Maximum vector distance of retrieved chunks.
    """

    max_documents_length: typing.Optional[int] = pydantic.Field(default=None)
    """
    Maximum total length of document chunks retrieved from RAG.
    """

    max_retrieved_rag_chunks_count: typing.Optional[int] = pydantic.Field(default=None)
    """
    Maximum number of RAG document chunks to initially retrieve from the vector store. These are then further filtered by vector distance and total length.
    """

    num_candidates: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of candidates evaluated in ANN vector search. Higher number means better results, but higher latency. Minimum recommended value is 100. If disabled, the default value is used.
    """

    query_rewrite_prompt_override: typing.Optional[str] = pydantic.Field(default=None)
    """
    Custom prompt for rewriting user queries before RAG retrieval. The conversation history will be automatically appended at the end. If not set, the default prompt will be used.
    """

    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
