cookbook · Decider 1 · Confidence-gated actions
Act only when the model is sure
Many support messages are clear enough to handle automatically, but some are ambiguous and need a person. This recipe acts only when Decider 1 is sure, and routes everything else to a human. For example, 'Please cancel my subscription at the end of this month' returns cancel 0.97, so the code cancels, while 'not sure this plan is right for us anymore, what are my options?' returns question 0.76, cancel 0.20, so it goes to a human.
Request
POST /v1/systemone, documented in the Decider 1 reference.
curl https://meragpt.com/v1/systemone \
-H "Authorization: Bearer $MERAGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sd-1",
"state": {
"message": "Please cancel my subscription at the end of this month. Thanks."
},
"questions": {
"intent": {
"type": "choice",
"instructions": "What does the customer want?",
"criteria": {
"cancel": "End the subscription.",
"downgrade": "Move to a cheaper plan.",
"question": "Asking for information, no action yet."
}
}
}
}'What came back
The real output from running this recipe, unedited.
{
"cancel my subscription at the end of this month": {
"intent": {
"type": "choice",
"choice": "cancel",
"confidence": 0.9748,
"probabilities": {
"cancel": 0.9748,
"downgrade": 0.0093,
"question": 0.0159
}
}
},
"not sure this plan is right for us anymore, what are my options?": {
"intent": {
"type": "choice",
"choice": "question",
"confidence": 0.762,
"probabilities": {
"cancel": 0.2023,
"downgrade": 0.0357,
"question": 0.762
}
}
}
}Python
import os, requests
API = "https://meragpt.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['MERAGPT_API_KEY']}"}
THRESHOLD = 0.9 # pick this from your own labelled messages
def handle(message: str):
body = {
"model": "sd-1",
"state": {
"message": message
},
"questions": {
"intent": {
"type": "choice",
"instructions": "What does the customer want?",
"criteria": {
"cancel": "End the subscription.",
"downgrade": "Move to a cheaper plan.",
"question": "Asking for information, no action yet."
}
}
}
}
intent = requests.post(f"{API}/systemone", headers=HEADERS, json=body).json()["answers"]["intent"]
if intent["choice"] == "cancel" and intent["confidence"] >= THRESHOLD:
return "cancel automatically"
return "send to a person"
print(handle("Please cancel my subscription at the end of this month. Thanks."))
print(handle("not sure this plan is right for us anymore, what are my options?"))
TypeScript
const API = "https://meragpt.com/v1";
const headers = {
Authorization: `Bearer ${process.env.MERAGPT_API_KEY}`,
"Content-Type": "application/json",
};
const THRESHOLD = 0.9; // pick this from your own labelled messages
async function handle(message: string) {
const body = {
"model": "sd-1",
"state": {
"message": message
},
"questions": {
"intent": {
"type": "choice",
"instructions": "What does the customer want?",
"criteria": {
"cancel": "End the subscription.",
"downgrade": "Move to a cheaper plan.",
"question": "Asking for information, no action yet."
}
}
}
};
const r = await fetch(`${API}/systemone`, { method: "POST", headers, body: JSON.stringify(body) }).then((res) => res.json());
const intent = r.answers.intent;
return intent.choice === "cancel" && intent.confidence >= THRESHOLD ? "cancel automatically" : "send to a person";
}
When to trust it
The threshold (0.9 here) is yours to set: pick it from a few hundred of your own labelled messages, trading how much you automate against how many mistakes you accept. Output is reliable only within that trade-off, and messages near the threshold are the ones most likely to be misrouted.
Try it without code in the playground, or see more Decider 1 recipes: route a support email in one call, flag a phishing email, drop retrieved passages that do not help, hold a reply that promises money, pick an agent's first tool, ask many questions in one call.