Nous.DecisionModel.Result (nous v0.21.1)

Copy Markdown View Source

The result of Nous.DecisionModel.decide/4.

Fields

  • :answers - [{question_id, Nous.DecisionModel.Answer.t()}], in the order the questions were given, keyed by the ids exactly as declared.
  • :usage - %{input_tokens: integer | nil, output_tokens: integer | nil} as the backend reports it.

  • :backend - the Nous.DecisionModel.Backend module that answered.
  • :model - the model reference of the Nous.DecisionModel.

Summary

Functions

Fetches the answer for id, compared exactly as declared (:a is not "a").

Types

t()

@type t() :: %Nous.DecisionModel.Result{
  answers: [{Nous.DecisionModel.Question.id(), Nous.DecisionModel.Answer.t()}],
  backend: module() | nil,
  model: String.t() | nil,
  usage: usage()
}

usage()

@type usage() :: %{
  input_tokens: non_neg_integer() | nil,
  output_tokens: non_neg_integer() | nil
}

Functions

fetch(result, id)

@spec fetch(t(), Nous.DecisionModel.Question.id()) ::
  {:ok, Nous.DecisionModel.Answer.t()} | :error

Fetches the answer for id, compared exactly as declared (:a is not "a").