| Attribute |
Value
|
| Page Type |
Implementation
|
| Package |
elevenlabs
|
| Module |
elevenlabs.types.unit_test_tool_call_parameter_eval
|
| Type |
Discriminated Union (4 variants)
|
| Base Class |
UncheckedBaseModel (per variant)
|
| Source File |
src/elevenlabs/types/unit_test_tool_call_parameter_eval.py
|
| Auto-Generated |
Yes (Fern API Definition)
|
Overview
Description
UnitTestToolCallParameterEval is a discriminated union type that defines how a tool call parameter should be evaluated during unit testing. It supports four evaluation strategies, each represented as a separate Pydantic model variant:
- Anything -- Accepts any value for the parameter (no validation).
- Exact -- Requires the parameter to match an exact expected value.
- Llm -- Uses an LLM to evaluate the parameter based on a description.
- Regex -- Validates the parameter against a regular expression pattern.
The union is discriminated on the type field, which determines which variant is active.
Usage
This union type is used within tool call evaluation configurations to specify how individual parameters of a tool call should be validated. Each variant represents a different evaluation strategy, providing flexibility ranging from permissive (anything) to strict (exact match) to pattern-based (regex) to semantic (LLM-based) evaluation.
Code Reference
Source Location
src/elevenlabs/types/unit_test_tool_call_parameter_eval.py
Class Signatures
class UnitTestToolCallParameterEval_Anything(UncheckedBaseModel):
type: typing.Literal["anything"] = "anything"
class UnitTestToolCallParameterEval_Exact(UncheckedBaseModel):
type: typing.Literal["exact"] = "exact"
expected_value: str
class UnitTestToolCallParameterEval_Llm(UncheckedBaseModel):
type: typing.Literal["llm"] = "llm"
description: str
class UnitTestToolCallParameterEval_Regex(UncheckedBaseModel):
type: typing.Literal["regex"] = "regex"
pattern: str
UnitTestToolCallParameterEval = Annotated[
Union[
UnitTestToolCallParameterEval_Anything,
UnitTestToolCallParameterEval_Exact,
UnitTestToolCallParameterEval_Llm,
UnitTestToolCallParameterEval_Regex,
],
UnionMetadata(discriminant="type"),
]
Import Statement
from elevenlabs.types.unit_test_tool_call_parameter_eval import (
UnitTestToolCallParameterEval,
UnitTestToolCallParameterEval_Anything,
UnitTestToolCallParameterEval_Exact,
UnitTestToolCallParameterEval_Llm,
UnitTestToolCallParameterEval_Regex,
)
I/O Contract
Variant: Anything
| Field Name |
Type |
Required |
Default |
Description
|
| type |
Literal["anything"] |
Yes |
"anything" |
Discriminant field identifying this as an anything-match evaluation
|
Variant: Exact
| Field Name |
Type |
Required |
Default |
Description
|
| type |
Literal["exact"] |
Yes |
"exact" |
Discriminant field identifying this as an exact-match evaluation
|
| expected_value |
str |
Yes |
N/A |
The exact string value the parameter must match
|
Variant: Llm
| Field Name |
Type |
Required |
Default |
Description
|
| type |
Literal["llm"] |
Yes |
"llm" |
Discriminant field identifying this as an LLM-based evaluation
|
| description |
str |
Yes |
N/A |
A description prompt for the LLM to evaluate the parameter value
|
Variant: Regex
| Field Name |
Type |
Required |
Default |
Description
|
| type |
Literal["regex"] |
Yes |
"regex" |
Discriminant field identifying this as a regex-pattern evaluation
|
| pattern |
str |
Yes |
N/A |
The regular expression pattern the parameter value must match
|
Usage Examples
Using Exact Match Evaluation
from elevenlabs.types.unit_test_tool_call_parameter_eval import (
UnitTestToolCallParameterEval_Exact,
)
eval_exact = UnitTestToolCallParameterEval_Exact(
expected_value="2025-01-15",
)
print(f"Type: {eval_exact.type}") # "exact"
print(f"Expected: {eval_exact.expected_value}")
Using Regex Pattern Evaluation
from elevenlabs.types.unit_test_tool_call_parameter_eval import (
UnitTestToolCallParameterEval_Regex,
)
eval_regex = UnitTestToolCallParameterEval_Regex(
pattern=r"^\d{4}-\d{2}-\d{2}$",
)
print(f"Type: {eval_regex.type}") # "regex"
print(f"Pattern: {eval_regex.pattern}")
Using LLM-Based Evaluation
from elevenlabs.types.unit_test_tool_call_parameter_eval import (
UnitTestToolCallParameterEval_Llm,
)
eval_llm = UnitTestToolCallParameterEval_Llm(
description="The value should be a valid future date in ISO format",
)
Using Anything Evaluation
from elevenlabs.types.unit_test_tool_call_parameter_eval import (
UnitTestToolCallParameterEval_Anything,
)
eval_any = UnitTestToolCallParameterEval_Anything()
print(f"Type: {eval_any.type}") # "anything"
Related Pages