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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .analyze_task_result_usage import AnalyzeTaskResultUsage
from .finish_reason import FinishReason
from .generated_text_data import GeneratedTextData


class AnalyzeTaskResult(UniversalBaseModel):
    """
    The analysis results for a completed task.
    """

    generation_id: str = pydantic.Field()
    """
    The unique identifier for the generation session.
    """

    data: GeneratedTextData
    finish_reason: FinishReason
    usage: AnalyzeTaskResultUsage = pydantic.Field()
    """
    The number of tokens used in the generation.
    """

    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
