TestRunBuilder
"Bias"), the SDK pushes entries and the Maxim platform runs the prompt or workflow. With local evaluators or yields_output(), the SDK runs the prompt/workflow locally (or calls your output function) and then runs evaluators locally.
__init__
with_data_structure
| Name | Type | Description |
|---|---|---|
data | T | The data structure to use |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_data
| Name | Type | Description |
|---|---|---|
data | DataValue[T] | The data to use |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_evaluators
"Bias") or BaseEvaluator instances for local evaluators. With local evaluators, the SDK runs the prompt/workflow locally to get output before evaluating.
Arguments:
| Name | Type | Description |
|---|---|---|
*evaluators | str | The evaluators to add |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_human_evaluation_config
| Name | Type | Description |
|---|---|---|
config | HumanEvaluationConfig | The human evaluation configuration to use |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_workflow_id
| Name | Type | Description |
|---|---|---|
workflow_id | str | The ID of the workflow to use |
context_to_evaluate | Optional[str] | The context to evaluate for the workflow (variable name essentially). |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
ValueError- If a prompt version ID, prompt chain version ID or output function is already set for this run builder
with_prompt_version_id
| Name | Type | Description |
|---|---|---|
prompt_version_id | str | The ID of the prompt version to use |
context_to_evaluate | Optional[str] | The context to evaluate for the prompt (variable name essentially). |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
ValueError- If a workflow ID, prompt chain version ID or output function is already set for this run builder
with_prompt_chain_version_id
| Name | Type | Description |
|---|---|---|
prompt_chain_version_id | str | The ID of the prompt chain version to use |
context_to_evaluate | Optional[str] | The context to evaluate for the prompt chain (variable name essentially). |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
ValueError- If a workflow ID, prompt version ID or output function is already set for this run builder
with_simulation_config
yields_output(), the SDK runs your output function locally in a turn-by-turn loop. You can omit both with_prompt_version_id() and with_workflow_id() for SDK-only simulation. Your function receives SimulationContext with conversation_history, current_user_input, turn_number, total_cost, and total_tokens. Use turn.response.get("output", "") for the assistant’s text in each turn.
Arguments:
| Name | Type | Description |
|---|---|---|
simulation_config | SimulationConfig | The simulation configuration (e.g., max_turns, persona) |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
ValueError- If simulation config is used withwith_prompt_chain_version_id(usewith_workflow_idorwith_prompt_version_idinstead)
yields_output
with_simulation_config(), enables local-execution simulation where your function is called turn-by-turn with SimulationContext (conversation history, current user input, turn number, total_cost, total_tokens). You can omit both with_prompt_version_id() and with_workflow_id() for SDK-only simulation. Use turn.response.get("output", "") for the assistant’s text in each turn of conversation_history.
Arguments:
| Name | Type | Description |
|---|---|---|
output_function | Callable[[LocalData] or [LocalData, Optional[SimulationContext]], Union[YieldedOutput, Awaitable[YieldedOutput]]] | The output function. Accepts (data, simulation_context) when used with simulation |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
ValueError- If a workflow ID, prompt chain version ID or prompt version ID is already set for this run builder
with_concurrency
| Name | Type | Description |
|---|---|---|
concurrency | int | The concurrency level to use |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_logger
| Name | Type | Description |
|---|---|---|
logger | TestRunLogger | The logger to use |
| Name | Description |
|---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
run
| Name | Type | Description |
|---|---|---|
timeout_in_minutes | Optional[int] | The timeout in minutes. Defaults to 10. |
| Name | Description |
|---|---|
[RunResult](/sdk/python/references/models/test_run) | The result of the test run |