import PiClient from 'withpi';const client = new PiClient({ apiKey: 'My API Key',});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);
Copy
{ "question_scores": { "Is the response relevant?": 0.5, "Is the response truthful?": 0.89 }, "total_score": 0.4}
Scoring System
Pi Scorer
Scores the provided input and output based on the given scoring spec or a list of questions
POST
/
scoring_system
/
score
JavaScript
Copy
import PiClient from 'withpi';const client = new PiClient({ apiKey: 'My API Key',});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);
Copy
{ "question_scores": { "Is the response relevant?": 0.5, "Is the response truthful?": 0.89 }, "total_score": 0.4}