docs

Your first decision

A request with all three question types, and how to read each answer.

One request can carry many questions. The model reads the state once and answers each question from it, so extra questions cost very little.

curl https://api.sieve.one/v1/systemone \
  -H "Authorization: Bearer $TYPESAFE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sieve-latest",
    "state": {
      "subject": "Charged twice this month",
      "body": "Hi, I see two charges of $49 on my card for August. I only have one account. Please fix this ASAP, I am pretty frustrated."
    },
    "questions": {
      "is_billing": { "type": "noul", "instructions": "Is this ticket about billing?" },
      "sentiment": {
        "type": "choice",
        "instructions": "What is the customer'"'"'s tone?",
        "criteria": { "calm": null, "frustrated": null, "angry": null }
      },
      "urgency": {
        "type": "score",
        "instructions": "How urgent is this ticket?",
        "criteria": ["can wait", "this week", "today", "right now"]
      }
    }
  }'

Reading the answers

QuestionAnswer fieldsHow to read it
noul (yes/no)noulThe probability of yes, 0 to 1. Near 0.5 means unsure. No confidence field.
choicechoice, confidence, probabilitiesThe winning option, how sure the model is, and one probability per option.
scorescore, confidence, legend, probabilitiesThe expected level (it can fall between levels), plus legend mapping each level index to your label.

All numbers are rounded to 2 decimal places. Probabilities sum to 1.

Good habits

  • Put everything that is the same across questions in state and the specific ask in each question's instructions. You pay for the state once.
  • Send criteria descriptions for choice and score when the labels alone are ambiguous.
  • Use confidence to send doubtful answers to review.
  • Retry safely with an Idempotency-Key header. See Errors.

Next steps

Last updated