feat(providers): declarative TTS + STT provider config (#979 phase 2)#985
Merged
feat(providers): declarative TTS + STT provider config (#979 phase 2)#985
Conversation
Closes #979. TTS and STT providers now follow the same declarative shape as chat and embedding providers. - pkg/config: TTSProviderConfig + STTProviderConfig (id, type, model, base_url, credential, additional_config) and matching slices on RuntimeConfigSpec. Validation enforces type allowlists (TTS: openai/elevenlabs/cartesia, STT: openai) and rejects duplicate IDs. - runtime/tts and runtime/stt: ProviderSpec + Factory + CreateFromSpec + RegisterFactory + ResolveCredential, mirroring the embedding factory pattern. Each per-provider .go file in the package adds an *_register.go that calls RegisterFactory from init() — keeps the registration surface co-located with its provider and avoids any cross-package import cycle. - sdk: applyTTSProviders + applySTTProviders build instances from the spec and store them by ID. First declared entry becomes the default ttsService / sttService unless one is already set via WithTTS / WithVADMode. - Cartesia's ws_url passes through additional_config. - Tests cover validation, apply, default-ID-from-type, duplicate detection, programmatic precedence, and per-provider register closures (100% coverage on the register files). - New how-to doc covers the YAML shape and the extension pattern for new providers. This wraps the #979 work — chat, embedding, TTS, and STT providers all share the same declarative shape now. The selector context's SelectorContext.Embeddings bridge to RAG-configured embedding instances (M1 of #980) lights up automatically when an embedding provider is declared.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Closes #979. TTS and STT providers now follow the same declarative shape as chat (existing) and embedding (#984) providers.
What's new
+ 'pkg/config' +—TTSProviderConfig/STTProviderConfigand matching slices on RuntimeConfigSpec; validation enforces type allowlists (TTS: openai/elevenlabs/cartesia, STT: openai) and rejects duplicate IDs.+ 'runtime/tts' +and+ 'runtime/stt' +— ProviderSpec/Factory/CreateFromSpec/RegisterFactory/ResolveCredential, mirroring the embedding-factory pattern. Each provider self-registers viainit()in an*_register.gofile.+ 'sdk' +— applyTTSProviders + applySTTProviders build instances from the spec; first declared entry becomes the default ttsService/sttService unless one is set programmatically via WithTTS / WithVADMode.docs/sdk/how-to/declarative-tts-stt-providers.md.Test plan
go test ./pkg/config ./runtime/tts ./runtime/stt ./sdk -count=1 -racegreengolangci-lint run --new-from-rev=maincleanThis wraps #979 — chat, embedding, TTS, and STT providers all share the same declarative shape now.