Documentation
¶
Overview ¶
Package model is the domain layer for the Model entity — a container for a family of dated checkpoints (Snapshots). Meta.Name is the admin / catalog slug; customers address the model by sending a Snapshot.Name in the request body. Snapshot.Pointer names the default snapshot displayed in /v1/models.
Host serving info (which Hosts can serve this Model) lives in standalone HostBinding entities (app/binding), not embedded in the Model spec.
Pricing and RateLimit attachments are deferred until those packages land.
store.go is the data-access layer for Model. Mirrors app/provider/store.go; metadata JSONB encoding is delegated to app/meta.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct {
Chat bool `json:"chat,omitempty" yaml:"chat,omitempty"`
Embeddings bool `json:"embeddings,omitempty" yaml:"embeddings,omitempty"`
Streaming bool `json:"streaming,omitempty" yaml:"streaming,omitempty"`
Tools bool `json:"tools,omitempty" yaml:"tools,omitempty"`
ParallelTools bool `json:"parallelTools,omitempty" yaml:"parallelTools,omitempty"`
Vision bool `json:"vision,omitempty" yaml:"vision,omitempty"`
Audio bool `json:"audio,omitempty" yaml:"audio,omitempty"`
PromptCache bool `json:"promptCache,omitempty" yaml:"promptCache,omitempty"`
Reasoning bool `json:"reasoning,omitempty" yaml:"reasoning,omitempty"`
JSONMode bool `json:"jsonMode,omitempty" yaml:"jsonMode,omitempty"`
StructuredOutputs bool `json:"structuredOutputs,omitempty" yaml:"structuredOutputs,omitempty"`
Batch bool `json:"batch,omitempty" yaml:"batch,omitempty"`
ComputerUse bool `json:"computerUse,omitempty" yaml:"computerUse,omitempty"`
WebSearch bool `json:"webSearch,omitempty" yaml:"webSearch,omitempty"`
FileInput bool `json:"fileInput,omitempty" yaml:"fileInput,omitempty"`
AudioInput bool `json:"audioInput,omitempty" yaml:"audioInput,omitempty"`
AudioOutput bool `json:"audioOutput,omitempty" yaml:"audioOutput,omitempty"`
SystemMessages bool `json:"systemMessages,omitempty" yaml:"systemMessages,omitempty"`
AssistantPrefill bool `json:"assistantPrefill,omitempty" yaml:"assistantPrefill,omitempty"`
}
Capabilities is the bag-of-bools feature flags every model declares. Open-ended over time; new flags can be added without a migration since the whole struct lives in JSONB.
type Deprecation ¶
type Deprecation struct {
Status DeprecationStatus `json:"status,omitempty" yaml:"status,omitempty" validate:"omitempty,oneof=active deprecated sunset"`
SunsetDate string `json:"sunsetDate,omitempty" yaml:"sunsetDate,omitempty"`
Replacement string `json:"replacement,omitempty" yaml:"replacement,omitempty" validate:"omitempty,uuid"`
}
Deprecation describes the lifecycle state of a Model.
type DeprecationStatus ¶
type DeprecationStatus string
DeprecationStatus enumerates the lifecycle states.
const ( DeprecationActive DeprecationStatus = "active" DeprecationDeprecated DeprecationStatus = "deprecated" DeprecationSunset DeprecationStatus = "sunset" )
type Modalities ¶
type Modalities struct {
Input []string `json:"input,omitempty" yaml:"input,omitempty"`
Output []string `json:"output,omitempty" yaml:"output,omitempty"`
}
Modalities lists input/output media types ("text", "image", "audio", ...).
type Model ¶
type Model struct {
Meta meta.Metadata `json:"metadata" yaml:"metadata"`
Spec Spec `json:"spec" yaml:"spec"`
}
Model is the published model definition.
func (*Model) PointerUpstream ¶ added in v0.2.0
PointerUpstream returns the upstream wire name of the snapshot the bare model name resolves to (Pointer → snapshot → Upstream()). Falls back to Pointer itself if no snapshot matches (shouldn't happen post-Validate).
func (*Model) Validate ¶
Validate runs intra-row rules via the shared meta.Validator and enforces the Model-specific invariants:
- Owner is required and must be provider-kind with a non-empty ID. Models always belong to a Provider.
- Snapshot names are unique within the model and Pointer must name one of them.
Cross-entity checks (Owner.ID resolves to a real Provider; Deprecation. Replacement resolves to a real Model; snapshot-name uniqueness across the catalog) live in the composition layer.
type Snapshot ¶
type Snapshot struct {
Name string `json:"name" yaml:"name" validate:"required,hostname_rfc1123"`
ReleasedAt string `json:"releasedAt,omitempty" yaml:"releasedAt,omitempty"`
OriginalName string `json:"originalName,omitempty" yaml:"originalName,omitempty"`
}
Snapshot is a dated checkpoint of a Model. Name is the customer-facing identifier (DNS-1123 slug; matches what the SDK sends in the `model` field). OriginalName is the upstream wire name; when omitted it defaults to Name — the common case where the slug-safe name already matches what the provider expects.
type Spec ¶
type Spec struct {
Family string `json:"family,omitempty" yaml:"family,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Capabilities Capabilities `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`
Modalities Modalities `json:"modalities,omitempty" yaml:"modalities,omitempty"`
// Context window split. ContextWindowTotal is canonical; the Input/Output
// pair is informational for models that publish a soft cap.
ContextWindowInput int `json:"contextWindowInput,omitempty" yaml:"contextWindowInput,omitempty" validate:"omitempty,gte=0"`
ContextWindowOutput int `json:"contextWindowOutput,omitempty" yaml:"contextWindowOutput,omitempty" validate:"omitempty,gte=0"`
ContextWindowTotal int `json:"contextWindowTotal,omitempty" yaml:"contextWindowTotal,omitempty" validate:"omitempty,gte=0"`
MaxOutputTokens int `json:"maxOutputTokens,omitempty" yaml:"maxOutputTokens,omitempty" validate:"omitempty,gte=0"`
KnowledgeCutoff string `json:"knowledgeCutoff,omitempty" yaml:"knowledgeCutoff,omitempty"`
ReleaseDate string `json:"releaseDate,omitempty" yaml:"releaseDate,omitempty"`
DeprecationDate string `json:"deprecationDate,omitempty" yaml:"deprecationDate,omitempty"`
Deprecation *Deprecation `json:"deprecation,omitempty" yaml:"deprecation,omitempty"`
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
Documentation string `json:"documentation,omitempty" yaml:"documentation,omitempty"`
License string `json:"license,omitempty" yaml:"license,omitempty"`
ProviderModelPageURL string `json:"providerModelPageURL,omitempty" yaml:"providerModelPageURL,omitempty" validate:"omitempty,http_url"`
Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` // nil = true
// Snapshots are the dated checkpoints this Model exposes. Every Model has
// at least one. Pointer names the snapshot the bare Model name resolves
// to at request time.
Snapshots []Snapshot `json:"snapshots" yaml:"snapshots" validate:"required,min=1,dive"`
Pointer string `json:"pointer" yaml:"pointer" validate:"required"`
}
Spec is the body. Cross-refs are stored as ids. The owning Provider (vendor) id lives on Meta.Owner.ID (Owner.Kind is always "provider"); there is no separate spec.providerId field.
Per-Host serving info (which Hosts can serve this Model) lives in standalone HostBinding entities (app/binding), not in Spec.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the Model data-access type.