"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .agent_hopps_models_models_usage import (
    AgentHoppsModelsModelsUsage,
    AgentHoppsModelsModelsUsageTypedDict,
)
from .answerstep import AnswerStep, AnswerStepTypedDict
from .codeinterpreterevidence import (
    CodeInterpreterEvidence,
    CodeInterpreterEvidenceTypedDict,
)
from .codestep import CodeStep, CodeStepTypedDict
from .evaluatedanswerstep import EvaluatedAnswerStep, EvaluatedAnswerStepTypedDict
from .planstep import PlanStep, PlanStepTypedDict
from .ragieevidence import RagieEvidence, RagieEvidenceTypedDict
from .searchstep import SearchStep, SearchStepTypedDict
from .surrenderstep import SurrenderStep, SurrenderStepTypedDict
from ragie.types import BaseModel
from typing import List, Optional, Union
from typing_extensions import NotRequired, TypeAliasType, TypedDict


EvidenceTypedDict = TypeAliasType(
    "EvidenceTypedDict", Union[CodeInterpreterEvidenceTypedDict, RagieEvidenceTypedDict]
)


Evidence = TypeAliasType("Evidence", Union[CodeInterpreterEvidence, RagieEvidence])


StepsTypedDict = TypeAliasType(
    "StepsTypedDict",
    Union[
        SearchStepTypedDict,
        PlanStepTypedDict,
        SurrenderStepTypedDict,
        AnswerStepTypedDict,
        CodeStepTypedDict,
        EvaluatedAnswerStepTypedDict,
    ],
)


Steps = TypeAliasType(
    "Steps",
    Union[
        SearchStep, PlanStep, SurrenderStep, AnswerStep, CodeStep, EvaluatedAnswerStep
    ],
)


class FinalAnswerTypedDict(TypedDict):
    text: str
    r"""The final answer to the question."""
    evidence: NotRequired[List[EvidenceTypedDict]]
    r"""The evidence used to derive the answer."""
    steps: NotRequired[List[StepsTypedDict]]
    r"""The steps that led to the answer."""
    usage: NotRequired[AgentHoppsModelsModelsUsageTypedDict]


class FinalAnswer(BaseModel):
    text: str
    r"""The final answer to the question."""

    evidence: Optional[List[Evidence]] = None
    r"""The evidence used to derive the answer."""

    steps: Optional[List[Steps]] = None
    r"""The steps that led to the answer."""

    usage: Optional[AgentHoppsModelsModelsUsage] = None
