Questa pagina è in inglese.
Typed decisions
The three decision kinds, choice, score and yes/no, and how to ask for each.
Use strike-ai (si apre in una nuova scheda) (pip install strike-ai, from strike_ai import Client) or POST /v1/systemone.
strike-1 always answers with one of the options you give it. Each question has a type that maps to a fixed answer shape.
Question type | Answer |
|---|---|
choice | One option and a probability per option |
noul (or yes_no on the request) | noul, the probability of yes |
score | Expected level index and a probability per level |
Choice
Pick one label from a list. Use it for routing and classification.
from strike_ai import Client
client = Client()
result = client.decide(
"I was charged twice for invoice 4411.",
{
"team": {
"type": "choice",
"instructions": "Which team should handle this ticket?",
"criteria": {
"billing": "Payments and refunds",
"tech": "Bugs and outages",
"sales": None,
},
}
},
)
answer = result["answers"]["team"]
assert answer["choice"] in ("billing", "tech", "sales")Yes / no
Use type: "noul" (or yes_no on the request). The answer field is noul, the probability of yes.
from strike_ai import Client
client = Client()
result = client.decide(
"Customer is furious after a third outage this week.",
{
"handoff": {
"type": "noul",
"instructions": "Should a human take over?",
}
},
)
p_yes = result["answers"]["handoff"]["noul"]
print("yes" if p_yes >= 0.5 else "no", p_yes)Score
Ordered levels, lowest first. Pass a list of 2 to 10 level labels.
from strike_ai import Client
client = Client()
levels = ["low", "medium", "high", "critical"]
result = client.decide(
"Production checkout is down for all users.",
{
"urgency": {
"type": "score",
"instructions": "How urgent is this incident?",
"criteria": levels,
}
},
)
ans = result["answers"]["urgency"]
print(ans["score"], ans["legend"], ans["probabilities"])score is the probability-weighted level index (0-based). probabilities and legend are keyed by the same index ("0" is the first level).
Limits
The API accepts up to 255 choice options, 2 to 10 score levels, and 32 questions per request. Invalid criteria return 422.
Preview: images and boxes
Image inputs and the box question use the same request as text. See Images.