# 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.test_from_conversation_metadata_input import TestFromConversationMetadataInput
from ....types.unit_test_tool_call_evaluation_model_input import UnitTestToolCallEvaluationModelInput
from ....types.update_response_unit_test_request_dynamic_variables_value import (
    UpdateResponseUnitTestRequestDynamicVariablesValue,
)
from ....types.update_simulation_test_request_dynamic_variables_value import (
    UpdateSimulationTestRequestDynamicVariablesValue,
)
from ....types.update_tool_call_unit_test_request_dynamic_variables_value import (
    UpdateToolCallUnitTestRequestDynamicVariablesValue,
)


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[UpdateResponseUnitTestRequestDynamicVariablesValue]]
    ] = None
    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = 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

    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[UpdateToolCallUnitTestRequestDynamicVariablesValue]]
    ] = None
    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None
    tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelInput] = None
    check_any_tool_matches: typing.Optional[bool] = None
    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 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[UpdateSimulationTestRequestDynamicVariablesValue]]
    ] = None
    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None
    success_condition: typing.Optional[str] = None
    simulation_scenario: typing.Optional[str] = None
    simulation_max_turns: typing.Optional[int] = None
    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


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)
