Add Qwen 3 TTS support for Simplismart-livekit plugin#5474
Add Qwen 3 TTS support for Simplismart-livekit plugin#5474tinalenguyen merged 1 commit intolivekit:mainfrom
Conversation
e2ff8c2 to
0228713
Compare
| if options is None: | ||
| self._opts = SimplismartTTSOptions() | ||
| is_qwen = False | ||
| elif isinstance(options, QwenTTSOptions): |
There was a problem hiding this comment.
Setting model="qwen-tts" or base_url=QWEN_BASE_URL without options=QwenTTSOptions(...) sends Orpheus-format JSON to the Qwen endpoint. Is there a better way we can approach the is_qwen check?
0228713 to
8c1a0ba
Compare
| # sample_rate controls how the framework decodes/plays back the returned PCM audio; | ||
| # it is not sent to the server. | ||
| sample_rate: int = 24000, | ||
| options: SimplismartTTSOptions | QwenTTSOptions | None = None, |
There was a problem hiding this comment.
i would unpack the params in these options and avoid exposing the options object here, ideally the user wouldn't have to import anything to pass any parameters. i think we can also keep the defaults here for clarity
i recommend following the pattern rime has here: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-rime/livekit/plugins/rime/tts.py
8c1a0ba to
e57bdd2
Compare
| if self._opts.qwen_options is not None: | ||
| qwen_opts = self._opts.qwen_options | ||
| payload: dict = { | ||
| "text": self._input_text, |
There was a problem hiding this comment.
| "text": self._input_text, | |
| "model": self._opts.model, | |
| "text": self._input_text, |
i got this error when trying qwen:
livekit.agents._exceptions.APIStatusError: message='Simplismart TTS API Error: {"error":"Missing required field: model"}', status_code=400,
retryable=False, body={"error":"Missing required field: model"}
| "Accept": "audio/L16", | ||
| } | ||
| else: | ||
| assert self._opts.simplismart_options is not None |
There was a problem hiding this comment.
we can remove this line, simplismart_options will always be set in this else from the init
| assert self._opts.simplismart_options is not None |
f281b86 to
e97c4ae
Compare
| "model": self._opts.model, | ||
| "text": self._input_text, | ||
| "language": qwen_opts.language, | ||
| "speaker": self._opts.voice, |
There was a problem hiding this comment.
| "speaker": self._opts.voice, | |
| "voice": self._opts.voice, |
- Add `qwen-tts` to `TTSModels` - Add `_SimplismartTTSOptions` and `_QwenTTSOptions` private dataclasses following the rime plugin pattern (flat params, no public Options objects) - Auto-detect `base_url`, `model`, and `voice` from model name via `_is_qwen_model()` - Defaults set for Orpheus model; Qwen 3 defaults auto-applied when model name contains `qwen` - All verbose logging changed to `logger.debug` - `sample_rate` documented as framework-only, not sent to server - Backwards compatible: existing `TTS()` usage unchanged - Add `model` field to Qwen payload (fixes `Missing required field: model` error) Made-with: Cursor
e97c4ae to
09030ab
Compare
Summary
This PR adds Qwen 3 TTS support to the SimpliSmart LiveKit plugin while maintaining full backwards compatibility with the existing Orpheus TTS implementation.
Changes
qwen-ttstoTTSModelsinmodels.pyQwenTTSOptionsclass for Qwen 3 specific configuration (language,leading_silence)TTSclass to accept anoptionsparameter that can be eitherSimplismartTTSOptionsorQwenTTSOptionsChunkedStream._run()to use type-based payload construction for the appropriate API formatstt.pypatterns)QwenTTSOptionsandSimplismartTTSOptionsfrom the moduleUsage
Legacy Orpheus (backwards compatible)
Qwen 3 TTS
Files Changed
livekit-plugins/livekit-plugins-simplismart/livekit/plugins/simplismart/__init__.pylivekit-plugins/livekit-plugins-simplismart/livekit/plugins/simplismart/models.pylivekit-plugins/livekit-plugins-simplismart/livekit/plugins/simplismart/tts.py