Primitive
Score: rate on a rubric
Think of a 1-to-5 star rubric. You set ordered levels, and Jev rates against them. You get back a score, a legend, probabilities, and confidence.
curl
bash
curl -X POST https://api.typesafe.ai/v1/systemone \
-H "Authorization: Bearer $TYPESAFE_API_KEY" \
-H "Content-Type: application/json" \
-d @- <<'EOF'
{
"state": "Help! My payouts have been failing for 3 days.",
"model": "jev-latest",
"questions": {
"frustration": {
"type": "score",
"instructions": "How frustrated is the customer?",
"criteria": ["Calm", "Frustrated", "Very angry"]
}
}
}
EOFJavaScript
js
const key = process.env.TYPESAFE_API_KEY;
if (!key) throw new Error("TYPESAFE_API_KEY is not set");
const res = await fetch("https://api.typesafe.ai/v1/systemone", {
method: "POST",
headers: {
Authorization: `Bearer ${key}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
state: "Help! My payouts have been failing for 3 days.",
model: "jev-latest",
questions: {
frustration: {
type: "score",
instructions: "How frustrated is the customer?",
criteria: ["Calm", "Frustrated", "Very angry"],
},
},
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data.answers.frustration.score);
console.log(data.answers.frustration.confidence);Notes
- Score criteria is an ordered array. It needs at least two levels.
- The response gives you: score, legend, probabilities, and confidence.