Core functions and classes for AI testing.
Test any output using AI.
Parameters:
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| output | str | - | The output to test |
output
str
| expected | str | None | Expected output for comparison |
expected
None
| criteria | str | None | Custom evaluation criteria |
criteria
Returns: TestResult
TestResult
Example:
Test output against custom criteria.
---
Main class for AI testing with configuration.
Result of an AI test.
| Field | Type | Description |
|-------|------|-------------|
| score | float | Score from 0 to 10 |
score
float
| passed | bool | True if score ≥ threshold |
passed
bool
| reasoning | str | AI's explanation |
reasoning
| criteria | str | Criteria used |
| expected | str | Expected output |
| output | str | Tested output |
| duration | float | Test duration |
duration
Configuration for AI testing.
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| model | str | "gpt-4o-mini" | LLM model |
model
"gpt-4o-mini"
| threshold | float | 7.0 | Pass threshold |
threshold
7.0
| temperature | float | 0.0 | LLM temperature |
temperature
0.0
| verbose | bool | False | Verbose output |
verbose
False
| cache_enabled | bool | True | Enable caching |
cache_enabled
True