Decisions
A decision is a question your code asks and a fast model answers with a typed value instead of prose: true or false, one of a list of options, or a number on a scale. Each answer comes with the probability of every outcome and a confidence, in one call that usually takes a fraction of a second. There is nothing to parse and nothing to retry for a malformed reply.
| Kind | Asks | Answers with | Example |
|---|---|---|---|
Yes/no (predicate) | A question with two answers | true or false | Does this ticket describe a duplicate charge? |
Pick (choice) | Which of your options fits | An option id, or several if you allow it | Which department should handle this complaint? |
Score (score) | How much, on a scale you define | A number on the scale | How severe is this issue, from 0 to 2? |
You describe the question once, as a schema: the instructions, the inputs your code will send, and the options or scale. You publish it, and call it by name from your code. The same schema can run on more than one provider, and a run falls back to the next provider when one fails.
Before you start
- A provider. Decisions run on your own provider key. Add an OpenAI, Jev (TypeSafe) or Cloudflare Clef provider under Settings, Organization, LLM Providers. Other providers, such as the chat-only ones, cannot run decisions.
- An environment. Every call is made in an environment (Settings, Environments). It decides the variables your instructions can use and, optionally, which providers run first and which come after a failure.
- An API key for calls from code, under Settings, Account, API Keys.
The way through
- Build a schema under Decisions in the sidebar. See Building a schema.
- Try it in the schema's Playground tab, on one provider or several side by side. See The playground.
- Publish a version. A published version never changes. See Versions and references.
- Call it from your code with
curl, TypeScript or Python. See Calling the gateway. - Watch it run. Every call is a row in Logs, Decisions with the decision, the confidence, the provider that answered and what each attempt did, and Statistics, Decisions shows volume, errors, fallbacks, latency and cost over time.
What is kept
Each call is recorded in the decision log for 90 days. What is kept of your inputs is a choice an organization administrator makes under Settings, Organization, Observability: everything, only a keyed hash of each value, or nothing. The answer, the timings and the call's metadata are kept in every mode, so keep personal data out of metadata.