Skip to main content
POST
/
v1
/
evaluation
/
evaluators
JavaScript
import Roark from '@roarkanalytics/sdk';

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

const response = await client.evaluation.createEvaluator({
  blocks: [
    {
      blockType: 'CUSTOM_PROMPT',
      metricName: 'metricName',
      name: 'name',
      prompt: 'prompt',
    },
  ],
  name: 'x',
});

console.log(response.data);
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "name": "<string>",
    "slug": "<string>",
    "description": "<string>",
    "createdAt": "<string>",
    "updatedAt": "<string>",
    "blocks": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "name": "<string>",
        "description": "<string>",
        "weight": 50,
        "orderIndex": 123,
        "blockType": "<string>",
        "prompt": "<string>",
        "threshold": 0.5,
        "metricName": "<string>"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Input for creating a new evaluator with blocks

name
string
required

Name of the evaluator

Minimum string length: 1
blocks
(CreateCustomPromptBlockInput · object | CreateDatafieldCheckBlockInput · object | CreateEmotionBlockInput · object | CreateLatencyBlockInput · object | CreatePolitenessBlockInput · object | CreateSentimentBlockInput · object | CreateToolCallsBlockInput · object | CreateToxicityBlockInput · object | CreateVocalCueBlockInput · object)[]
required

Array of evaluation blocks (at least one required)

Minimum array length: 1

Block definition for creating an evaluator

description
string | null

Optional description of the evaluator

Response

The created evaluator with its blocks

data
object
required

Evaluator with its configured blocks