TestRunBuilder
Test_Run_Builder utilities for test execution and management utilities.
TestRunBuilder
Builder for test runs.
__init__
Constructor
with_data_structure
Set the data structure for the test run
Arguments:
Name | Type | Description |
---|---|---|
data | T | The data structure to use |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_data
Set the data for the test run
Arguments:
Name | Type | Description |
---|---|---|
data | DataValue[T] | The data to use |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_evaluators
Add evaluators to the test run
Arguments:
Name | Type | Description |
---|---|---|
*evaluators | str | The evaluators to add |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_human_evaluation_config
Set the human evaluation configuration for the test run
Arguments:
Name | Type | Description |
---|---|---|
config | HumanEvaluationConfig | The human evaluation configuration to use |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_workflow_id
Set the workflow ID for the test run. Optionally, you can also set the context to evaluate for the workflow. (Note: setting the context to evaluate will end up overriding the CONTEXT_TO_EVALUATE dataset column value)
Arguments:
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). |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
Raises:
ValueError
- If a prompt version ID, prompt chain version ID or output function is already set for this run builder
with_prompt_version_id
Set the prompt version ID for the test run. Optionally, you can also set the context to evaluate for the prompt. (Note: setting the context to evaluate will end up overriding the CONTEXT_TO_EVALUATE dataset column value)
Arguments:
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). |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
Raises:
ValueError
- If a workflow ID, prompt chain version ID or output function is already set for this run builder
with_prompt_chain_version_id
Set the prompt chain version ID for the test run. Optionally, you can also set the context to evaluate for the prompt chain. (Note: setting the context to evaluate will end up overriding the CONTEXT_TO_EVALUATE dataset column value)
Arguments:
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). |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
Raises:
ValueError
- If a workflow ID, prompt version ID or output function is already set for this run builder
yields_output
Set the output function for the test run
Arguments:
Name | Type | Description |
---|---|---|
output_function | Callable[[T], Union[[YieldedOutput](/sdk/python/references/models/test_run), Awaitable[YieldedOutput]]] | The output function to use |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
Raises:
ValueError
- If a workflow ID, prompt chain version ID or prompt version ID is already set for this run builder
with_concurrency
Set the concurrency level for the test run
Arguments:
Name | Type | Description |
---|---|---|
concurrency | int | The concurrency level to use |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
with_logger
Set the logger for the test run
Arguments:
Name | Type | Description |
---|---|---|
logger | TestRunLogger | The logger to use |
Returns:
Name | Description |
---|---|
[TestRunBuilder](/sdk/python/references/test_runs/test_run_builder)[T] | The current TestRunBuilder instance for method chaining |
run
Run the test
Arguments:
Name | Type | Description |
---|---|---|
timeout_in_minutes | Optional[int] | The timeout in minutes. Defaults to 10. |
Returns:
Name | Description |
---|---|
[RunResult](/sdk/python/references/models/test_run) | The result of the test run |