Bulk Test Upload
API method for the creation of Test Sets
Overview
Test Sets allows you to define a versioned testing environment for your model. A Test Set contains a collection of test cases.
Each test case has a name
, model
and messages
to prompt the model. Test case can optionally have other fields including model_config
and metadata
. You can use metadata
to filter your test cases in the UI.
After creation you can specify evaluators on the Context.ai platform.
Test Sets and test cases are identified by their name
attribute. Note that name
cannot be updated after creation.
Versioning
When creating a new Test Set, version #1 will be automatically created and populated with your test cases. When making a second POST request with the same Test Set name
, a new version will be created. Use the copy_test_cases_from
query parameter to specify append / overwrite behaviour.
Adding evaluators to your test cases
You can optionally add evaluators to the test cases in your Test Set through the API. We have some off-the-shelf evaluators available for use. You can also create your own custom evaluators in the Context.ai web app and assign those to your test cases by referencing them in snake_case.
Uploading pre-generated response for evaluation
To run evaluations against a pre-generated response for a test case, you can add the response under your test case, keyed by
pregenerated_response
. If thepregenerated_response
field is set,model
is an optional parameter.
Log a Test Set
POST
https://api.context.ai/api/v1/test_sets
Create new Test Set version. If Test Set name already exists, a new version will be created. Use copy_test_cases_from
query parameter to specify append/replace behaviour.
Query Parameters
Name | Type | Description |
---|---|---|
copy_test_cases_from | String | Either Defaults to |
Request Body
Name | Type | Description |
---|---|---|
name* | String | Name of the Test Set |
test_cases* | List | List of all test cases |
Example Request
Example Response
Last updated