POST
/
api
/
workers
/
{workerId}
/
tests
import BrainbaseLabs from 'brainbase-labs';

const client = new BrainbaseLabs({
  apiKey: process.env['BRAINBASE_LABS_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const test = await client.workers.tests.create('workerId', {
    checkpoints: [{ description: 'description', name: 'name', runs: 0, tolerance: 0 }],
    description: 'description',
    flowId: 'flowId',
    name: 'name',
    systemPrompt: 'systemPrompt',
    testMode: 'testMode',
  });

  console.log(test.id);
}

main();
{
  "id": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "name": "<string>",
  "description": "<string>",
  "testMode": "<string>",
  "websocketUrl": "<string>",
  "systemPrompt": "<string>",
  "checkpoints": {},
  "workerId": "<string>",
  "flowId": "<string>"
}

Authorizations

x-api-key
string
header
required

API key authentication

Path Parameters

workerId
string
required

Body

application/json

Response

201
application/json

Test created

The response is of type object.