Documentation
¶
Overview ¶
Package modelcatalog reads provider model directories without inference or configuration writes.
Index ¶
- Constants
- Variables
- func DefaultConfigPath() (string, error)
- func ModelURL(base string) (string, error)
- func SafeURL(raw string) string
- func ValidateReasoning(m Model) error
- type Catalog
- type Client
- type Credential
- type Endpoint
- type Model
- type Provider
- type Reasoning
- type Source
- type TokenReference
Constants ¶
const MaxBytes = 1 << 20
Variables ¶
var ErrRunning = errors.New("a probe is already running")
Functions ¶
func DefaultConfigPath ¶
func ValidateReasoning ¶
ValidateReasoning checks shape, not a particular client's fixed vocabulary. A gateway may add values which an individual client must subsequently filter. Duplicate efforts and a default missing from the list are not fatal: callers drop or disable them. Empty or control-character tokens still fail the body.
Types ¶
type Client ¶
type Credential ¶
type Credential struct {
Name string `json:"name"`
Selected bool `json:"selected"`
Home string `json:"home"`
AuthFile string `json:"authFile"`
BaseURL string `json:"baseUrl"`
Token string `json:"token"`
TokenFile string `json:"tokenFile"`
DummyToken string `json:"dummyToken"`
}
Credential and Provider are the configuration schema shared with the config UI. They contain secrets: do not use them as an HTTP response or session record.
type Model ¶
type Model struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
DisplayName string `json:"display_name,omitempty"`
ContextWindow int `json:"context_window,omitempty"`
ContextLength int `json:"context_length,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
MaxOutputTokens int `json:"max_output_tokens,omitempty"`
ReasoningEfforts []string `json:"reasoning_efforts,omitempty"`
DefaultReasoningEffort string `json:"default_reasoning_effort,omitempty"`
}
Model preserves the upstream id verbatim; display names and vendor aliases are not routing ids.
type Provider ¶
type Provider struct {
Name string `json:"name"`
Kind string `json:"kind"`
Subscription bool `json:"subscription"`
Home string `json:"home"`
AuthFile string `json:"authFile"`
Version string `json:"version"`
BaseURL string `json:"baseUrl"`
Protocol string `json:"protocol"`
ModelListMode string `json:"modelListMode"`
Token string `json:"token"`
TokenFile string `json:"tokenFile"`
DummyToken string `json:"dummyToken"`
Credentials []Credential `json:"credentials"`
}
func (*Provider) ApplySelected ¶
func (p *Provider) ApplySelected()
func (Provider) SelectedCredentialIndex ¶
SelectedCredentialIndex preserves the config UI's first-selected, else first policy.
type Reasoning ¶
type Reasoning struct {
State string `json:"state"`
Source string `json:"source"`
Efforts []string `json:"efforts,omitempty"`
Default string `json:"default,omitempty"`
}
Reasoning is advertised or explicitly configured metadata, never an inference result. Unknown is distinct from unsupported. A disabled generated proxy route alone is not evidence that the upstream cannot reason.
type Source ¶
type Source struct {
Path string `json:"-"`
Name string `json:"name"`
BaseURL string `json:"base_url"`
Protocol string `json:"protocol"`
Reference TokenReference `json:"credential_reference"`
// contains filtered or unexported fields
}
Source is a backend-only snapshot. JSON and diagnostic formatting do not expose credentials.
func ReadSource ¶
ReadSource reads only the named provider and relevant explicit model declarations. Invalid unrelated routes do not prevent discovery; no configuration is changed.
type TokenReference ¶
type TokenReference struct {
File string `json:"file,omitempty"`
JSONPointer string `json:"json_pointer,omitempty"`
Guards map[string]string `json:"guards,omitempty"`
PublicToken string `json:"public_token,omitempty"`
}
TokenReference describes an existing credential without copying its secret. JSON guards keep a reordered or retargeted config from silently changing identity.