Phronic API
One endpoint for Phronic's One-Pass Models, starting with Pip. Send a state and a set of typed questions in one request, and get a typed answer to each, with the evidence it rests on.
- State + questions
- Pip one pass, read together
- Typed answers + evidence + confidence
- Your code
Questions are read together
Every question in a request is read in the same pass as the state. An answer can use the others, so a chain of dependent decisions fits in a single request instead of one request per step.
Every answer shows its evidence
Answers carry the spans of the state they rest on, with character offsets. When the state has no answer, or two that conflict, Pip abstains and says so.
Many states, one request
Send state as an array and every question is asked of each item. Because one pass answers every question about a state, the states in a batch do not wait on each other: the backend reads them in parallel rather than one after another. Answers come back as an array, one map per state, in the order you sent them.
{
"model": "pip-latest",
"state": [
"Help! My payouts have failed for 3 days.",
"How do I change my billing email?"
],
"questions": {
"is_urgent": {
"type": "binary",
"instructions": "Does this need action today?"
}
}
}
Batching states is unique to Phronic’s One-Pass Models. Each state is still read on its own: an answer about one state never sees another.
Quickstart
-
Get an API key
export PHRONIC_API_KEY=sk-...
-
Install the SDK
pip install phronic
-
Ask your first questions
from phronic import Phronic res = Phronic().decide( model="pip-latest", state="Help! My payouts have failed for 3 days.", questions={"is_urgent": {"type": "binary", "instructions": "Does this need action today?"}}, ) print(res.answers["is_urgent"].probability)
Question types
Mix any types in one request. Click a row to load its example in the panel.
API reference
Hover any field to find it in the example.
Request body
{ "messages": [...] }). An array is a batch: each item is its own state, every question is asked of each, and the states are read in parallel. Batching is unique to One-Pass Models.Question
ticket.messages[0].text.Response body
Answer
Errors
Models
TypeSafe-compatible endpoint
CompatibilityIf your code already sends TypeSafe System One requests, point it at this endpoint and it keeps working. Requests and responses follow the TypeSafe format. Pip adds evidence and abstained to each answer; clients that don’t read them can ignore them.
This endpoint is supported but won’t get new features. New work should use /v1/decide.
Switching
Change the base URL, the API key and the model name. Nothing else.
- POST https://api.typesafe.ai/v1/systemone + POST https://api.phronic.ai/v1/systemone - "model": "jev-latest" + "model": "pip-latest"
Endpoint
POST https://api.phronic.ai/v1/systemone Authorization: Bearer $PHRONIC_API_KEY Content-Type: application/json
Request body
Question
{
"state": "Help! My payouts have failed for 3 days.",
"model": "pip-latest",
"questions": {
"is_urgent": { "type": "noul", "instructions": "Does this need action today?" },
"team": { "type": "choice", "instructions": "Which team should handle this?",
"criteria": { "billing": null, "technical": null, "sales": null } },
"frustration":{ "type": "score", "instructions": "How frustrated is the customer?",
"criteria": ["Calm", "Frustrated", "Very angry"] }
}
} Response body
Answer
{
"model": "pip-0.1",
"answers": {
"is_urgent": { "type": "noul", "noul": 0.94,
"evidence": [{ "text": "for 3 days", "start": 29, "end": 39 }], "abstained": false },
"team": { "type": "choice", "choice": "billing",
"probabilities": { "billing": 0.91, "technical": 0.08, "sales": 0.01 }, "confidence": 0.86,
"evidence": [{ "text": "payouts have failed", "start": 9, "end": 28 }], "abstained": false },
"frustration": { "type": "score", "score": 1.12,
"legend": { "0": "Calm", "1": "Frustrated", "2": "Very angry" },
"probabilities": { "0": 0.02, "1": 0.84, "2": 0.14 }, "confidence": 0.79,
"evidence": [{ "text": "Help!", "start": 0, "end": 5 }], "abstained": false }
},
"usage": { "input_tokens": 132, "output_tokens": 30 }
} Mapping to /v1/decide
Errors
Same status codes as /v1/decide: 401, 422, 429 and 529.