Implementation:Elevenlabs Elevenlabs python GetUnitTestResponseModel
| Attribute | Value |
|---|---|
| Page Type | Implementation |
| Package | elevenlabs |
| Module | elevenlabs.types.get_unit_test_response_model |
| Class | GetUnitTestResponseModel |
| Base Class | UncheckedBaseModel |
| Source File | src/elevenlabs/types/get_unit_test_response_model.py |
| Auto-Generated | Yes (Fern API Definition) |
Overview
Description
GetUnitTestResponseModel is a Pydantic-based data model representing the full response for an individual unit test. It encapsulates the complete test definition including chat history, success/failure evaluation criteria, tool call evaluation parameters, dynamic variables, and metadata about the test origin. This model extends the common unit test fields with id and name fields for identification.
Usage
This model is returned by API endpoints that retrieve a specific unit test by its ID. It provides the complete test definition, allowing consumers to inspect or execute the test. The test defines a chat scenario (via chat_history), a success condition prompt, example responses for success and failure, and optional tool call evaluation criteria.
Code Reference
Source Location
src/elevenlabs/types/get_unit_test_response_model.py
Class Signature
class GetUnitTestResponseModel(UncheckedBaseModel):
...
Import Statement
from elevenlabs.types.get_unit_test_response_model import GetUnitTestResponseModel
I/O Contract
| Field Name | Type | Required | Default | Description |
|---|---|---|---|---|
| chat_history | List[ConversationHistoryTranscriptCommonModelOutput] | Yes | N/A | The chat history transcript that sets up the test scenario |
| success_condition | str | Yes | N/A | A prompt that evaluates whether the agent's response is successful. Should return True or False |
| success_examples | List[AgentSuccessfulResponseExample] | Yes | N/A | Non-empty list of example responses that should be considered successful |
| failure_examples | List[AgentFailureResponseExample] | Yes | N/A | Non-empty list of example responses that should be considered failures |
| tool_call_parameters | Optional[UnitTestToolCallEvaluationModelOutput] | No | None | How to evaluate the agent's tool call (if any). If empty, the tool call is not evaluated |
| check_any_tool_matches | Optional[bool] | No | None | If True, the test passes if any tool call matches the criteria. Otherwise fails if more than one tool is returned |
| dynamic_variables | Optional[Dict[str, Optional[GetUnitTestResponseModelDynamicVariablesValue]]] | No | None | Dynamic variables to replace in the agent config during testing |
| type | Optional[UnitTestCommonModelType] | No | None | The type classification of the unit test |
| from_conversation_metadata | Optional[TestFromConversationMetadataOutput] | No | None | Metadata of a conversation this test was created from (if applicable) |
| id | str | Yes | N/A | Unique identifier of the unit test |
| name | str | Yes | N/A | Name of the unit test |
Usage Examples
Inspecting a Unit Test
from elevenlabs.types.get_unit_test_response_model import GetUnitTestResponseModel
# Assuming `test` is a GetUnitTestResponseModel returned by the API
print(f"Test: {test.name} (ID: {test.id})")
print(f"Success condition: {test.success_condition}")
print(f"Chat history steps: {len(test.chat_history)}")
print(f"Success examples: {len(test.success_examples)}")
print(f"Failure examples: {len(test.failure_examples)}")
Checking Tool Call and Dynamic Variable Configuration
# Check if tool call evaluation is configured
if test.tool_call_parameters:
print("Tool call evaluation is configured")
if test.check_any_tool_matches:
print(" Mode: any tool match accepted")
else:
print(" Mode: single tool match required")
# Check dynamic variables
if test.dynamic_variables:
for var_name, var_value in test.dynamic_variables.items():
print(f" Variable '{var_name}': {var_value}")
# Check if test was created from a conversation
if test.from_conversation_metadata:
print(f"Created from conversation: {test.from_conversation_metadata}")