# This file was auto-generated by Fern from our API Definition.

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class LocalEval(UniversalBaseModel):
    """
    Evaluation result, EvaluationResult from llama_index.

    Output of an BaseEvaluator.
    """

    query: typing.Optional[str] = pydantic.Field(default=None)
    """
    Query string
    """

    contexts: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Context strings
    """

    response: typing.Optional[str] = pydantic.Field(default=None)
    """
    Response string
    """

    passing: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Binary evaluation result (passing or not)
    """

    feedback: typing.Optional[str] = pydantic.Field(default=None)
    """
    Feedback or reasoning for the response
    """

    score: typing.Optional[float] = pydantic.Field(default=None)
    """
    Score for the response
    """

    pairwise_source: typing.Optional[str] = pydantic.Field(default=None)
    """
    Used only for pairwise and specifies whether it is from original order of presented answers or flipped order
    """

    invalid_result: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether the evaluation result is an invalid one.
    """

    invalid_reason: typing.Optional[str] = pydantic.Field(default=None)
    """
    Reason for invalid evaluation.
    """

    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
