Documentation
¶
Overview ¶
Package modelinfo resolves a model's context window (max input tokens) DYNAMICALLY, so context-guru's triggers can scale with the model rather than hard-coding thresholds. The window is obtained without maintaining our own model list: the primary source is LiteLLM's community-maintained model_prices_and_context_window.json (fetched once and cached); an optional gateway /model/info probe is tried first for deployments that expose it; a tiny embedded table is the last-resort fallback.
Every lookup fails OPEN: an unknown model returns ok=false and callers fall back to absolute thresholds. Nothing here ever blocks a request — fetches are cached, single-flighted, and time-bounded, and any error just leaves the window unknown.
Index ¶
Constants ¶
const LiteLLMPricesURL = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json"
LiteLLMPricesURL is the community-maintained map of model -> {max_input_tokens,…}. Overridable (air-gapped mirrors) via NewLiteLLM.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LiteLLM ¶
type LiteLLM struct {
URL string
Client *http.Client
TTL time.Duration
// contains filtered or unexported fields
}
LiteLLM fetches and caches the LiteLLM prices map, serving per-model windows.
func NewLiteLLM ¶
NewLiteLLM builds a resolver. url="" uses LiteLLMPricesURL; ttl<=0 uses 6h.
type Static ¶
type Static struct {
// contains filtered or unexported fields
}
Static is a tiny last-resort table keyed by substring. Used only when a dynamic source is unavailable. Deliberately small — it is a floor, not a registry.
func DefaultStatic ¶
func DefaultStatic() Static
DefaultStatic covers the common families with conservative windows.