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

from __future__ import annotations

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
from ..core.unchecked_base_model import UncheckedBaseModel
from .agent_failure_response_example import AgentFailureResponseExample
from .agent_successful_response_example import AgentSuccessfulResponseExample
from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput
from .conversation_initiation_source import ConversationInitiationSource
from .test_from_conversation_metadata_input import TestFromConversationMetadataInput


class UpdateResponseUnitTestRequest(UncheckedBaseModel):
    from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = pydantic.Field(default=None)
    """
    Metadata of a conversation this test was created from (if applicable).
    """

    dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
    """
    Dynamic variables to replace in the agent config during testing
    """

    chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None
    conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None)
    """
    Simulate the test as if the conversation originated from this channel.
    """

    success_condition: typing.Optional[str] = pydantic.Field(default=None)
    """
    A prompt that evaluates whether the agent's response is successful. Should return True or False.
    """

    success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = pydantic.Field(default=None)
    """
    Non-empty list of example responses that should be considered successful
    """

    failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = pydantic.Field(default=None)
    """
    Non-empty list of example responses that should be considered failures
    """

    name: str
    parent_folder_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the parent folder. If not provided, the test will be moved to the root level.
    """

    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


update_forward_refs(UpdateResponseUnitTestRequest)
