mirror of
https://github.com/hanzoai/kai.git
synced 2026-10-17 11:18:06 +00:00
Every runner printed whatever came back and exited 0, and fell back to a second raw HTTP call when the SDK import failed. Now each recipe carries expect.json, the answers a careful reader gives on its own input: a list of acceptable options for a choice, of level indices for a score, true or false for a noul. run.py and run.ts send request.json through the SDK, print every answer, and exit 1 when a checked one is wrong. A question with no obvious answer on its input is printed and not checked. Recipes 09 and 11 had no input with an obvious answer, so each state gains the one fact that decides it. The recipe READMEs describe what each recipe asks instead of capabilities it never exercised, and copy the request and checked answers from the two JSON files. Co-authored-by: Hanzo Dev <[email protected]>
1.6 KiB
1.6 KiB
Customer Support: Ticket Triage
Route a support ticket to a team and rate its priority.
Request (request.json)
{
"model": "kai",
"state": {
"subject": "Charged twice for October subscription",
"body": "I saw two pending charges of $99 on my Visa statement this morning. Please refund the duplicate transaction immediately.",
"account_tier": "Pro"
},
"questions": {
"department": {
"type": "choice",
"instructions": "Which department handles this ticket?",
"criteria": {
"billing": "charges, invoices, refunds, credit card updates",
"technical": "bug reports, integration errors, API downtime",
"security": "unauthorized account access, audit logs",
"sales": "enterprise discounts, contract upgrades"
}
},
"priority": {
"type": "score",
"instructions": "Rate ticket priority",
"criteria": [
"low",
"normal",
"high",
"urgent"
]
}
}
}
Checked answers (expect.json)
department(choice):billingpriority(score): most probable level 2highor level 3urgent
Run
From the repository root, after pip install -r requirements.txt and npm install:
curl -sS --fail-with-body https://api.hanzo.ai/v1/decisions \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d @recipes/06_support_triage/request.json
python3 recipes/06_support_triage/run.py
npx tsx recipes/06_support_triage/run.ts
run.py and run.ts print every answer and exit 1 when a checked answer is wrong.