AshAi.Evaluate.Score (ash_ai v1.1.0)

Copy Markdown View Source

An evaluation answer rating the state along ordered, described levels.

The levels constraint is an ordered list of at least two level descriptions. Each level should describe a concrete situation and stand on its own. Levels can instead be supplied per question through the questions option of AshAi.Actions.Evaluate.

Fields

  • value - the probability-weighted position across the levels; may fall between two levels
  • level - the description of the level nearest to value
  • probabilities - each level index mapped to its probability
  • confidence - how concentrated the distribution is, from 0 to 1

Example

action :frustration, AshAi.Evaluate.Score do
  description "How frustrated is the customer in `ticket`?"
  constraints levels: ["Calm", "Frustrated but civil", "Very angry"]
  argument :ticket, :string, allow_nil?: false

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

Summary

Types

t()

@type t() :: %AshAi.Evaluate.Score{
  confidence: float(),
  level: String.t(),
  probabilities: %{required(non_neg_integer()) => float()},
  value: float()
}

Functions

handle_change?()

prepare_change?()