modelprofiles

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package modelprofiles provides per-model capability metadata, mirroring langchain's ModelProfile / ModelProfileRegistry (langchain_model_profiles).

Index

Constants

This section is empty.

Variables

View Source
var DefaultRegistry = NewRegistry()

DefaultRegistry is shared across the package.

Functions

func Register

func Register(p ModelProfile)

Register registers a profile on the default registry.

Types

type Modality

type Modality string

Modality describes the input/output modalities a model supports.

const (
	// ModalityText is plain text input/output.
	ModalityText Modality = "text"
	// ModalityImage is image input (multimodal).
	ModalityImage Modality = "image"
	// ModalityVideo is video input (multimodal).
	ModalityVideo Modality = "video"
	// ModalityAudio is audio input/output (multimodal).
	ModalityAudio Modality = "audio"
	// ModalityFile is file attachments.
	ModalityFile Modality = "file"
)

type ModelProfile

type ModelProfile struct {
	// Name is the canonical model name, e.g. "gpt-5".
	Name string
	// Provider is the provider id, e.g. "openai", "anthropic".
	Provider string
	// ContextWindow is the maximum input context length in tokens (0 if unknown).
	ContextWindow int
	// MaxOutputTokens is the maximum output token budget (0 if unknown).
	MaxOutputTokens int
	// Modalities lists the input/output modalities the model supports.
	Modalities []Modality
	// ToolCalling reports whether the model supports tool/function calling.
	ToolCalling bool
	// StructuredOutput reports whether the model supports schema-constrained
	// output (structured output).
	StructuredOutput bool
	// Reasoning reports whether the model supports reasoning/thinking.
	Reasoning bool
	// Streaming reports whether the model supports streaming.
	Streaming bool
}

ModelProfile describes the capabilities of a single model.

func Lookup

func Lookup(model string) *ModelProfile

Lookup returns a profile from the default registry, or nil if unknown.

func (ModelProfile) Supports

func (p ModelProfile) Supports(modalities ...Modality) bool

Supports reports whether the model profile advertises all the given modalities.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is a thread-safe store of model profiles, keyed by provider then name.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty registry.

func (*Registry) All

func (r *Registry) All() []ModelProfile

All returns a copy of all registered profiles.

func (*Registry) Get

func (r *Registry) Get(name string) (ModelProfile, bool)

Get returns the profile for a model name, resolving aliases first.

func (*Registry) Lookup

func (r *Registry) Lookup(name string) *ModelProfile

Lookup returns the profile for a model, or nil if unknown.

func (*Registry) Register

func (r *Registry) Register(p ModelProfile)

Register adds a profile to the registry. Registering a profile with the same name as an existing one replaces it.

func (*Registry) RegisterAlias

func (r *Registry) RegisterAlias(alias, canonical string)

RegisterAlias maps an alias (e.g. a provider-specific name) to a canonical model name already registered.

Jump to

Keyboard shortcuts

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