TypeSafe.Answer.Choice (TypeSafe AI v0.1.0-alpha.1)

Copy Markdown View Source

A decoded Choice answer: which option the model picked, and how sure it was about every option it was offered.

choice and the keys of probabilities are restored through TypeSafe.Keys.option/3, so they come back as atoms when the caller built the question with atom keys, and as strings when the caller used strings. An option the API named that the caller never declared stays a string.

Summary

Types

t()

@type t() :: %TypeSafe.Answer.Choice{
  choice: TypeSafe.Keys.key(),
  confidence: float(),
  id: TypeSafe.Keys.key(),
  probabilities: %{required(TypeSafe.Keys.key()) => float()}
}