Documentation
¶
Overview ¶
Package models provides utilities for working with LLM models.
Index ¶
- func IsChatCapableModalities(mods sdk.ModelModalities) bool
- func IsImageGenModalities(mods sdk.ModelModalities) bool
- func IsImageGenerationModel(modelID string) bool
- func LookupContextWindow(model string) (int, bool)
- func ModalitiesLabel(modelID string) string
- func SetGatewayContextWindows(windows map[string]int)
- func SetGatewayModalities(modalities map[string]sdk.ModelModalities)
- func SupportsVision(modelID string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsChatCapableModalities ¶ added in v0.185.1
func IsChatCapableModalities(mods sdk.ModelModalities) bool
IsChatCapableModalities reports whether a modality set describes a model that can serve /chat/completions: it accepts "text" input and produces "text" output. Speech-to-text (audio in), text-to-speech (audio out), image generation and video models all fail this predicate. Modality sets that do not include text at all are naturally rejected, including the empty set the gateway leaves behind when it has no data for a model.
func IsImageGenModalities ¶
func IsImageGenModalities(mods sdk.ModelModalities) bool
IsImageGenModalities reports whether a modality set describes an image-generation model: it outputs "image" but not "text", so it can produce pictures but cannot chat. Vision chat models (image in, text out) return false.
func IsImageGenerationModel ¶
IsImageGenerationModel reports whether the model generates images rather than text (see IsImageGenModalities). Falls back to false when the model is not in the registry.
func LookupContextWindow ¶
LookupContextWindow returns the matched context window size and whether a real match was found (from user config override or gateway data). Unknown models return (0, false) - there is no built-in fallback, so callers must gate window-dependent features on the second return.
func ModalitiesLabel ¶
ModalitiesLabel returns a compact human-readable label for a model's modalities, or "" when the model is not in the registry: "image-gen" for image-generation models, "vision" for image-accepting chat models, "" otherwise.
func SetGatewayContextWindows ¶
SetGatewayContextWindows replaces the gateway-reported context windows (from /v1/models?include=context_window). Keys are full "provider/model" ids; matching is exact on the lowercased id.
func SetGatewayModalities ¶
func SetGatewayModalities(modalities map[string]sdk.ModelModalities)
SetGatewayModalities replaces the gateway-reported modalities (from /v1/models?include=modalities). Keys are full "provider/model" ids; matching is exact on the lowercased id.
func SupportsVision ¶
SupportsVision reports whether the model accepts native image input (input modalities include both "text" and "image"). Models not in the registry return false.
Types ¶
This section is empty.