AshAi.Evaluate.Judgments (ash_ai v1.1.0)

Copy Markdown View Source

A map of evaluation answers, one per field, asked together in a single request.

Declare the collapsed type you care about for each field and it is expanded into the matching answer type at compile time, so the result keeps probabilities and confidence for every judgment:

Each field's description is the question's instructions.

Example

action :triage, AshAi.Evaluate.Judgments do
  argument :ticket, :string, allow_nil?: false

  constraints fields: [
    department: [type: MyApp.Department, description: "Which team should handle `ticket`?"],
    urgent: [type: :boolean, description: "Does `ticket` convey urgency?"],
    frustration: [
      type: AshAi.Evaluate.Score,
      constraints: [levels: ["Calm", "Frustrated but civil", "Very angry"]],
      description: "How frustrated is the customer in `ticket`?"
    ]
  ]

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

The result is a map of answer structs:

%{
  department: %AshAi.Evaluate.Choice{value: :technical, confidence: 0.82, probabilities: %{...}},
  urgent: %AshAi.Evaluate.Noul{probability: 0.92},
  frustration: %AshAi.Evaluate.Score{value: 1.6, level: "Frustrated but civil", ...}
}

Summary

Functions

handle_change?()

prepare_change?()