fix(types): narrow voice in SpeechmaticsTTSSettings to disallow None

After widening TTSSettings.voice to str | None | _NotGiven (so other
TTS services can opt into None as a valid "no voice" state), pyright
flagged Speechmatics' URL builder receiving str | None where it
required str.

Speechmatics has no "no voice" mode (the URL path includes the voice
name), so override the inherited field in SpeechmaticsTTSSettings to
str | _NotGiven. The call site stays as a plain assert_given(...)
without an extra None check.
This commit is contained in:
Paul Kompfner
2026-04-23 21:08:47 -04:00
parent c3eb69165c
commit d0495eeef6

View File

@@ -43,6 +43,9 @@ class SpeechmaticsTTSSettings(TTSSettings):
max_retries: Maximum number of retries for HTTP requests.
"""
# Speechmatics requires a voice (the URL path includes it), so narrow
# the inherited TTSSettings.voice field to disallow None.
voice: str | _NotGiven = field(default_factory=lambda: NOT_GIVEN)
max_retries: int | _NotGiven = field(default_factory=lambda: NOT_GIVEN)