PATCH
/
metrics
/
{metricId}
import Scorecard from 'scorecard-ai';

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

const metric = await client.metrics.update('321', {
  evalType: 'ai',
  outputType: 'boolean',
  promptTemplate:
    'Using the following guidelines, evaluate the response: {{ guidelines }}\n\nResponse: {{ outputs.response }}\n\nIdeal answer: {{ expected.idealResponse }}',
});

console.log(metric);
{
  "id": "321",
  "name": "Response Accuracy",
  "description": "Evaluates if the response is factually accurate",
  "outputType": "boolean",
  "evalType": "ai",
  "guidelines": "Check if the response contains factually correct information",
  "promptTemplate": "Using the following guidelines, evaluate the response: {{ guidelines }}\n\nResponse: {{ outputs.response }}\n\nIdeal answer: {{ expected.idealResponse }}",
  "temperature": 0.1
}

Authorizations

Authorization
string
header
required

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

Path Parameters

metricId
string
required

The ID of the Metric to update.

Example:

"321"

Body

application/json

A Metric with AI evaluation and integer output.

Response

200
application/json

Metric updated successfully

A Metric defines how to evaluate system outputs against expected results. A Metric with AI evaluation and integer output.