Skip to content
API referenceCreate a prompt test case

Create a prompt test case

POST/v1/prompts/{slug}/test-cases

Create a prompt test case.

Adds a test case: variables to render the prompt with and an optional pattern the answer must match. Run them with POST /v1/prompts/{slug/test-cases/run}. Requires an admin of the prompt's workspace, or an organization admin. 404 when the prompt does not exist.

Authorization

  • AuthorizationBearer va_

    A platform API key (va_...), created under Settings > API keys. Scoped to an organization or one workspace, with an admin or member role. Used by the management API.

Path parameters

  • slugstringrequired

    the prompt's slug

Query parameters

  • organizationstringrequired

    slug of the organization that owns it

Request body application/json

the test case

  • namestringrequired

    A name for the test case (required).

  • variables_jsonmap<string, string>required

    The variable values to render the prompt with, as a JSON object of strings, for example {"customer": "Ada"} (required; may be empty).

  • expected_patternstring

    What a passing answer contains: a regular expression, matched case-insensitively anywhere in the answer (a value that is not a valid regular expression is matched as a case-insensitive substring). Omit it to pass every answer that completes.

Responses

201application/json

Created

  • idstring

    The test case's unique id (UUID).

  • prompt_idstring

    Id (UUID) of the prompt.

  • namestring

    The test case's name.

  • variables_jsonmap<string, string>

    The variable values the prompt is rendered with, as a JSON object of strings.

  • expected_patternstring

    The pattern a passing answer matches: a case-insensitive regular expression, or a substring when it is not a valid regular expression. Null when every completed answer passes.

  • created_atstring<date-time>

    When the test case was created (ISO 8601).

NVIDIA Inception Program member

VectorAxis is built by GK Labs, a member of NVIDIA Inception.