Skip to documentation
Documentation navigation

Documentation navigation

Documentation / guides

Model

Use the complete secret-free model descriptor and its copy semantics.

developer

Model is the value passed on each inference.Request. It deliberately contains no API key and no system prompt. Call Validate at the trust boundary before handing it to a client.

API surface

type Model struct {
	Provider  ProviderName
	APIFormat APIFormat
	BaseURL   string
	Name      string
	Origin    Origin
	Caps      Capabilities
	Limits    ContextLimits
	Sampling  Sampling
}

func (m Model) Validate() error
func (m Model) Key() ModelKey
func (m Model) Clone() Model
FieldSent on provider wire?Contract
Providerconsumer-definedOpaque backend namespace
APIFormatcodec selectionOpen string label
BaseURLroute inputEmpty wildcard or safe HTTPS/loopback HTTP URL
Nameprovider model IDMust be non-empty
OriginnoZero value is fail-safe OriginCustom
CapsnoLocal gating only
LimitsnoKnown context capacity; zero means unknown
Samplingcodec-dependentDialect-neutral defaults
descriptor := model.Model{
	Provider: model.ProviderName("acme"),
	APIFormat: model.APIFormat("acme-json"),
	BaseURL: "https://api.example.test/v1",
	Name: "chat-1",
}
if err := descriptor.Validate(); err != nil {
	panic(err)
}
stable := descriptor.Key()

Clone deep-copies Sampling pointers and the stop slice. Copy the descriptor before giving it to code that may mutate sampling metadata.

Proof

Related: Custom models, Sampling.

← back to documentation