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 IsNonChatModel(modelID string) bool
- func LookupContextWindow(model string) (int, bool)
- func ModalitiesLabel(modelID string) string
- func NonChatModels() []string
- func SetGatewayContextWindows(windows map[string]int)
- func SetGatewayModalities(modalities map[string]sdk.ModelModalities)
- func SetNonChatModels(ids []string)
- func SupportsAudio(modelID string) bool
- func SupportsVideo(modelID string) bool
- 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 IsNonChatModel ¶ added in v0.189.0
IsNonChatModel reports whether the model is one of the gateway's view-only non-chat models. Models the gateway never reported (e.g. before the first fetch) return false.
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, otherwise the model's extra input modalities ("vision", "audio", "video") comma-joined.
func NonChatModels ¶ added in v0.189.0
func NonChatModels() []string
NonChatModels returns the gateway-reported non-chat model ids.
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 SetNonChatModels ¶ added in v0.189.0
func SetNonChatModels(ids []string)
SetNonChatModels replaces the gateway-reported model ids that cannot serve /chat/completions (speech-to-text, text-to-speech, image-gen, video models). They are listed in pickers for visibility but are not selectable.
func SupportsAudio ¶ added in v0.189.0
SupportsAudio reports whether the model works with audio on either side (audio input like speech-to-text/multimodal chat, or audio output like text-to-speech). Models not in the registry return false.
func SupportsVideo ¶ added in v0.189.0
SupportsVideo reports whether the model works with video on either side. Models not in the registry return false.
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.