catalog

package
v0.81.12 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 2 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package catalog ships the built-in SpeechKit provider and model catalog.

DefaultCatalog returns the immutable set of speechkit.ProviderProfile values SpeechKit knows about, grouped by speechkit.Mode; Catalog.With extends it with host-owned providers without mutating the built-in set. DefaultProviderDefaults and DefaultProviderMatrix describe per-provider auth, transport and feature support for setup UIs, and DefaultModelRegistry is the source of truth for model IDs, lifecycles and freshness metadata.

The root speechkit package owns the contracts this catalog is expressed in (profiles, modes, capabilities, speechkit.RuntimePolicy); this package owns the data. Hosts that never show a provider picker do not need to import it.

Stability: Stable — no breaking change without a minor version bump and a changelog callout.

Index

Constants

View Source
const (
	// ProviderAuthNone needs no secret (Ollama, a local provider).
	ProviderAuthNone = "none"
	// ProviderAuthAPIKey needs the vendor's API key.
	ProviderAuthAPIKey = "api_key"
	// ProviderAuthToken needs a platform access token (Hugging Face).
	ProviderAuthToken = "token"
	// ProviderAuthHostDependencies needs no secret but host-installed runtime
	// files, such as the whisper.cpp binary and model of a local built-in.
	ProviderAuthHostDependencies = "host_dependencies"
	// ProviderAuthOptionalAPIKey may take a key, as a self-hosted server might
	// require one.
	ProviderAuthOptionalAPIKey = "optional_api_key"

	// ProviderTransportLocal runs in-process or as a managed subprocess.
	ProviderTransportLocal = "local"
	// ProviderTransportHTTP is a plain-http local or self-hosted endpoint.
	ProviderTransportHTTP = "http"
	// ProviderTransportHTTPS is a public https vendor API.
	ProviderTransportHTTPS = "https"
	// ProviderTransportWebSocket is a native realtime voice session.
	ProviderTransportWebSocket = "websocket"
	// ProviderTransportPipeline is a cascaded STT/LLM/TTS voice agent.
	ProviderTransportPipeline = "pipeline"
)

Values of the AuthRequirement and Transport fields of speechkit.ProviderProfile, as filled in by DefaultProviderAuthRequirement and DefaultProviderTransport. Both are semantic classes: hosts map them onto their own secret stores and network policy.

View Source
const DefaultLocalBuiltInLLMModel = "ggml-org/gemma-4-E2B-it-GGUF:Q8_0"

DefaultLocalBuiltInLLMModel is the Hugging Face GGUF reference (repository:quantization) the Local Built-in Assist profile pins as its model id; hosts use it as the default model of their SpeechKit-managed llama.cpp runtime.

View Source
const ModelFreshnessSLA = 7 * 24 * time.Hour

ModelFreshnessSLA is the maximum age of LastVerifiedAt before a default or recommended model row is considered stale.

Variables

View Source
var (
	// ErrDuplicateProfileID is returned by NewCatalog and Catalog.With when two
	// profiles share an id.
	ErrDuplicateProfileID = errors.New("speechkit: duplicate provider profile id")
	// ErrInvalidProfile wraps the mode-contract violation that keeps a profile
	// out of a Catalog.
	ErrInvalidProfile = errors.New("speechkit: invalid provider profile")
)

Functions

func CurrentModelID added in v0.74.0

func CurrentModelID(provider, modelID string) string

CurrentModelID returns modelID, or its successor when modelID is retired.

func DefaultProviderAuthRequirement

func DefaultProviderAuthRequirement(profile speechkit.ProviderProfile) string

DefaultProviderAuthRequirement describes the credential class a host must satisfy before a provider profile can run. It is intentionally semantic: hosts map the value to their own env vars or secret stores.

func DefaultProviderProfiles

func DefaultProviderProfiles() []speechkit.ProviderProfile

DefaultProviderProfiles returns the built-in framework provider catalog for the three strict SpeechKit modes. The Windows desktop host adapts this public catalog into its internal runtime model; the catalog itself belongs to the reusable framework layer.

func DefaultProviderTransport

func DefaultProviderTransport(profile speechkit.ProviderProfile) string

DefaultProviderTransport exposes the dominant runtime transport class for a profile. Native realtime providers use websocket; cascaded voice providers use pipeline; batch/provider APIs use HTTPS/HTTP/local.

func MissingFreshnessReports

func MissingFreshnessReports(rows []ProviderModelDescriptor) []string

MissingFreshnessReports lists default/recommended registry rows that still lack LastVerifiedAt.

