# 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


class LlmJudgeAssertion(UncheckedBaseModel):
    """
    LLM judge assertion.

    Uses an LLM to evaluate the quality of the output based on criteria.
    This is the most flexible assertion type but requires API calls.

    Example:
        assertion = LLMJudgeAssertion(
            type="llm_judge",
            criteria=["correctness", "helpfulness", "professionalism"],
            model="claude-sonnet-4",
            description="Response should be helpful and professional"
        )
    """

    type: typing.Literal["llm_judge"] = "llm_judge"
    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    Human-readable description of this assertion
    """

    criteria: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Evaluation criteria for the judge
    """

    model: typing.Optional[str] = pydantic.Field(default=None)
    """
    LLM model to use as judge
    """

    custom_prompt: typing.Optional[str] = pydantic.Field(default=None)
    """
    Custom judge prompt (overrides default)
    """

    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
