Skip to main content
Every decision has a kind. The kind sets how you list the outcomes and what the answer holds. A decision with no kind is single. The examples below are the three decisions of the quickstart’s request, each with the answer kettei-core gave to it, rounded to three places.

Binary

Use binary for a question whose answer is yes or no.
  • outcomes is optional. When you send it, its keys are yes and no, each with a description of when it applies.
  • probabilities.yes is the probability that the answer is yes.
  • Ask the question the positive way round. “Does the ticket state a deadline?” is easier to answer and to label than “Is this not urgent?”.

Single

Use single to pick one of several outcomes that exclude each other, such as a team, a category or a tool.
  • List the outcomes as names, such as ["billing", "technical", "sales"], or as a map from each name to a description of when it applies. Descriptions help most where two outcomes meet.
  • A decision has 2 to 255 outcomes, and their names differ. abstain is reserved for the abstain policy.
  • If none of your outcomes might fit, add one such as other or none.

Ordinal

Use ordinal for a level on an ordered scale, such as severity or quality.
  • outcomes lists the levels in order, lowest first. rubric describes each level, in the same order. An ordinal decision needs both.
  • expected_level is the average level, weighted by the probabilities. It counts positions from 0, not the values of your labels: on a low, medium, high scale it runs from 0 to 2.
  • Sort a queue by expected_level, or use top as a label.

Mix kinds in one request

One request can ask decisions of every kind about the same context, as the quickstart does. Each decision gets its own probabilities, and its own action if you give it a policy. The answers come back keyed by id.

Rules every decision follows

  • A request asks 1 to 128 decisions. A model may take fewer: max_questions in /v1/models, which a fine-tuned model shares with the model it was trained from.
  • Keep outcome names short and put the detail in descriptions. If several decisions in a request have an outcome name over 500 characters, they must all list the same outcomes in the same order. Send other decisions in a request of their own.
  • Keep the order of the outcomes fixed when you reword a decision, and when you fine-tune a model on it.
  • A decision that breaks a rule is refused with 422 invalid_request, and error.details names the field.