func NormalizeProviderID

func NormalizeProviderID(provider string) string

NormalizeProviderID maps a provider alias or a "<mode>.<provider>.<model>" profile id to its canonical provider id. Profile ids are reduced to their provider segment first, so every mode (stt, assist, utility, realtime, tts, speaker) shares one alias table; third-party providers pass through as-is.

func ProfilesForMode

func ProfilesForMode(mode speechkit.Mode) []speechkit.ProviderProfile

ProfilesForMode returns the built-in profiles for mode (normalised first), in catalog order; nil when no profile belongs to it.

func ProviderCredentialTarget

func ProviderCredentialTarget(profile speechkit.ProviderProfile) string

ProviderCredentialTarget returns the canonical provider id under which a host stores the profile's credential, or "" when the profile needs none. Every profile of a provider shares the target, so a key entered once serves all of its modes. The one exception is Google dictation: Cloud Speech-to-Text needs its own key ("google_stt"), separate from the Gemini API key that serves Gemini Live, Gemini Transcribe and Cloud Text-to-Speech.

func ProviderFamily added in v0.76.6

func ProviderFamily(provider string) string

ProviderFamily maps a provider id, alias or profile id onto the provider an allowlist names: a product served by another provider's account or endpoint belongs to that provider (foundry-voicelive and foundry-gpt-live are foundry, gpt-live is openai), the bundled Piper engine is local, and the self-hosted adapters (vps, openedai) are selfhosted. Everything else is its canonical id from NormalizeProviderID.

func ProviderIDForExecutionMode

func ProviderIDForExecutionMode(mode speechkit.ExecutionMode) string

ProviderIDForExecutionMode maps a runtime execution mode to the canonical provider id it implies ("local", "selfhosted", "huggingface", "openai", "groq", "deepgram", "assemblyai", "ollama", "openrouter", "foundry" or "xai"); "" for a mode that does not imply a single provider.

func ProviderIDForProfile

func ProviderIDForProfile(profile speechkit.ProviderProfile) string

ProviderIDForProfile resolves the canonical provider id of profile: the explicit Provider field first, then its ID (a "<mode>.<provider>.<model>" profile id reduced to the provider segment, or a bare provider alias), then the id implied by its ExecutionMode. It returns "" when none of them names a provider.

func ProviderInAllowlist added in v0.76.6

func ProviderInAllowlist(provider string, allowed []string) bool

