Skip to main content
GET
/
metrics
/
{metricId}
JavaScript
import Scorecard from 'scorecard-ai';

const client = new Scorecard({
  apiKey: 'My API Key',
});

const metric = await client.metrics.get('321');

console.log(metric);
{
"id": "654",
"name": "Response Accuracy",
"description": "Evaluates factual correctness",
"evalType": "ai",
"guidelines": "Check if the response is factually correct.",
"promptTemplate": "Evaluate if the following response is factually correct: {{outputs.response}}",
"evalModelName": "gpt-4o",
"temperature": 0.1,
"outputType": "boolean"
}

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 retrieve.

Example:

"321"

Response

Successfully retrieved Metric.

  • AI int metric
  • Human int metric
  • Heuristic int metric
  • AI float metric
  • Human float metric
  • Heuristic float metric
  • AI boolean metric
  • Human boolean metric
  • Heuristic boolean metric

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

id
string
required

The ID of the Metric.

name
string
required

The name of the Metric.

description
string | null
required

The description of the Metric.

evalType
string
required

AI-based evaluation type.

Allowed value: "ai"
guidelines
string
required

Guidelines for AI evaluation on how to score the metric.

promptTemplate
string
required

The complete prompt template for AI evaluation. Should include placeholders for dynamic content.

evalModelName
string
default:gpt-4o
required

The AI model to use for evaluation.

temperature
number
default:0
required

The temperature for AI evaluation (0-2).

Required range: 0 <= x <= 2
outputType
string
required

Integer output type.

Allowed value: "int"
passingThreshold
integer
default:4
required

The threshold for determining pass/fail from integer scores (1-5).

Required range: 1 <= x <= 5
I