Documentation
¶
Index ¶
Constants ¶
const ( DefaultHost = "127.0.0.1" DefaultPort = 8080 DefaultLocation = "global" DefaultUIMode = "auto" )
Variables ¶
var ErrUsage = errors.New("usage error")
Functions ¶
func IsLoopbackHost ¶
Types ¶
type AuthConfig ¶ added in v0.2.0
type AuthConfig struct {
Type string `yaml:"type"` // none, bearer, google_adc, oauth_client_credentials
Token string `yaml:"token"`
TokenURL string `yaml:"token_url"`
ClientID string `yaml:"client_id"`
ClientSecret string `yaml:"client_secret"`
Scopes []string `yaml:"scopes"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
}
AuthConfig describes how to authenticate against a backend.
type BackendConfig ¶ added in v0.2.0
type BackendConfig struct {
Name string `yaml:"name"`
Type string `yaml:"type"` // gcp_openai or openai_compatible
BaseURL string `yaml:"base_url"`
Project string `yaml:"project"`
Location string `yaml:"location"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
Auth AuthConfig `yaml:"auth"`
Models BackendModels `yaml:"models"`
}
BackendConfig describes one upstream backend.
func (*BackendConfig) UpstreamModelID ¶ added in v0.2.0
func (bc *BackendConfig) UpstreamModelID(id string) string
UpstreamModelID returns the upstream model ID that should be sent to the backend for the given local model ID.
func (*BackendConfig) VertexBaseURL ¶ added in v0.2.0
func (bc *BackendConfig) VertexBaseURL() string
VertexBaseURL computes the Vertex AI OpenAI-compatible base URL for a gcp_openai backend.
type BackendModels ¶ added in v0.2.0
BackendModels holds either "all" (pass-through) or an explicit list of models.
func (*BackendModels) UnmarshalYAML ¶ added in v0.2.0
func (bm *BackendModels) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML supports both `models: all` and `models: [{id: ...}]`.
type Config ¶
type Config struct {
Server ServerConfig `yaml:"server"`
Backends []BackendConfig `yaml:"backends"`
UI UIConfig `yaml:"ui"`
Verbose bool `yaml:"verbose"`
SourcePath string `yaml:"-"`
}
func (*Config) AllModels ¶ added in v0.2.0
AllModels returns all explicitly-listed models across all backends (excludes "models: all" backends).
func (*Config) BackendForModel ¶ added in v0.2.0
func (c *Config) BackendForModel(id string) *BackendConfig
BackendForModel returns the first backend that serves the given model ID. Exact-listed models take priority over "models: all" pass-through backends.
func (*Config) LocalModelID ¶
LocalModelID translates an upstream model ID back to the local model ID.