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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .generate_result_data import GenerateResultData
import pydantic
from .generate_result_error import GenerateResultError
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class GenerateResult(UniversalBaseModel):
    data: typing.Optional[GenerateResultData] = pydantic.Field(default=None)
    """
    An object containing the resulting generation. This key will be absent if the LLM provider experienced an error.
    """

    error: typing.Optional[GenerateResultError] = pydantic.Field(default=None)
    """
    An object containing details about the error that occurred. This key will be absent if the LLM provider did not experience an error.
    """

    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
