Documentation
¶
Overview ¶
Package modelcaps provides model capability queries for the attachment system. It translates models.dev modality information into MIME-type support decisions used by the attachment routing logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ModelCapabilities ¶
type ModelCapabilities struct {
// contains filtered or unexported fields
}
ModelCapabilities describes what MIME types a given model can accept as document attachments.
func CapsWith ¶
func CapsWith(supportsImage, supportsPDF bool) ModelCapabilities
CapsWith constructs a ModelCapabilities value directly from booleans. This is intended for use in tests and provider implementations that need to create a capabilities value without hitting the network.
func Load ¶
func Load(modelID string) (ModelCapabilities, error)
Load fetches (or returns from cache) the capability record for the given model ID. The model ID should be in "provider/model" format as used by models.dev (e.g. "anthropic/claude-3-5-sonnet-20241022").
When the model is not found in the models.dev database, Load returns a conservative capability set that only allows text MIME types. The returned error is always nil; capability detection failures are silent and safe.
func LoadFromStore ¶
func LoadFromStore(store *modelsdev.Store, modelID string) ModelCapabilities
LoadFromStore is like Load but accepts an explicit *modelsdev.Store, making it convenient for tests that inject a pre-populated in-memory store.
func (ModelCapabilities) Supports ¶
func (mc ModelCapabilities) Supports(mimeType string) bool
Supports returns true when the model can accept an attachment with the given MIME type.
Resolution rules (in order):
- image/* → requires supportsImage (models.dev "image" modality)
- application/pdf → requires supportsPDF (models.dev "pdf" modality)
- text/* → always supported (plain text; TXT envelope is universally safe)
- Office/binary document MIMEs (DOCX, XLSX, PPTX, etc.) → not supported unless models.dev explicitly declares a document modality. models.dev currently has no "document" or "office" modality field, so these return false for all models until the schema is extended.
- Everything else (audio/*, video/*, unknown binary) → false