ProviderInAllowlist reports whether allowed names provider. Both sides are compared by ProviderFamily, so "foundry" admits every Foundry surface and "github_copilot" matches "github-copilot". An empty provider is never named; an empty allowed list names nothing (what an empty list means is the host's decision).

func ProviderKindsForMode

func ProviderKindsForMode(mode speechkit.Mode) []speechkit.ProviderKind

ProviderKindsForMode returns the distinct provider kinds the built-in profiles of mode cover, in the fixed product order local built-in, local provider, cloud provider, direct provider. ValidateDefaultCatalog expects all four for every strict mode.

func ProviderProfileRequiresCredential

func ProviderProfileRequiresCredential(profile speechkit.ProviderProfile) bool

ProviderProfileRequiresCredential reports whether a host must supply a secret before the profile can run: true for the api_key and token requirements (and any unrecognised value), false for none, host_dependencies, optional_api_key and an empty requirement.

func ProviderProfileWithDefaults

func ProviderProfileWithDefaults(profile speechkit.ProviderProfile) speechkit.ProviderProfile

ProviderProfileWithDefaults returns a copy with framework-standard provider metadata filled in. Explicit profile metadata wins; missing provider, credential, and transport fields are derived from the canonical provider id, execution mode, and mode capabilities.

func ReplacementModelID added in v0.74.0

func ReplacementModelID(provider, modelID string) (string, bool)

ReplacementModelID returns the successor of a retired model id for provider. Retirement chains are followed to the newest id. ok is false when modelID is not retired. provider is matched after NormalizeProviderID except for the adapter-scoped ids listed on ModelRetirement.

func StaleFreshnessReports

func StaleFreshnessReports(rows []ProviderModelDescriptor, now time.Time) []string

StaleFreshnessReports lists default/recommended rows whose LastVerifiedAt is missing, unparsable, or older than ModelFreshnessSLA relative to now.

func ValidateDefaultCatalog

func ValidateDefaultCatalog() error

ValidateDefaultCatalog verifies the framework invariant that every strict mode exposes all four provider groups and every visible profile satisfies its mode contract. v0.37 added ModeTTS as a model-selection axis with the same four-provider-group invariant (Local Built-in via Piper, Local Provider via Kokoro/openedai-speech, Cloud Provider via Hugging Face Parler, Direct Provider via OpenAI + Google).

Types

type Catalog

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

Catalog is an immutable, host-composable set of provider profiles.

The built-in catalog (DefaultCatalog) is what the reference apps ship. A host that adds its own STT, TTS or realtime provider describes it as a ProviderProfile and extends the catalog with With; the result feeds the same matrix, defaults, policy filtering and mode validation the built-ins go through, so the provider shows up in setup UIs, readiness and routing like any shipped one. Every profile is normalised with ProviderProfileWithDefaults and checked against its mode contract on the way in — a Catalog never holds an invalid profile.

func DefaultCatalog

func DefaultCatalog() *Catalog

DefaultCatalog returns the built-in framework catalog. It is the same data as DefaultProviderProfiles, exposed as a Catalog so hosts extend it with With instead of concatenating slices by hand.

func NewCatalog

func NewCatalog(profiles ...speechkit.ProviderProfile) (*Catalog, error)

NewCatalog builds a catalog from the given profiles. Profiles are normalised, validated against their mode contract, and must have unique ids.

func (*Catalog) Filter

Filter applies a RuntimePolicy and returns the profiles a host may present.

func (*Catalog) Profile

func (c *Catalog) Profile(id string) (speechkit.ProviderProfile, bool)

Profile looks a profile up by id. Legacy ids are resolved through NormalizeProviderProfileID first.

func (*Catalog) ProfileIDsForProviders added in v0.76.6

func (c *Catalog) ProfileIDsForProviders(providers []string) []string

ProfileIDsForProviders returns the ids of the profiles whose provider (see ProviderIDForProfile) the provider ids in providers name, compared by ProviderFamily, in catalog order. A host expands a provider allowlist into speechkit.RuntimePolicy.AllowedProfiles with it. The result is empty, never nil, when nothing matches.

func (*Catalog) Profiles

func (c *Catalog) Profiles() []speechkit.ProviderProfile

Profiles returns a copy of every profile in catalog order.

func (*Catalog) ProfilesForMode

func (c *Catalog) ProfilesForMode(mode speechkit.Mode) []speechkit.ProviderProfile

ProfilesForMode returns the profiles that belong to mode, in catalog order.

func (*Catalog) ProviderDefaults

func (c *Catalog) ProviderDefaults() []ProviderDefault

ProviderDefaults returns the preferred profile per provider and mode, the same shape DefaultProviderDefaults returns for the built-ins.

func (*Catalog) ProviderMatrix

func (c *Catalog) ProviderMatrix() []ProviderMatrixRow

ProviderMatrix groups the catalog by provider with per-feature support, the same shape DefaultProviderMatrix returns for the built-ins.

func (*Catalog) With

func (c *Catalog) With(profiles ...speechkit.ProviderProfile) (*Catalog, error)

With returns a new Catalog containing the receiver's profiles plus the given ones. The receiver is unchanged. Ids must not collide with existing profiles; a host that wants to replace a built-in filters Profiles() first and builds a fresh catalog with NewCatalog.

type ModelRetirement added in v0.74.0

type ModelRetirement struct {
	Provider    string `json:"provider"`
	ModelID     string `json:"modelId"`
	Replacement string `json:"replacement"`
	// RetiredAt is the day SpeechKit stopped offering the model.
	RetiredAt string `json:"retiredAt"`
	// VendorSunsetAt is the vendor's announced shutdown day, when known.
	VendorSunsetAt string `json:"vendorSunsetAt,omitempty"`
	Reason         string `json:"reason"`
	SourceURL      string `json:"sourceUrl"`
}

ModelRetirement records a vendor model id SpeechKit no longer offers and the id that replaces it. Hosts use it to migrate persisted configs so a retired id never reaches the wire again.

Provider is a canonical catalog provider id (see NormalizeProviderID), plus the adapter-scoped ids "foundry-voicelive" (Voice Live brains, which the service hosts without a deployment) and "assemblyai-llm-gateway" (the AssemblyAI LLM Gateway, whose ids differ from the Gemini API's). Foundry deployment names are deliberately absent: they are user-owned names, not model ids, and renaming them would point a config at a deployment that does not exist.

func RetiredModels added in v0.74.0

func RetiredModels() []ModelRetirement

RetiredModels returns every model SpeechKit retired, with its successor. A fresh slice is returned on every call.

type ProviderDefault

type ProviderDefault struct {
	Provider           string                   `json:"provider"`
	DisplayName        string                   `json:"displayName"`
	Mode               speechkit.Mode           `json:"mode"`
	ProfileID          string                   `json:"profileId"`
	ModelID            string                   `json:"modelId,omitempty"`
	ProviderKind       speechkit.ProviderKind   `json:"providerKind"`
	ExecutionMode      speechkit.ExecutionMode  `json:"executionMode,omitempty"`
	Support            ProviderSupportKind      `json:"support"`
	Capabilities       []speechkit.Capability   `json:"capabilities,omitempty"`
	NativeOptions      []string                 `json:"nativeOptions,omitempty"`
	AuthRequirement    string                   `json:"authRequirement,omitempty"`
	CredentialRequired bool                     `json:"credentialRequired"`
	CredentialTarget   string                   `json:"credentialTarget,omitempty"`
	Transport          string                   `json:"transport,omitempty"`
	EvidenceURL        string                   `json:"evidenceUrl,omitempty"`
	Default            bool                     `json:"default,omitempty"`
	Recommended        bool                     `json:"recommended,omitempty"`
	Experimental       bool                     `json:"experimental,omitempty"`
	Variants           []speechkit.ModelVariant `json:"variants,omitempty"`
}

ProviderDefault is one catalog profile as a setup UI sees it: the profile's identity and flags plus the provider metadata the matrix derives (canonical provider id and display name, support grade, native option ids, whether a credential is required and where it is stored). It serialises to JSON for server settings surfaces.

func DefaultProviderDefaults

func DefaultProviderDefaults() []ProviderDefault

DefaultProviderDefaults returns the preferred profile of every built-in provider for each mode it supports (the first of its sorted matrix profiles), in matrix row order and then mode order: Dictation, Assist, Voice Agent, TTS.

func FindProviderDefault

func FindProviderDefault(provider string, mode speechkit.Mode) (ProviderDefault, bool)

FindProviderDefault returns the preferred built-in profile of provider (normalised) for mode (normalised); ok is false when the provider has no profile for that mode.

func ProviderDefaultsFor

func ProviderDefaultsFor(provider string) []ProviderDefault

ProviderDefaultsFor returns the DefaultProviderDefaults entries whose provider matches provider after NormalizeProviderID; nil when unknown.

type ProviderFeature

type ProviderFeature string

ProviderFeature is one column of the provider matrix: a product feature a setup UI asks "does this provider do it, and how" about.

const (
	ProviderFeatureDictation ProviderFeature = "dictation"
	// ProviderFeatureDictationStreaming is native only for profiles with
	// [speechkit.CapabilityNativeDictationStream]; other dictation profiles
	// grade as cascaded.
	ProviderFeatureDictationStreaming    ProviderFeature = "dictation_streaming"
	ProviderFeatureLongTranscription     ProviderFeature = "long_transcription"
	ProviderFeatureSpeakerDiarization    ProviderFeature = "speaker_diarization"
	ProviderFeatureSpeakerIdentification ProviderFeature = "speaker_identification"
	ProviderFeatureAssist                ProviderFeature = "assist"
	// ProviderFeatureRealtimeVoice is native for realtime-audio voice agents
	// and cascaded for pipeline-fallback ones.
	ProviderFeatureRealtimeVoice ProviderFeature = "realtime_voice"
	ProviderFeatureTTS           ProviderFeature = "tts"
)

Matrix features, in the order rows list them: five Dictation features, then one each for Assist, Voice Agent and TTS.

type ProviderFeatureSupport

type ProviderFeatureSupport struct {
	Feature       ProviderFeature     `json:"feature"`
	Support       ProviderSupportKind `json:"support"`
	Mode          speechkit.Mode      `json:"mode,omitempty"`
	ProfileID     string              `json:"profileId,omitempty"`
	ModelID       string              `json:"modelId,omitempty"`
	NativeOptions []string            `json:"nativeOptions,omitempty"`
	EvidenceURL   string              `json:"evidenceUrl,omitempty"`
}

ProviderFeatureSupport is one matrix cell: the support grade a provider reaches for a feature and the profile (mode, profile and model id, native options, evidence URL) that earns it. Mode is set even when unsupported.

type ProviderMatrixRow

type ProviderMatrixRow struct {
	Provider    string                   `json:"provider"`
	DisplayName string                   `json:"displayName"`
	Profiles    []ProviderDefault        `json:"profiles"`
	Features    []ProviderFeatureSupport `json:"features"`
}

ProviderMatrixRow is one provider in the setup matrix: its canonical id and display name, every profile it contributes (sorted, see DefaultProviderMatrix) and one ProviderFeatureSupport per matrix feature.

func DefaultProviderMatrix

func DefaultProviderMatrix() []ProviderMatrixRow

DefaultProviderMatrix groups the built-in catalog by canonical provider id: one row per provider with its profiles (sorted by mode, then default, recommended, non-experimental, support grade and id) and the best support grade it reaches for each ProviderFeature. Rows follow the product's provider order; profiles without a resolvable provider id are skipped.

func FindProviderMatrixRow

func FindProviderMatrixRow(provider string) (ProviderMatrixRow, bool)

FindProviderMatrixRow returns the DefaultProviderMatrix row for provider after NormalizeProviderID; ok is false for an unknown provider.

func (ProviderMatrixRow) Feature

Feature returns the row's cell for feature; ok is false only when the row carries no such feature. A feature the provider lacks is still present, graded ProviderSupportUnsupported.

type ProviderModelDescriptor

type ProviderModelDescriptor struct {
	Provider    string                   `json:"provider"`
	ModelID     string                   `json:"modelId"`
	ProfileID   string                   `json:"profileId,omitempty"`
	Mode        speechkit.Mode           `json:"mode"`
	Name        string                   `json:"name"`
	Lifecycle   speechkit.ModelLifecycle `json:"lifecycle"`
	Default     bool                     `json:"default,omitempty"`
	Recommended bool                     `json:"recommended,omitempty"`
	SourceURL   string                   `json:"sourceUrl"`

	// Freshness metadata. Dates are calendar days
	// (YYYY-MM-DD) from vendor documentation. LastVerifiedAt is the day the
	// row was last checked against those docs. TestDefaultModelRegistryFreshnessSLA
	// always fails when a default/recommended row lacks it; the age check
	// against ModelFreshnessSLA only fails under SPEECHKIT_MODEL_FRESHNESS_GATE,
	// which the scheduled model-freshness-gate workflow sets.
	ReleasedAt           string `json:"releasedAt,omitempty"`
	DeprecatedAt         string `json:"deprecatedAt,omitempty"`
	SunsetAt             string `json:"sunsetAt,omitempty"`
	LastVerifiedAt       string `json:"lastVerifiedAt,omitempty"`
	MultilanguageCapable bool   `json:"multilanguageCapable,omitempty"`
}

ProviderModelDescriptor is the public source-of-truth row for model IDs that SpeechKit treats as framework defaults or first-class live-provider choices.

func DefaultModelRegistry

func DefaultModelRegistry() []ProviderModelDescriptor

DefaultModelRegistry returns the built-in model rows: the framework defaults and first-class live-provider choices per provider and mode, each with its lifecycle and freshness metadata. Provider ids are canonical catalog ids ("foundry-voicelive" is the Voice Live adapter, distinct from "foundry"). A fresh slice is returned on every call.

func FindModelDescriptor

func FindModelDescriptor(provider, modelID string) (ProviderModelDescriptor, bool)

FindModelDescriptor looks a registry row up by exact (not normalised) provider id and model id; ok is false when the registry has no such row.

type ProviderSupportKind

type ProviderSupportKind string

ProviderSupportKind grades how a provider delivers a feature, from ProviderSupportUnsupported to ProviderSupportNative; the matrix keeps the best grade any of the provider's profiles reaches.

const (
	// ProviderSupportUnsupported means no profile of the provider offers the
	// feature.
	ProviderSupportUnsupported ProviderSupportKind = "unsupported"
	// ProviderSupportPlanned marks an experimental, catalog-only profile that
	// is not yet allowed to run inference.
	ProviderSupportPlanned ProviderSupportKind = "planned"
	// ProviderSupportCascaded means the feature is composed from other
	// capabilities: a voice agent built as an STT/LLM/TTS pipeline, or
	// dictation streaming emulated over batch transcription.
	ProviderSupportCascaded ProviderSupportKind = "cascaded"
	// ProviderSupportRouted means the model is reached through a routing
	// platform (Hugging Face, OpenRouter) rather than the vendor's own API.
	ProviderSupportRouted ProviderSupportKind = "routed"
	// ProviderSupportNative means the provider's own API serves the feature
	// directly.
	ProviderSupportNative ProviderSupportKind = "native"
)

Support grades, lowest to highest.

Jump to

Keyboard shortcuts

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