Documentation
¶
Overview ¶
Package providercatalogue renders the pi CLI's provider catalogue.
pi 0.87.1 has no environment variable for a provider base URL; the only route to a non-built-in endpoint is <agent-dir>/models.json. This package exists so the two entry points (main.go and cmd/run-task/main.go) share one renderer instead of each carrying a copy that can drift, and so the file the CLI parses is covered by tests that assert its shape rather than its substrings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Models ¶
Models renders the catalogue bytes for the configured provider.
It returns nil when no base URL is configured, which is the signal that the pi CLI's own default provider configuration applies and no catalogue should be written. contextWindow is declared explicitly because pi silently falls back to 128000 when it is omitted, so a larger-window model would compact early with no error.
func Write ¶
Write renders the catalogue into <agentDir>/models.json.
It writes nothing when no base URL is configured, and in particular leaves an existing models.json untouched: an unconfigured agent must keep behaving exactly as it did before this package existed. The directory is created on demand because the pi agent directory may not exist yet on a fresh volume.
Types ¶
type Settings ¶
type Settings struct {
ProviderBaseURL string
ProviderKeyEnv string
Model string
ContextWindow int
MaxTokens int
}
Settings is the provider configuration rendered into the catalogue.
ProviderKeyEnv carries the *name* of the environment variable pi interpolates, never the credential itself: pi resolves "$NAME" from its own environment at request time, so writing the value into the file would put the secret on disk for no gain.