PhoenixAI.Store.Guardrails.TokenBudget.RateLimiter (PhoenixAI.Store v0.1.0)

Copy Markdown View Source

Default Hammer-backed rate limiter for the :time_window scope of PhoenixAI.Store.Guardrails.TokenBudget.

Start this process in your supervision tree when using the time-window token budget:

children = [
  {PhoenixAI.Store.Guardrails.TokenBudget.RateLimiter, clean_period: :timer.minutes(5)}
]

The module implements the Hammer behaviour and exposes hit/4.

Summary

Functions

Callback implementation for Hammer.expires_at/2.

Callback implementation for Hammer.get/2.

Callback implementation for Hammer.inc/3.

Callback implementation for Hammer.set/3.

Functions

child_spec(opts)

expires_at(key, scale)

Callback implementation for Hammer.expires_at/2.

get(key, scale)

Callback implementation for Hammer.get/2.

hit(key, scale, limit, increment \\ 1)

Callback implementation for Hammer.hit/4.

inc(key, scale, increment \\ 1)

Callback implementation for Hammer.inc/3.

set(key, scale, count)

Callback implementation for Hammer.set/3.

start_link(opts)