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

from __future__ import annotations
from .evaluationconfig import EvaluationConfig, EvaluationConfigTypedDict
from opperai.types import BaseModel
import pydantic
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class FunctionCallConfigurationTypedDict(TypedDict):
    invocation_few_shot_count: NotRequired[int]
    r"""The number of few-shot examples to use for the call. The examples are selected using nearest neighbor search of the function's dataset for items that are similar to the input."""
    beta_evaluation_enabled: NotRequired[bool]
    r"""[Deprecated] Use 'beta.evaluation' object. Whether to enable evaluation for the call. Evaluation is a beta feature and is enabled by default."""
    beta_evaluation: NotRequired[EvaluationConfigTypedDict]
    r"""Configuration for evaluation features stored under 'beta.evaluation'.

    - enabled: master switch
    - scorers: which evaluators to run. Accepts:
    - string: \"base\" | \"rubrics\" 
    - dict: { \"rubrics\": RubricDefinition-like payload }
    - list[str | dict]
    \"base\" is the default scorer.
    """
    invocation_structured_generation_max_attempts: NotRequired[int]
    r"""The maximum number of attempts to make when generating a response matching the output schema if provided."""
    invocation_cache_ttl: NotRequired[int]
    r"""The time to live for the cache in seconds. If 0, the cache is disabled."""
    beta_invocation_input_validation_enabled: NotRequired[bool]
    r"""Whether to enable input validation against the input schema. This is a beta feature and is disabled by default."""
    beta_invocation_xml_mode_enabled: NotRequired[bool]
    r"""Experimental: enable XML structured output. The model receives an XML schema and its response is converted back to JSON. We have observed better adherence to multi-paragraph text fields (especially with Anthropic models) when this is enabled."""


class FunctionCallConfiguration(BaseModel):
    invocation_few_shot_count: Annotated[
        Optional[int], pydantic.Field(alias="invocation.few_shot.count")
    ] = 0
    r"""The number of few-shot examples to use for the call. The examples are selected using nearest neighbor search of the function's dataset for items that are similar to the input."""

    beta_evaluation_enabled: Annotated[
        Optional[bool], pydantic.Field(alias="beta.evaluation.enabled")
    ] = True
    r"""[Deprecated] Use 'beta.evaluation' object. Whether to enable evaluation for the call. Evaluation is a beta feature and is enabled by default."""

    beta_evaluation: Annotated[
        Optional[EvaluationConfig], pydantic.Field(alias="beta.evaluation")
    ] = None
    r"""Configuration for evaluation features stored under 'beta.evaluation'.

    - enabled: master switch
    - scorers: which evaluators to run. Accepts:
    - string: \"base\" | \"rubrics\" 
    - dict: { \"rubrics\": RubricDefinition-like payload }
    - list[str | dict]
    \"base\" is the default scorer.
    """

    invocation_structured_generation_max_attempts: Annotated[
        Optional[int],
        pydantic.Field(alias="invocation.structured_generation.max_attempts"),
    ] = 5
    r"""The maximum number of attempts to make when generating a response matching the output schema if provided."""

    invocation_cache_ttl: Annotated[
        Optional[int], pydantic.Field(alias="invocation.cache.ttl")
    ] = 0
    r"""The time to live for the cache in seconds. If 0, the cache is disabled."""

    beta_invocation_input_validation_enabled: Annotated[
        Optional[bool], pydantic.Field(alias="beta.invocation.input_validation.enabled")
    ] = False
    r"""Whether to enable input validation against the input schema. This is a beta feature and is disabled by default."""

    beta_invocation_xml_mode_enabled: Annotated[
        Optional[bool], pydantic.Field(alias="beta.invocation.xml_mode.enabled")
    ] = False
    r"""Experimental: enable XML structured output. The model receives an XML schema and its response is converted back to JSON. We have observed better adherence to multi-paragraph text fields (especially with Anthropic models) when this is enabled."""
