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

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
import typing
from .text_node import TextNode
from .metric_result import MetricResult
from .eval_execution_params import EvalExecutionParams
import datetime as dt
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class EvalQuestionResult(UniversalBaseModel):
    """
    Schema for the result of an eval question job.
    """

    eval_question_id: str = pydantic.Field()
    """
    The ID of the question that was executed.
    """

    pipeline_id: str = pydantic.Field()
    """
    The ID of the pipeline that the question was executed against.
    """

    source_nodes: typing.List[TextNode] = pydantic.Field()
    """
    The nodes retrieved by the pipeline for the given question.
    """

    answer: str = pydantic.Field()
    """
    The answer to the question.
    """

    eval_metrics: typing.Dict[str, MetricResult] = pydantic.Field()
    """
    The eval metrics for the question.
    """

    eval_dataset_execution_id: str = pydantic.Field()
    """
    The ID of the EvalDatasetJobRecord that this result was generated from.
    """

    eval_dataset_execution_params: EvalExecutionParams = pydantic.Field()
    """
    The EvalExecutionParams that were used when this result was generated.
    """

    eval_finished_at: dt.datetime = pydantic.Field()
    """
    The timestamp when the eval finished.
    """

    class_name: typing.Optional[str] = None

    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
