# 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_input import ConversationHistoryTranscriptCommonModelInput
from ....types.conversation_initiation_source import ConversationInitiationSource
from ....types.dynamic_variable_value_type_input import DynamicVariableValueTypeInput
from ....types.llm import Llm
from ....types.simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig
from ....types.test_from_conversation_metadata_input import TestFromConversationMetadataInput
from ....types.unit_test_tool_call_evaluation_model_input import UnitTestToolCallEvaluationModelInput


class TestsUpdateRequestBody_Llm(UncheckedBaseModel):
    """
    Agent test to update
    """

    type: typing.Literal["llm"] = "llm"
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None
    dynamic_variables: typing.Optional[typing.Dict[str, typing.Optional[DynamicVariableValueTypeInput]]] = None
    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = 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
    name: str
    parent_folder_id: 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


class TestsUpdateRequestBody_Tool(UncheckedBaseModel):
    """
    Agent test to update
    """

    type: typing.Literal["tool"] = "tool"
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None
    dynamic_variables: typing.Optional[typing.Dict[str, typing.Optional[DynamicVariableValueTypeInput]]] = None
    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None
    conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None
    tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelInput] = None
    check_any_tool_matches: typing.Optional[bool] = None
    name: str
    parent_folder_id: 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


class TestsUpdateRequestBody_Simulation(UncheckedBaseModel):
    """
    Agent test to update
    """

    type: typing.Literal["simulation"] = "simulation"
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None
    dynamic_variables: typing.Optional[typing.Dict[str, typing.Optional[DynamicVariableValueTypeInput]]] = None
    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = 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
    evaluation_model: typing.Optional[Llm] = None
    simulated_user_model: typing.Optional[Llm] = None
    name: str
    parent_folder_id: 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


TestsUpdateRequestBody = typing_extensions.Annotated[
    typing.Union[TestsUpdateRequestBody_Llm, TestsUpdateRequestBody_Tool, TestsUpdateRequestBody_Simulation],
    UnionMetadata(discriminant="type"),
]
update_forward_refs(TestsUpdateRequestBody_Llm)
update_forward_refs(TestsUpdateRequestBody_Tool)
update_forward_refs(TestsUpdateRequestBody_Simulation)
