models

package
v0.7.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package models resolves a model id to its context window and its token prices.

WHY THIS EXISTS. A host that only needs a model's window or price used to import proxyapp, because the resolver lived in proxyapp's facade. proxyapp is also the proxy's composition root, and Go links whole packages. So that host linked proxy, tenant, dash and every component just to read one window. Cortex's context-guru plugin did exactly that (issue #1251).

This package is the resolver half of that facade, on its own. Like proxyapp, it is a FACADE: aliases and thin wrappers over internal/modelinfo, adding no behaviour and moving no code. proxyapp re-exports these names, so a host built on proxyapp still compiles.

The LiteLLM gateway client is in models/litellm, because it makes a network call and this package does not (see internal/boundary).

It must never import proxy or proxyapp. TestModelsLinksNoProxy fails if it does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExactWindow

func ExactWindow(r Resolver, ctx context.Context, model string) (tokens int, exact, ok bool)

ExactWindow reports a model's window and whether the answer is exact rather than inferred. The distinction matters: a fraction-of-window trigger computed from a guessed window is a guess.

Types

type Chain

type Chain = modelinfo.Chain

Chain tries several Resolvers in order, first answer wins.

type Price

type Price = modelinfo.Price

Price is one model's token prices.

type Pricer

type Pricer = modelinfo.Pricer

Pricer answers what a model's tokens cost.

type Resolver

type Resolver = modelinfo.Resolver

Resolver resolves a model id to its context window.

type Static

type Static = modelinfo.Static

Static is the compiled-in table of known models.

func DefaultStatic

func DefaultStatic() Static

DefaultStatic is the compiled-in model table.

type Table

type Table = modelinfo.Table

Table is a table loaded from a file.

func LoadTable

func LoadTable(path string) (*Table, error)

LoadTable reads a model table from a file, so an operator can correct or extend the compiled-in one without a rebuild.

Directories

Path Synopsis
Package litellm resolves model windows and prices against a LiteLLM gateway.
Package litellm resolves model windows and prices against a LiteLLM gateway.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL