# 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 .execute_scorer_request_scorer import ExecuteScorerRequestScorer


class ExecuteScorerRequest(UncheckedBaseModel):
    """
    Request to execute a scorer with evaluation context.

    Supports two modes:
    1. Execute saved scorer by ID: provide scorer_id
    2. Execute ephemeral scorer config: provide scorer
    """

    scorer_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    ID of saved scorer to execute (alternative to providing full scorer config)
    """

    scorer: typing.Optional[ExecuteScorerRequestScorer] = pydantic.Field(default=None)
    """
    Ephemeral scorer configuration to execute
    """

    context: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field()
    """
    Template context with arbitrary variables for scorer execution. Common variables: input, output, expected. Example: {'input': {...}, 'output': {...}, 'expected': {...}}
    """

    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
