modelcatalog

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package modelcatalog resolves immutable provider/model snapshots from the local coding configuration. It never performs discovery or network I/O.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("coding model catalog: invalid configuration")

ErrInvalid means a registry entry or selection cannot be resolved safely.

Functions

This section is empty.

Types

type Catalog

type Catalog interface {
	Resolve(Selection) (ResolvedModel, error)
	List() []Entry
}

Catalog is the read-only model lookup boundary used by CLI/TUI/runtime. Future extensions can supply the same interface without changing callers.

func New

func New(value config.Config) (Catalog, error)

New validates the complete local registry and returns a network-free catalog. The current selection is included even when its metadata is absent.

type Endpoint

type Endpoint struct {
	BaseURL         string
	AllowHTTP       bool
	AllowPrivateIPs bool
	Origin          string
}

Endpoint is the resolved provider connection boundary.

type Entry

type Entry struct {
	Ref                config.ModelRef
	ContextWindow      int
	StreamContinuation bool
	ReasoningLevels    []config.ReasoningLevel
	DefaultReasoning   *config.ReasoningLevel
	Variants           []string
	DefaultVariant     string
}

Entry is one selectable model and its declared presets.

type Limits

type Limits struct {
	ContextWindow int
}

Limits are local context metadata and are never sent as request options.

type ResolvedModel

type ResolvedModel struct {
	Ref                config.ModelRef
	Protocol           config.Protocol
	Endpoint           Endpoint
	Limits             Limits
	StreamContinuation bool
	// StreamIdleTimeout is the streaming idle bound the transport applies, after
	// the model's value has overridden the provider's. Zero means neither
	// declared one, so the adapter's own default stands; the retry window is
	// derived from whichever bound ends up in effect.
	StreamIdleTimeout time.Duration
	Compatibility     openai.Compatibility
	Capabilities      ai.CapabilityOverride
	Options           config.ModelOptions
	Variant           string
	ReasoningLevels   []config.ReasoningLevel
	ReasoningLevel    *config.ReasoningLevel
	ReasoningBudgets  map[config.ReasoningLevel]int
}

ResolvedModel is an immutable-by-convention runtime snapshot.

func (ResolvedModel) Clone

func (m ResolvedModel) Clone() ResolvedModel

Clone returns a fully detached runtime snapshot.

func (ResolvedModel) EffectiveReasoningLevel added in v0.1.8

func (m ResolvedModel) EffectiveReasoningLevel() (config.ReasoningLevel, bool)

EffectiveReasoningLevel reports the reasoning level the request assembly sends for this model, and whether one is selected at all.

[registry.resolve] folds the explicit selection, the variant's level and the model's DefaultReasoningLevel into ReasoningLevel, and the generation layer sends exactly that value. A false result means pips sends no level and the provider's own default applies, which pips cannot know: it ships no model capability database. A caller must therefore show that case as "default" or omit it rather than inventing a level.

func (ResolvedModel) Equal

func (m ResolvedModel) Equal(other ResolvedModel) bool

Equal reports value equality without relying on pointer or map identity.

type Selection

type Selection struct {
	Ref               config.ModelRef
	Variant           string
	ReasoningOverride *config.ReasoningLevel
}

Selection is one process-local model, variant, and reasoning choice.

func SelectionFromConfig

func SelectionFromConfig(value config.Config) Selection

SelectionFromConfig returns the initial process-local selection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL