Tune.Prediction (Tune v0.5.0)

Copy Markdown View Source

The outcome of one target execution.

A failed execution keeps its partial prediction in Tune.Error.Execution.Failed.

Summary

Functions

Returns provider-reported usage for each step, in call order.

Sums provider-reported token use across all steps.

Returns the total attempted managed model calls.

Types

failure()

@type failure() :: %{name: String.t(), role: atom(), error: term()}

t()

@type t() :: %Tune.Prediction{
  calls: %{optional(atom()) => non_neg_integer()},
  failures: [failure()],
  metadata: map(),
  output: term(),
  steps: [Tune.Step.t()],
  usage: %{
    input: non_neg_integer(),
    output: non_neg_integer(),
    total: non_neg_integer()
  }
}

Functions

step_usage(prediction)

@spec step_usage(t()) :: [map() | nil]

Returns provider-reported usage for each step, in call order.

token_totals(prediction)

@spec token_totals(t()) :: %{
  input: non_neg_integer(),
  output: non_neg_integer(),
  total: non_neg_integer()
}

Sums provider-reported token use across all steps.

total_calls(prediction)

@spec total_calls(t()) :: non_neg_integer()

Returns the total attempted managed model calls.