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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ....core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata
from ....types.agent_failure_response_example import AgentFailureResponseExample
from ....types.agent_successful_response_example import AgentSuccessfulResponseExample
from ....types.conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput
from ....types.conversation_initiation_source import ConversationInitiationSource
from ....types.llm import Llm
from ....types.simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig
from ....types.test_from_conversation_metadata_output import TestFromConversationMetadataOutput
from ....types.tool_response_mock_config_output import ToolResponseMockConfigOutput
from ....types.unit_test_tool_call_evaluation_model_output import UnitTestToolCallEvaluationModelOutput


class TestsUpdateResponse_Llm(UncheckedBaseModel):
    type: typing.Literal["llm"] = "llm"
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None
    dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None
    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None
    conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None
    success_condition: typing.Optional[str] = None
    success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = None
    failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = None
    id: str
    name: str

    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


class TestsUpdateResponse_Tool(UncheckedBaseModel):
    type: typing.Literal["tool"] = "tool"
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None
    dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None
    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None
    conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None
    tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelOutput] = None
    check_any_tool_matches: typing.Optional[bool] = None
    id: str
    name: str

    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


class TestsUpdateResponse_Simulation(UncheckedBaseModel):
    type: typing.Literal["simulation"] = "simulation"
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None
    dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None
    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None
    conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None
    success_condition: typing.Optional[str] = None
    success_conditions: typing.Optional[typing.List[str]] = None
    simulation_scenario: typing.Optional[str] = None
    simulation_max_turns: typing.Optional[int] = None
    simulation_environment: typing.Optional[str] = None
    tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = None
    tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigOutput]]] = None
    evaluation_model: typing.Optional[Llm] = None
    simulated_user_model: typing.Optional[Llm] = None
    id: str
    name: str

    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


TestsUpdateResponse = typing_extensions.Annotated[
    typing.Union[TestsUpdateResponse_Llm, TestsUpdateResponse_Tool, TestsUpdateResponse_Simulation],
    UnionMetadata(discriminant="type"),
]
update_forward_refs(TestsUpdateResponse_Llm)
update_forward_refs(TestsUpdateResponse_Tool)
update_forward_refs(TestsUpdateResponse_Simulation)
