API cookbook
Jev /decide request examples
1. Request shape
state is the context your software already has. questions is a map of named decisions. Each question is one of three types: choice (pick a label), score (ordered levels), or noul (yes/no probability).
- choice — criteria is an object of option → short description
- score — criteria is an ordered array of level labels
- noul — yes/no gate; response is a calibrated probability
2. curl
curl https://jevtypesafe.org/api/v1/decide \
-H "Authorization: Bearer jv_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"state": "Customer: I was charged twice and nobody replied for 3 days.",
"questions": {
"route": {
"type": "choice",
"instructions": "Where should this go?",
"criteria": { "billing": "money", "bug": "broken", "account": "login" }
},
"urgency": {
"type": "score",
"instructions": "How urgent is this?",
"criteria": ["routine", "today", "urgent", "critical"]
},
"escalate": {
"type": "noul",
"instructions": "Escalate to a human now?"
}
}
}'3. Python
import os, requests
r = requests.post(
"https://jevtypesafe.org/api/v1/decide",
headers={"Authorization": f"Bearer {os.environ['JEV_API_KEY']}"},
json={
"state": "Customer: I was charged twice and nobody replied for 3 days.",
"questions": {
"route": {
"type": "choice",
"instructions": "Where should this go?",
"criteria": {"billing": "money", "bug": "broken", "account": "login"},
},
"urgency": {
"type": "score",
"instructions": "How urgent is this?",
"criteria": ["routine", "today", "urgent", "critical"],
},
"escalate": {"type": "noul", "instructions": "Escalate to a human now?"},
},
},
timeout=30,
)
print(r.json())
# export JEV_API_KEY=jv_live_...4. TypeScript / Node
const res = await fetch("https://jevtypesafe.org/api/v1/decide", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.JEV_API_KEY}`, // jv_live_...
"Content-Type": "application/json",
},
body: JSON.stringify({
state: "Customer: I was charged twice and nobody replied for 3 days.",
questions: {
route: {
type: "choice",
instructions: "Where should this go?",
criteria: { billing: "money", bug: "broken", account: "login" },
},
urgency: {
type: "score",
instructions: "How urgent is this?",
criteria: ["routine", "today", "urgent", "critical"],
},
escalate: { type: "noul", instructions: "Escalate to a human now?" },
},
}),
});
console.log(await res.json());Run it against a real key
Create jv_live_ on Account after a prepaid pack, then paste the curl above.
来源参考: