Primitive
Noul: a yes/no answer with a probability
Ask a yes/no question. You get a number from 0 to 1. That number is the chance the answer is yes. It is like a gut check with odds attached.
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": "Hi, I've been trying to connect my Stripe account for 3 days and it keeps failing. I'm losing sales. Please help ASAP.",
"model": "jev-latest",
"questions": {
"urgency": {
"type": "noul",
"instructions": "Does this message express urgency?",
"criteria": {
"true": "Explicitly time-sensitive",
"false": "No urgency expressed"
}
}
}
}
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:
"Hi, I've been trying to connect my Stripe account for 3 days and it keeps failing. I'm losing sales. Please help ASAP.",
model: "jev-latest",
questions: {
urgency: {
type: "noul",
instructions: "Does this message express urgency?",
criteria: {
true: "Explicitly time-sensitive",
false: "No urgency expressed",
},
},
},
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data.answers.urgency.noul);Notes
- A Noul answer returns type and noul, a number from 0 to 1. The docs do not attach a confidence field to Noul answers.
- The sample state is adapted from the public Quick start.