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

60 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "google-cloud-texttospeech: model_name Silently Ignored Below v2.28.0"
description: "VoiceSelectionParams.model_name field is silently ignored in google-cloud-texttospeech < 2.28.0; requires 2.36.0 for reliable behavior"
tags: [google-cloud, tts, python, dependencies, silent-failure]
source: daily/2026-05-08.md
created: 2026-05-08
updated: 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.
```python
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`:
```toml
[tool.poetry.dependencies]
google-cloud-texttospeech = ">=2.36.0"
```
After updating:
```bash
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:
```bash
pip show google-cloud-texttospeech | grep Version
```
## Related
- [[wiki/concepts/google-cloud-tts-vs-ai-studio-tts]] full Cloud TTS vs AI Studio comparison
- [[wiki/concepts/poetry-docker-version-mismatch]] other silent library version issues