Documentation
¶
Overview ¶
Package query provides shared catalog list/detail query behavior.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthorOptions ¶
AuthorOptions controls author list filtering.
type ModelFilter ¶
type ModelFilter struct {
// Basic filters
ID string
Name string
NameContains string
Provider string
Status string
// Modality filters
ModalityInput []string
ModalityOutput []string
// Feature filters
Features map[string]bool
// Metadata filters
Tags []string
OpenWeights *bool
// Numeric range filters
MinContext int64
MaxContext int64
MinInput int64
MaxInput int64
MinOutput int64
MaxOutput int64
// Date filters
ReleasedAfter *time.Time
ReleasedBefore *time.Time
// Pagination
Sort string
Order string
Limit int
Offset int
MaxResults int
}
ModelFilter contains all possible filter criteria for models.
func (ModelFilter) Apply ¶
func (f ModelFilter) Apply(models []catalogs.Model) []catalogs.Model
Apply applies the filter to a list of models and returns filtered results.
func (ModelFilter) ApplyRecords ¶ added in v0.2.0
func (f ModelFilter) ApplyRecords(records []ModelRecord) []ModelRecord
ApplyRecords applies the model filter without discarding provider identity.
func (ModelFilter) Validate ¶
func (f ModelFilter) Validate() error
Validate rejects unsupported or ambiguous filter, sort, range, and page values before query execution.
type ModelOptions ¶
type ModelOptions struct {
Author string
Capability string
MinContext int64
MaxPrice float64
Search string
Limit int
}
ModelOptions controls model list filtering.
type ModelRecord ¶ added in v0.2.0
type ModelRecord struct {
catalogs.Model
ProviderID catalogs.ProviderID
}
ModelRecord identifies one exact provider-scoped model record. Embedding the model preserves the existing flat JSON shape while provider_id prevents equal model IDs from becoming ambiguous in unfiltered list results.
func CatalogModels ¶
func CatalogModels(catalog *catalogs.Catalog, provider string) ([]ModelRecord, error)
CatalogModels returns exact provider model records from the catalog's provider index. With no provider filter, equal model IDs from different providers remain distinct. CatalogModels orders them by provider ID, then model ID.
func Models ¶
func Models(models []ModelRecord, opts ModelOptions) []ModelRecord
Models filters, sorts, and limits model results.
func (ModelRecord) MarshalJSON ¶ added in v0.2.0
func (r ModelRecord) MarshalJSON() ([]byte, error)
MarshalJSON preserves the historical flat model object while adding its provider-scoped identity. Model has a custom marshaler, so ordinary anonymous embedding would otherwise consume the outer provider_id field.
func (ModelRecord) MarshalYAML ¶ added in v0.2.0
func (r ModelRecord) MarshalYAML() (any, error)
MarshalYAML preserves the same flat provider-scoped shape as MarshalJSON.
type PageResult ¶
PageResult contains paginated query results and metadata.
type ProviderOptions ¶
ProviderOptions controls provider list filtering.