obsidian/wiki/concepts/google-cloud-texttospeech-version-gate.md
2026-05-10 21:21:13 +01:00

2.2 KiB
Raw Blame History

title description tags source created updated
google-cloud-texttospeech: model_name Silently Ignored Below v2.28.0 VoiceSelectionParams.model_name field is silently ignored in google-cloud-texttospeech < 2.28.0; requires ≥ 2.36.0 for reliable behavior
google-cloud
tts
python
dependencies
silent-failure
daily/2026-05-08.md 2026-05-08 2026-05-08

google-cloud-texttospeech: model_name Silently Ignored Below v2.28.0

The Problem

VoiceSelectionParams.model_name (used to select Gemini/Journey voices) is silently ignored in google-cloud-texttospeech versions below 2.28.0. The TTS call succeeds, returns audio — but falls back to a default voice with no error or warning. This makes it look like the voice selection is working when it isn't.

voice = texttospeech.VoiceSelectionParams(
    language_code="en-US",
    model_name="en-US-Journey-F",  # silently ignored if lib < 2.28.0
)

Version Requirements

Version Behavior
< 2.28.0 model_name silently ignored — default voice used
2.28.02.35.x model_name accepted but may have edge-case bugs
≥ 2.36.0 Fully reliable; recommended minimum

Fix

In pyproject.toml:

[tool.poetry.dependencies]
google-cloud-texttospeech = ">=2.36.0"

After updating:

poetry lock --no-update   # regenerate lock without upgrading everything else
# Then rebuild the Docker container
docker compose build worker-ai && docker compose up -d worker-ai

Why It Happens

The model_name field was added to the proto definition in a later release. Older versions of the generated client simply drop unknown fields when serializing the request — no exception, no warning logged by the client library.

Diagnostic Signal

If TTS produces audio in a different voice than specified (especially a generic/robotic voice instead of a Journey voice), check the library version first:

pip show google-cloud-texttospeech | grep Version