# 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 .analysis_scope import AnalysisScope
from .criteria_scoring_mode import CriteriaScoringMode
from .llm import Llm


class PromptEvaluationCriteria(UncheckedBaseModel):
    """
    An evaluation using the transcript and a prompt for a yes/no achieved answer
    """

    id: str = pydantic.Field()
    """
    The unique identifier for the evaluation criteria
    """

    name: str
    type: typing.Optional[typing.Literal["prompt"]] = pydantic.Field(default=None)
    """
    The type of evaluation criteria
    """

    conversation_goal_prompt: str = pydantic.Field()
    """
    The prompt that the agent should use to evaluate the conversation
    """

    use_knowledge_base: typing.Optional[bool] = pydantic.Field(default=None)
    """
    When evaluating the prompt, should the agent's knowledge base be used.
    """

    scope: typing.Optional[AnalysisScope] = pydantic.Field(default=None)
    """
    The scope of transcript context used when evaluating this criterion. 'conversation' uses the full transcript; 'agent' uses only the portion where the defining agent was active.
    """

    llm: typing.Optional[Llm] = pydantic.Field(default=None)
    """
    LLM model to use for this evaluation criteria. If not set, uses agent's analysis_llm default.
    """

    scoring_mode: typing.Optional[CriteriaScoringMode] = pydantic.Field(default=None)
    """
    How this criterion is scored. 'binary' resolves to success/failure/unknown. 'numeric_uniform' returns a number on the [0, max_score] scale which is normalized into the aggregate conversation success percentage.
    """

    max_score: typing.Optional[int] = pydantic.Field(default=None)
    """
    Maximum value of the numeric score scale (minimum is always 0). Only used when scoring_mode is 'numeric_uniform'.
    """

    score_instructions: typing.Optional[str] = pydantic.Field(default=None)
    """
    Optional free-text instructions describing how to assign values on the numeric scale. Only used when scoring_mode is 'numeric_uniform'.
    """

    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
