Guava.IntentRecognizer (Guava v0.34.0)

Copy Markdown View Source

Match a caller intent against a fixed set of choices using the Guava LLM endpoint, constrained so only the provided choices can be returned.

Summary

Functions

Classify intent. Returns a list of Guava.SuggestedAction ordered by likelihood, or nil if nothing plausibly matches.

Like classify/2, but returns the matches or raises Guava.Error.

Build a recognizer. choices is a list of choice strings, or a map from choice to a longer disambiguating description.

Types

t()

@type t() :: %Guava.IntentRecognizer{
  choices: [String.t()] | %{required(String.t()) => String.t()},
  client: Guava.Client.t()
}

Functions

classify(r, intent)

@spec classify(t(), String.t()) ::
  {:ok, [Guava.SuggestedAction.t()] | nil} | {:error, Guava.Error.t()}

Classify intent. Returns a list of Guava.SuggestedAction ordered by likelihood, or nil if nothing plausibly matches.

classify!(r, intent)

@spec classify!(t(), String.t()) :: [Guava.SuggestedAction.t()] | nil

Like classify/2, but returns the matches or raises Guava.Error.

new(client, choices)

@spec new(Guava.Client.t(), [String.t()] | %{required(String.t()) => String.t()}) ::
  t()

Build a recognizer. choices is a list of choice strings, or a map from choice to a longer disambiguating description.