Skip to content

feat(inworld): let the server split streamed text on inworld-tts-2 - #8000

Merged
tinalenguyen merged 4 commits into
livekit:mainfrom
inworld-ai:ian/inworld-sentence-boundary-upstream
Oct 21, 2026
Merged

tinalenguyen merged 4 commits into
livekit:mainfrom
inworld-ai:ian/inworld-sentence-boundary-upstream

Conversation

@ianbbqzy

@ianbbqzy ianbbqzy commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On inworld-tts-2 models, SynthesizeStream now sends text to Inworld as it arrives and creates the context with Inworld's SENTENCE_BOUNDARY auto-mode strategy. The server buffers the text and starts synthesis at each sentence boundary, so the plugin no longer splits sentences itself for these models.

Passing tokenizer= or retain_format=False keeps client-side splitting. Other models behave as before. Inworld supports this strategy only on inworld-tts-2 models.

In this mode buffer_char_threshold also cuts sentences longer than it, so it is sent only when set, and Inworld's default applies otherwise. The default for client-side splitting is now 250.

In a side-by-side run on inworld-tts-2 with text streamed at 20 ms per token, median time to first audio went from 328 to 195 ms for a short reply and from 451 to 417 ms for text with abbreviations. A reply with a long first sentence took about the same time either way.

Testing

  • Added tests in tests/test_plugin_inworld_tts.py. ruff and mypy pass on the plugin.
  • Ran against the Inworld API with streamed text on inworld-tts-2 and inworld-tts-1.5-max. Audio and word timestamps arrive and stay in order across several generations in one stream.

Without a custom tokenizer, inworld-tts-2 streams forward text as it
arrives and create the context with the SENTENCE_BOUNDARY auto-mode
strategy, so the server finds sentence boundaries. Passing a tokenizer
keeps client-side sentence splitting.

With SENTENCE_BOUNDARY the buffer threshold also cuts sentences longer
than it, so it is sent only when set. The default for client-side
splitting is now 250.
@ianbbqzy
ianbbqzy requested a review from a team as a code owner October 20, 2026 20:54
devin-ai-integration[bot]

This comment was marked as resolved.

retain_format=False normalizes whitespace in the default tokenizer, which
server-side splitting skips, so it selects client-side splitting the same
way passing a tokenizer does.
@tinalenguyen
tinalenguyen merged commit 731204a into livekit:main Oct 21, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants