Documentation
¶
Overview ¶
Package models contains the generated model catalog and its persisted refresh overlay.
Package models contains the generated model catalog and runtime refresh layer.
Index ¶
Constants ¶
const ModelsDevURL = "https://models.dev/api.json"
Variables ¶
This section is empty.
Functions ¶
func BuiltinImages ¶
func BuiltinImages(provider ai.ImagesProviderID) []ai.ImagesModel
func PiUserAgent ¶
PiUserAgent formats the catalog-refresh User-Agent, mirroring upstream getPiUserAgent (pi-user-agent.ts).
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is an immutable-by-convention provider/model lookup.
func LoadStore ¶
LoadStore restores the provider-scoped models-store.json overlay. Entries for providers bundled in the builtin catalog lose to a newer builtin: the overlay only applies when its lastModified is newer than the bundled catalog build time (upstream remote-catalog-provider.ts remoteModels).
func Refresh ¶
func Refresh(ctx context.Context, options RefreshOptions) (*Catalog, error)
Refresh fetches models.dev and replaces only fetched providers in the persisted dynamic overlay. A completed refresh within the last 4 hours skips the network and returns the stored overlay (upstream remote-catalog-provider.ts gates on checkedAt plus lastModified presence).
func (*Catalog) MarshalJSON ¶
type RefreshOptions ¶
type RefreshOptions struct {
URL string
StorePath string
Client *http.Client
Now func() time.Time
// UserAgent identifies the client on the catalog request (upstream sends a
// pi User-Agent from remote-catalog-provider.ts).
UserAgent string
// Force bypasses the checkedAt refresh gate.
Force bool
}
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
genmodels
command
|
|
|
internal
|
|
|
cataloggen
Package cataloggen normalizes the models.dev api.json shape into pi models.
|
Package cataloggen normalizes the models.dev api.json shape into pi models. |