external

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMatchingModel = errors.New("no matching model available")

Functions

func AvailableModels

func AvailableModels(ctx context.Context, options *Options) (map[string]bool, error)

AvailableModels returns the set of model IDs advertised by the Wingman server addressed by options.

func IsAnthropic

func IsAnthropic(id string) bool

IsAnthropic matches Anthropic Claude model IDs.

func IsGoogle

func IsGoogle(id string) bool

IsGoogle matches Google Gemini model IDs.

func IsOpenAI

func IsOpenAI(id string) bool

IsOpenAI matches OpenAI GPT model IDs.

func Model

func Model(ctx context.Context, options *Options, modelOpts *ModelOptions) (string, error)

Model returns the highest-preference available model matching modelOpts, or ErrNoMatchingModel if none are available.

func Models

func Models(ctx context.Context, options *Options, modelOpts *ModelOptions) ([]string, error)

Models returns the IDs of available models matching modelOpts, in preference order. Returns nil if nothing matches.

func Pick

func Pick(available map[string]bool, predicate func(id string) bool) string

Pick returns the first available model ID matching predicate. The available set is scanned in descending lexicographic order so that higher version suffixes (e.g. "claude-opus-4-7" over "claude-opus-4-5") are preferred. Returns "" if no model matches.

Types

type ModelFilter

type ModelFilter func(id string) bool

ModelFilter narrows a candidate model list by ID. A nil filter matches every model.

type ModelKind

type ModelKind int
const (
	ModelDefault ModelKind = iota
	ModelFast
)

type ModelOptions

type ModelOptions struct {
	Kind   ModelKind
	Filter ModelFilter
}

type Options

type Options struct {
	Path string
	Env  []string

	WingmanURL   string
	WingmanToken string
}

func WithDefaults

func WithDefaults(options *Options) *Options

WithDefaults fills in any missing Options fields from environment variables. The same pointer is returned for chaining; a new zero-value Options is allocated if nil is passed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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