# `AshAi.Evaluate.Choice`
[🔗](https://github.com/ash-project/ash_ai/blob/v1.1.0/lib/ash_ai/evaluate/choice.ex#L5)

An evaluation answer selecting one option from a defined set.

The options come from one of two places:

- the `of` constraint: an `Ash.Type.Enum`, or `:atom` with a `one_of`
  constraint. `value` is cast to that type and enum value descriptions become
  the criteria sent to the model.
- criteria supplied per question through the `questions` option of
  `AshAi.Actions.Evaluate`. Without `of`, `value` is a string. With `of`, the
  runtime criteria must be a subset of its options, which is how options can
  depend on earlier answers (for example, the children of a taxonomy node).

## Fields

- `value` - the selected option
- `probabilities` - every option mapped to its probability
- `confidence` - how concentrated the distribution is, from 0 to 1

## Example

    action :department, AshAi.Evaluate.Choice do
      description "Which team should handle `ticket`?"
      constraints of: MyApp.Department
      argument :ticket, :string, allow_nil?: false

      run evaluate("typesafe:jev-latest")
    end

# `t`

```elixir
@type t() :: %AshAi.Evaluate.Choice{
  confidence: float(),
  probabilities: %{required(term()) =&gt; float()},
  value: term()
}
```

# `handle_change?`

# `prepare_change?`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
