The Decision API lets you ask typed questions about any input and get back calibrated probability distributions — powered by SAP SAP-RPT-1.6's in-context learning.
Base URL: https://rpt.cloud.sap
Authentication is the same across all endpoints — pass your personal API token in the Authorization header:
Authorization: Bearer YOUR_TOKEN
Obtain and manage tokens in Settings.
{
"model": "sap-rpt-1.6",
"state": "I was charged $99 instead of $49 on my last bill, please fix this!",
"questions": {
"billing": {
"type": "noul",
"instructions": "Is this message about billing?"
},
"tone": {
"type": "choice",
"instructions": "What is the tone of the message?",
"criteria": {
"calm": "Polite, positive, or appreciative",
"angry": "Hostile, frustrated, or threatening",
"neutral": "Factual, neither positive nor negative"
}
},
"priority": {
"type": "score",
"instructions": "How urgently does this need attention?",
"criteria": ["can wait", "this week", "today"]
}
},
"examples": [
{
"state": "Thanks so much, the new feature is great!",
"answers": { "billing": false, "tone": "calm", "priority": "0" }
},
{
"state": "You billed my card three times, refund me!",
"answers": { "billing": true, "tone": "angry", "priority": "2" }
},
{
"state": "When will the next release be available?",
"answers": { "billing": false, "tone": "neutral", "priority": "1" }
}
]
}
state (required): The content all questions refer to — the thing being evaluated. Usually a string, but also accepts a JSON object (structured data) or array (e.g. chat log).questions (required): Map of question key → question definition. 1–10 questions. Each must have a type field.examples (required): Labeled few-shot examples. 2–2,048 examples. RPT learns from these in-context.model (optional): Model identifier. Defaults to sap-rpt-1.6.Label demonstration rule: Every declared option/level must appear in at least one example's
answers. RPT can only predict labels it has seen in context.
noul — Yes/NoReturns a probability of true (0.0–1.0).
{
"type": "noul",
"instructions": "Is this message about billing?",
"criteria": {
"true": "Related to charges, invoices, or payments",
"false": "Not about billing"
}
}
instructions (required): What to evaluate.criteria (optional): Descriptions for true and false labels.Example answers: true, false
choice — Multi-ClassReturns the winning option and a full probability distribution.
{
"type": "choice",
"instructions": "What is the tone of the message?",
"criteria": {
"calm": "Polite, positive, or appreciative",
"angry": "Hostile, frustrated, or threatening",
"neutral": "Factual, neither positive nor negative"
}
}
instructions (required): What to evaluate.criteria (required): Map of option name → description. 2–255 options.Example answers: "calm", "angry", "neutral"
score — Ordinal ScaleReturns an expected score (probability-weighted sum) and per-level probabilities.
{
"type": "score",
"instructions": "How urgently does this need attention?",
"criteria": ["can wait", "this week", "today"]
}
instructions (required): What to evaluate.criteria (required): Ordered level labels as an array, index 0 = lowest. 2–255 levels.Example answers: "0", "1", "2" (string index into the criteria array)
Each example has a state and an answers map:
{
"state": "You billed my card three times, refund me!",
"answers": {
"billing": true,
"tone": "angry",
"priority": "2"
}
}
Answer format per question type:
| Question Type | Answer Format | Example |
|---|---|---|
noul | true or false | true |
choice | Option name (string) | "angry" |
score | Level index (string) | "2" |
{
"model": "sap-rpt-1.6",
"answers": {
"billing": {
"type": "noul",
"noul": 0.87
},
"tone": {
"type": "choice",
"choice": "angry",
"probabilities": { "calm": 0.05, "angry": 0.78, "neutral": 0.17 },
"confidence": 0.78
},
"priority": {
"type": "score",
"score": 1.82,
"legend": { "0": "can wait", "1": "this week", "2": "today" },
"probabilities": { "0": 0.05, "1": 0.08, "2": 0.87 },
"confidence": 0.87
}
},
"usage": { "input_tokens": 23, "output_tokens": 3 },
"metadata": { "num_rows": 6, "num_columns": 4, "num_predictions": 3, "num_query_rows": 1 }
}
| Field | Type | Description |
|---|---|---|
type | "noul" | Answer type |
noul | number | Probability of true (0.0–1.0) |
| Field | Type | Description |
|---|---|---|
type | "choice" | Answer type |
choice | string | Winning option (highest probability) |
probabilities | object | Full distribution keyed by option name. Sums to ~1.0 |
confidence | number | Probability of the winning choice (0.0–1.0) |
| Field | Type | Description |
|---|---|---|
type | "score" | Answer type |
score | number | Expected value (probability-weighted sum of level indices) |
legend | object | Map of index → level label |
probabilities | object | Full distribution keyed by level index. Sums to ~1.0 |
confidence | number | Probability of the most likely level (0.0–1.0) |
| Constraint | Value |
|---|---|
| Max questions | 10 |
| Min examples | 2 |
| Max examples | 2,048 |
| Choice options | 2–255 |
| Score levels | 2–255 |
Decision requests share the Predict rate limit pool. Exceeding the limit returns 429 with a Retry-After header. See Limits & Quotas for exact values.
| Status | Code | Description |
|---|---|---|
| 400 | ERR_DECISION_PAYLOAD_INVALID | Malformed JSON, missing fields, or validation failure |
| 400 | ERR_DECISION_TRANSLATE | Translation to RPT table failed (e.g. undeclared labels) |
| 401 | — | Missing or invalid token |
| 429 | — | Rate limit exceeded |
| 500 | — | Internal server error |
| 502 | — | AI Core upstream error |
| 503 | — | Network timeout or connection refused |
See Error Codes for the full error format.