"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .generateresponserequest_retrieval_strategy_contextual_compression import (
    GenerateResponseRequestRetrievalStrategyContextualCompression,
    GenerateResponseRequestRetrievalStrategyContextualCompressionTypedDict,
)
from .generateresponserequest_retrieval_strategy_corrective_retrieval import (
    GenerateResponseRequestRetrievalStrategyCorrectiveRetrieval,
    GenerateResponseRequestRetrievalStrategyCorrectiveRetrievalTypedDict,
)
from duckyai.types import BaseModel
from typing import Optional
from typing_extensions import NotRequired, TypedDict


class GenerateResponseRequestRetrievalStrategyTypedDict(TypedDict):
    r"""Configuration for document retrieval"""

    k: NotRequired[int]
    r"""Number of documents to retrieve"""
    result_type: NotRequired[str]
    r"""The type of result to retrieve (e.g., full, summary, chunk)"""
    rerank: NotRequired[bool]
    contextual_compression: NotRequired[
        GenerateResponseRequestRetrievalStrategyContextualCompressionTypedDict
    ]
    corrective_retrieval: NotRequired[
        GenerateResponseRequestRetrievalStrategyCorrectiveRetrievalTypedDict
    ]
    r"""Enable corrective retrieval with a fallback (e.g., web search)"""


class GenerateResponseRequestRetrievalStrategy(BaseModel):
    r"""Configuration for document retrieval"""

    k: Optional[int] = None
    r"""Number of documents to retrieve"""

    result_type: Optional[str] = None
    r"""The type of result to retrieve (e.g., full, summary, chunk)"""

    rerank: Optional[bool] = None

    contextual_compression: Optional[
        GenerateResponseRequestRetrievalStrategyContextualCompression
    ] = None

    corrective_retrieval: Optional[
        GenerateResponseRequestRetrievalStrategyCorrectiveRetrieval
    ] = None
    r"""Enable corrective retrieval with a fallback (e.g., web search)"""
