# 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.llm import Llm
from ....types.simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig
from ....types.test_from_conversation_metadata_input import TestFromConversationMetadataInput
from ....types.tool_response_mock_config_input import ToolResponseMockConfigInput
from ....types.unit_test_tool_call_evaluation_model_input import UnitTestToolCallEvaluationModelInput


class TestsCreateRequestBody_Llm(UncheckedBaseModel):
    """
    Create Chat Response Test Request Information
    """

    type: typing.Literal["llm"] = "llm"
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None
    dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = 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 TestsCreateRequestBody_Tool(UncheckedBaseModel):
    """
    Create Chat Response Test Request Information
    """

    type: typing.Literal["tool"] = "tool"
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None
    dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = 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 TestsCreateRequestBody_Simulation(UncheckedBaseModel):
    """
    Create Chat Response Test Request Information
    """

    type: typing.Literal["simulation"] = "simulation"
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None
    dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = 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
    tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigInput]]] = 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


TestsCreateRequestBody = typing_extensions.Annotated[
    typing.Union[TestsCreateRequestBody_Llm, TestsCreateRequestBody_Tool, TestsCreateRequestBody_Simulation],
    UnionMetadata(discriminant="type"),
]
update_forward_refs(TestsCreateRequestBody_Llm)
update_forward_refs(TestsCreateRequestBody_Tool)
update_forward_refs(TestsCreateRequestBody_Simulation)
