Mimir.Snapshot (Mimir v0.1.0)

Copy Markdown View Source

A point-in-time view of the operational state the oracle ranks against. Assembled from explicit inputs — the embedder wires its own health, pricing, and budget sources; the oracle only ever sees this struct. Staleness affects optimality, never safety: enforcement happens where budgets are enforced, not here.

assemble/1 with no options is the degenerate snapshot: all lanes healthy, config pricing, unlimited budget.

Summary

Functions

Assemble a snapshot from explicit inputs.

Types

rates()

@type rates() :: %{input: non_neg_integer(), output: non_neg_integer()}

t()

@type t() :: %Mimir.Snapshot{
  health: %{optional(String.t()) => :ok | :degraded},
  parent_remaining: :unlimited | integer(),
  pricing: %{optional(String.t()) => rates()},
  rpm_headroom: :unlimited | integer(),
  snapshot_at: DateTime.t()
}

Functions

assemble(opts \\ [])

@spec assemble(keyword()) :: t()

Assemble a snapshot from explicit inputs.

  • :pricing — model → %{input:, output:} rate map; defaults to Application.get_env(:mimir, :pricing, %{}).
  • :health — lane → :ok | :degraded (e.g. Mimir.Health.all/0); default %{}.

  • :parent_remaining — remaining caller budget in microdollars, or :unlimited.
  • :rpm_headroom:unlimited or integer headroom.
  • :snapshot_at — defaults to DateTime.utc_now().