# Choice

One named category from your options: a team, intent, route, or document class.

Source: https://shvydko.ai/en/docs/primitives/choice

## Describe the categories

criteria is an object with 1–255 options. Keys are stable identifiers for your code; values explain the categories. Names must be unique within the JSON object.

Choice returns exactly one category. For several independent attributes, create several Noul questions; for an ordered scale, use Score.

### Choice in a complete request

```json
{
  "state": "Card payment is not working. Cash on delivery is available. The customer asks for help placing an order.",
  "questions": {
    "team": {
      "type": "choice",
      "instructions": "Which team should handle this request?",
      "criteria": {
        "engineering": "Website and payment integration failures",
        "logistics": "Order delivery and collection",
        "other": "Questions outside these categories or insufficient information"
      }
    }
  }
}
```

## Read choice and probabilities

answers.team.choice is the key of the selected category. probabilities contains numeric estimates for all your keys; confidence is a separate confidence indicator from 0 to 1.

Use an allowlist of keys for business actions. Low confidence or the other category can lead to manual review. Choose the threshold using your own labeled data.

### Illustration of answers.team; not a run result

```json
{
  "type": "choice",
  "choice": "engineering",
  "probabilities": {
    "engineering": 0.88,
    "logistics": 0.04,
    "other": 0.08
  },
  "confidence": 0.82
}
```

> The probabilities and confidence values do not guarantee a correct decision.

## Make criteria useful

- Describe what belongs in each category, rather than using only a short name.
- Remove categories with the same meaning or explain how to choose between them.
- Include borderline cases in evaluation, not just obvious positive cases.
- Do not change the meaning of identifiers without updating the code that handles the response.

## Related documentation

- [Decision confidence](https://shvydko.ai/en/docs-markdown/confidence.md)
- [Routing support requests](https://shvydko.ai/en/docs-markdown/patterns/routing.md)
- [Score](https://shvydko.ai/en/docs-markdown/primitives/score.md)
