Skip to content

Select sentence tokenizer language from TTS settings - #5727

Draft
markbackman wants to merge 3 commits into
feat/bundled-punkt-datafrom
feat/tts-tokenizer-language
Draft

Select sentence tokenizer language from TTS settings#5727
markbackman wants to merge 3 commits into
feat/bundled-punkt-datafrom
feat/tts-tokenizer-language

Conversation

@markbackman

@markbackman markbackman commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Select the sentence tokenizer from the TTS language, with an optional text_aggregation_language override. Regional codes map to the corresponding Punkt model; unspecified and unsupported languages retain the English-model and Unicode-punctuation fallback.
  • Capture the tokenizer language per generation so runtime updates apply to the next generation. Streaming audio contexts retain their own model, and explicitly associated RTVI observers use frame snapshots to handle delayed callbacks.
  • Prepare models in background threads and document configuration, runtime updates, and observer association.

Stacked on #5726, targeting feat/bundled-punkt-data. Language selection uses the bundled models supplied by that PR, without runtime downloads or external NLTK data. This diff contains only the language-aware aggregation changes.

Testing

  • Full Pyright run with the project virtual environment: 0 errors and 0 warnings.
  • 424 tests passed covering bundled data, tokenization, TTS ordering and settings, interruptions, streaming contexts, and RTVI.
  • Verified multilingual tokenization with external NLTK data disabled and downloads blocked.
  • The unset-language type guard is preserved; Ruff and diff whitespace checks passed.

@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.07843% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pipecat/processors/frameworks/rtvi/observer.py 85.18% 4 Missing ⚠️
Files with missing lines Coverage Δ
src/pipecat/services/tts_service.py 91.08% <100.00%> (+0.73%) ⬆️
...ipecat/utils/context/aggregated_frame_sequencer.py 98.82% <100.00%> (+<0.01%) ⬆️
src/pipecat/utils/prewarm.py 71.42% <100.00%> (ø)
src/pipecat/utils/string.py 90.83% <100.00%> (+0.65%) ⬆️
src/pipecat/utils/text/base_text_aggregator.py 82.22% <100.00%> (+3.27%) ⬆️
src/pipecat/utils/text/simple_text_aggregator.py 100.00% <100.00%> (ø)
src/pipecat/processors/frameworks/rtvi/observer.py 59.52% <85.18%> (+1.33%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@markbackman
markbackman force-pushed the feat/tts-tokenizer-language branch from eb6957b to 196871e Compare September 13, 2026 19:14
@markbackman
markbackman changed the base branch from feat/bundled-punkt-data to main September 13, 2026 19:14
@markbackman
markbackman force-pushed the feat/tts-tokenizer-language branch from 196871e to f584a41 Compare September 13, 2026 21:27
@markbackman
markbackman changed the base branch from main to feat/bundled-punkt-data September 13, 2026 21:27
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.

1 participant