POST
/
scoring_system
/
score
import PiClient from 'withpi';

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

const scoringSystemMetrics = await client.scoringSystem.score({
  llm_input: 'Tell me something different',
  llm_output: 'The lazy dog was jumped over by the quick brown fox',
  scoring_spec: [{ question: 'Is this response truthful?' }, { question: 'Is this response relevant?' }],
});

console.log(scoringSystemMetrics.total_score);
{
  "dimension_scores": {},
  "question_scores": {
    "Is the response relevant?": 0.5,
    "Is the response truthful?": 0.89
  },
  "total_score": 0.4
}

Authorizations

x-api-key
string
header
required

Body

application/json

Response

200
application/json

Successful Response

The response is of type object.