Documentation
¶
Overview ¶
Package provideropts defines SpeechKit's provider-neutral voice option vocabulary and the manifest/resolve types used by concrete provider adapters.
Stability: Stable — no breaking change without a minor version bump and a changelog callout.
Index ¶
- Constants
- func ManifestsByProvider() map[string][]ProviderOptionManifest
- type EffectiveOption
- type EffectiveOptions
- func (e EffectiveOptions) Bool(id OptionID) bool
- func (e EffectiveOptions) Float(id OptionID) float64
- func (e EffectiveOptions) Int(id OptionID) int
- func (e EffectiveOptions) String(id OptionID) string
- func (e EffectiveOptions) StringList(id OptionID) []string
- func (e EffectiveOptions) Value(id OptionID) any
- type OptionDefinition
- type OptionID
- type OptionSupport
- type OptionType
- type ProviderOptionManifest
- type ResolveInput
- type SupportStatus
- type UnsupportedOptionReport
- type ValueSource
- type Values
- func (v Values) Bool(id OptionID) bool
- func (v Values) Clone() Values
- func (v Values) Float(id OptionID) float64
- func (v Values) Get(id OptionID) any
- func (v Values) Has(id OptionID) bool
- func (v Values) Int(id OptionID) int
- func (v Values) Merge(other Values) Values
- func (v Values) String(id OptionID) string
- func (v Values) StringList(id OptionID) []string
Constants ¶
const ( // SchemaProviderOptions is the schema identifier of the manifest format, // echoed by the catalog API. SchemaProviderOptions = "speechkit.provider_options.v1" // ManifestUpdated is the date (YYYY-MM-DD) the built-in manifests were // last audited against vendor documentation. ManifestUpdated = "2026-09-30" // Modalities a manifest describes; [FindManifest] keys on them. ModalitySTT = "stt" ModalityTTS = "tts" ModalityVoiceAgent = "voice_agent" )
Metadata stamped on every built-in manifest.
Variables ¶
This section is empty.
Functions ¶
func ManifestsByProvider ¶
func ManifestsByProvider() map[string][]ProviderOptionManifest
ManifestsByProvider groups DefaultManifests by provider identifier; a provider that serves several modalities has one entry per modality.
Types ¶
type EffectiveOption ¶
type EffectiveOption struct {
ID OptionID `json:"id"`
Value any `json:"value,omitempty"`
Source ValueSource `json:"source"`
Support OptionSupport `json:"support"`
}
EffectiveOption is one resolved option: the winning Value, the layer it came from, and the provider's support row for it.
type EffectiveOptions ¶
type EffectiveOptions struct {
Provider string `json:"provider"`
Modality string `json:"modality"`
ProfileID string `json:"profileId,omitempty"`
Options map[OptionID]EffectiveOption `json:"options"`
Unsupported []UnsupportedOptionReport `json:"unsupported,omitempty"`
}
EffectiveOptions is the result of Resolve for one provider and modality: every option seen in the manifest or any input layer, plus reports for explicitly configured options the provider cannot honor.
func Resolve ¶
func Resolve(input ResolveInput) EffectiveOptions
Resolve merges the layers of input into one EffectiveOptions. For each option the highest-precedence layer that has it wins; options absent from the manifest count as unsupported and are reported when explicitly configured to a non-zero value. Options are processed in sorted ID order so the Unsupported list is deterministic.
func (EffectiveOptions) Bool ¶
func (e EffectiveOptions) Bool(id OptionID) bool
Bool returns the resolved bool for id, or false when absent or not a bool.
func (EffectiveOptions) Float ¶
func (e EffectiveOptions) Float(id OptionID) float64
Float returns the resolved value for id as a float64, accepting float64, float32, int, int32, and int64; it returns 0 when absent or of another type.
func (EffectiveOptions) Int ¶
func (e EffectiveOptions) Int(id OptionID) int
Int returns the resolved value for id as an int, accepting int, int32, int64, and float64 (truncated); it returns 0 when absent or of another type.
func (EffectiveOptions) String ¶
func (e EffectiveOptions) String(id OptionID) string
String returns the trimmed resolved string for id, or "" when absent or not a string.
func (EffectiveOptions) StringList ¶
func (e EffectiveOptions) StringList(id OptionID) []string
StringList returns the resolved value for id with the same coercion rules as Values.StringList, or nil when absent.
func (EffectiveOptions) Value ¶
func (e EffectiveOptions) Value(id OptionID) any
Value returns the raw resolved value for id, or nil when the option was not resolved.
type OptionDefinition ¶
type OptionDefinition struct {
ID OptionID `json:"id"`
Label string `json:"label"`
Description string `json:"description,omitempty"`
Type OptionType `json:"type"`
Advanced bool `json:"advanced,omitempty"`
}
OptionDefinition is the UI-facing description of an option: its value Type plus a Label and Description; Advanced hides it from basic settings surfaces.
type OptionID ¶
type OptionID string
OptionID names one provider-neutral voice option. A ProviderOptionManifest says how each provider adapter honors it.
const ( // OptionLanguage is the recognition or synthesis language (BCP-47). OptionLanguage OptionID = "language" // OptionDetectLanguage asks the provider to detect the spoken language. OptionDetectLanguage OptionID = "detect_language" // OptionPunctuation enables automatic punctuation. OptionPunctuation OptionID = "punctuation" // OptionSmartFormat enables provider text formatting of dates, numbers, // and similar entities. OptionSmartFormat OptionID = "smart_format" // OptionDictation turns spoken punctuation commands into punctuation. OptionDictation OptionID = "dictation" // OptionFillerWords keeps filler words such as "um" in the transcript. OptionFillerWords OptionID = "filler_words" // OptionNumerals writes spoken numbers as digits. OptionNumerals OptionID = "numerals" // OptionVocabularyBias sends the resolved Words as provider vocabulary // hints. OptionVocabularyBias OptionID = "vocabulary_bias" // OptionKeyterms is a static list of terms to boost. OptionKeyterms OptionID = "keyterms" // OptionPromptHint is free-text prompt context for Whisper-style STT. OptionPromptHint OptionID = "prompt_hint" // OptionSpeakerDiarization labels speakers in the transcript. OptionSpeakerDiarization OptionID = "speaker_diarization" // OptionTimestamps requests word-level timing. OptionTimestamps OptionID = "timestamps" // OptionEndpointingMs is the silence, in milliseconds, that ends an // utterance or turn. OptionEndpointingMs OptionID = "endpointing_ms" // OptionTurnDetection enables server-side turn detection; some providers // take a confidence threshold instead of a bool. OptionTurnDetection OptionID = "turn_detection" // OptionVoice selects the TTS voice or speak model. OptionVoice OptionID = "voice" // OptionSpeed is the TTS speaking rate. OptionSpeed OptionID = "speed" // OptionAudioFormat selects the TTS output encoding or container. OptionAudioFormat OptionID = "audio_format" // OptionContextPrompt is the system or context prompt of a streaming STT // or Voice Agent session. OptionContextPrompt OptionID = "context_prompt" // OptionLanguageHints lists likely languages for multilingual sessions. OptionLanguageHints OptionID = "language_hints" // OptionPrivacyRedaction redacts personal information from transcripts. OptionPrivacyRedaction OptionID = "privacy_redaction" // OptionVoiceFocus suppresses background noise so recognition follows the // primary speaker. OptionVoiceFocus OptionID = "voice_focus" // OptionMedicalDomain routes to a medical-domain model. OptionMedicalDomain OptionID = "medical_domain" // OptionReasoningEffort sets the Voice Agent model's reasoning effort. OptionReasoningEffort OptionID = "reasoning_effort" // OptionTranslation enables realtime translation. OptionTranslation OptionID = "translation" // OptionTranscriptionOnly runs a Voice Agent session as transcription // without agent responses. OptionTranscriptionOnly OptionID = "transcription_only" // OptionResume resumes an interrupted Voice Agent session. OptionResume OptionID = "resume" // OptionNoStore asks the provider not to retain the request content // beyond the time it takes to answer, and not to train on it. What that // costs differs per vendor: a query parameter for some, an account or // project setting for others, and nothing at all for a local runtime. // The manifest says which, so a retention policy can refuse a provider // that cannot assert it rather than promising something untrue. OptionNoStore OptionID = "no_store" )
Provider-neutral option identifiers. The same ID may back a different native parameter, or none at all, in each provider manifest.
type OptionSupport ¶
type OptionSupport struct {
ID OptionID `json:"id"`
Status SupportStatus `json:"status"`
NativeKey string `json:"nativeKey,omitempty"`
Implemented bool `json:"implemented"`
EvidenceURL string `json:"evidenceUrl,omitempty"`
Notes string `json:"notes,omitempty"`
Definition OptionDefinition `json:"definition"`
}
OptionSupport is one manifest row: how a provider adapter treats one option. NativeKey names the provider parameter for native support, Implemented says whether the adapter actually wires it, EvidenceURL points at the vendor documentation the status was verified against, and Notes carries caveats such as how multilanguage is expressed.
type OptionType ¶
type OptionType string
OptionType is the value type an option carries in Values.
const ( TypeString OptionType = "string" TypeBool OptionType = "bool" TypeInt OptionType = "int" TypeFloat OptionType = "float" TypeStringList OptionType = "string_list" )
Option value types. The accessors on Values and EffectiveOptions coerce loosely typed values (JSON numbers, []any) to these shapes.
type ProviderOptionManifest ¶
type ProviderOptionManifest struct {
Schema string `json:"schema"`
Updated string `json:"updated"`
Provider string `json:"provider"`
Label string `json:"label"`
Modality string `json:"modality"`
ProfileIDs []string `json:"profileIds,omitempty"`
Options []OptionSupport `json:"options"`
}
ProviderOptionManifest declares, for one provider adapter and modality, how every option is supported. ProfileIDs lists the catalog profiles the manifest covers; Schema and Updated carry SchemaProviderOptions and ManifestUpdated.
func DefaultManifests ¶
func DefaultManifests() []ProviderOptionManifest
DefaultManifests returns the built-in option manifests SpeechKit registers for its STT, TTS, and Voice Agent adapters, one per provider and modality. Each call builds a fresh slice.
func FindManifest ¶
func FindManifest(provider, modality string) (ProviderOptionManifest, bool)
FindManifest returns the built-in manifest for the adapter identifier provider and modality (one of the Modality constants). The boolean is false when no manifest describes that pair.
func OpenAICompatibleSTTManifest ¶ added in v0.76.3
func OpenAICompatibleSTTManifest(provider string) ProviderOptionManifest
OpenAICompatibleSTTManifest describes the shipped generic multipart adapter's language and prompt serialization under a host's provider identity. It does not assert native keyword support; concrete models may supply their own definition to ResolveTranscribeOptionsWithManifest.
func (ProviderOptionManifest) RecognitionBiasOption ¶ added in v0.76.3
func (m ProviderOptionManifest) RecognitionBiasOption() OptionID
RecognitionBiasOption selects the implemented channel for dictionary hints. Keyterms take precedence over transcript-style prompts. Unsupported, unimplemented and provider-default rows cannot carry request hints. Adapters may supply a manifest for their concrete model and transport.
func (ProviderOptionManifest) SupportByID ¶
func (m ProviderOptionManifest) SupportByID() map[OptionID]OptionSupport
SupportByID indexes the manifest's Options by OptionID; a later duplicate row replaces an earlier one.
type ResolveInput ¶
type ResolveInput struct {
Manifest ProviderOptionManifest
ProfileID string
ProviderDefaults Values
GlobalDefaults Values
ProviderOverrides Values
RequestOverrides Values
}
ResolveInput carries the manifest and the four value layers Resolve merges, lowest precedence first: ProviderDefaults, GlobalDefaults, ProviderOverrides, RequestOverrides. ProfileID is echoed into the result.
type SupportStatus ¶
type SupportStatus string
SupportStatus says how a provider adapter honors an option.
const ( // SupportNative maps to a real provider parameter, named by // [OptionSupport].NativeKey. SupportNative SupportStatus = "native" // SupportEmulated is reproduced by SpeechKit's own runtime because the // provider has no switch for it. SupportEmulated SupportStatus = "emulated" // SupportDerived is honored indirectly, for example by omitting the // language field or rendering terms into a prompt; Notes say how. SupportDerived SupportStatus = "derived" // SupportUnsupported cannot be asserted on a request; an explicitly // configured value is reported in [EffectiveOptions].Unsupported. SupportUnsupported SupportStatus = "unsupported" // SupportProviderDefault is already satisfied by the provider without // being asked, so SpeechKit sends nothing. SupportProviderDefault SupportStatus = "provider_default" )
Support statuses recorded in a manifest row.
type UnsupportedOptionReport ¶
type UnsupportedOptionReport struct {
ID OptionID `json:"id"`
Source ValueSource `json:"source"`
Value any `json:"value,omitempty"`
Provider string `json:"provider"`
Modality string `json:"modality"`
ProfileID string `json:"profileId,omitempty"`
Reason string `json:"reason"`
}
UnsupportedOptionReport explains why a configured option will not reach the provider: it was set explicitly (not unset or a provider default), is non-zero, and the manifest marks it SupportUnsupported.
type ValueSource ¶
type ValueSource string
ValueSource records which configuration layer supplied an effective option value.
const ( // SourceUnset means no layer set the option. SourceUnset ValueSource = "unset" // SourceProviderDefault is the adapter's built-in default. SourceProviderDefault ValueSource = "provider_default" // SourceGlobalDefault is the host's provider-independent setting. SourceGlobalDefault ValueSource = "global" // SourceProviderOverride is the host's per-provider setting. SourceProviderOverride ValueSource = "provider_override" // SourceRequestOverride was passed with the individual request. SourceRequestOverride ValueSource = "request_override" )
Value sources. Resolve takes the first layer that has the option in the order request override, provider override, global default, provider default.
type Values ¶
Values is one layer of option values keyed by OptionID. Values are loosely typed (bool, string, numbers, []string, or []any from JSON); the typed accessors coerce them. A nil Values is safe to read.
func (Values) Bool ¶
Bool returns the bool value for id, or false when the option is absent or not a bool.
func (Values) Clone ¶
Clone returns a deep copy of v (slice values are copied), or nil when v is empty.
func (Values) Float ¶
Float returns the value for id as a float64, accepting float64, float32, and int; it returns 0 when absent or of another type.
func (Values) Int ¶
Int returns the value for id as an int, accepting int, int32, int64, and float64 (truncated); it returns 0 when absent or of another type.
func (Values) Merge ¶
Merge copies every entry of other into v, overwriting existing keys, and returns the result. It mutates v in place unless v is nil, in which case a new map is returned; an empty other returns v unchanged.
func (Values) String ¶
String returns the trimmed string value for id, or "" when the option is absent or not a string.
func (Values) StringList ¶
StringList returns the value for id as a trimmed list de-duplicated case-insensitively. It accepts []string, []any of strings, or a single string split on commas, semicolons, and newlines, and returns nil when absent or empty.