fix(speak): correct TTS warning event field names to match API response #653
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #617
Changed
SpeakV1WarningEventfield names fromcode/descriptiontowarn_code/warn_msgto match the actual field names returned by the Deepgram API.Issue
When the Deepgram API returns a 429 rate limit warning, the response contains:
{ "type": "Warning", "warn_code": "EXCESSIVE_FLUSH", "warn_msg": "Rate limit exceeded for flushes. Please try again later." }However, the SDK's
SpeakV1WarningEventmodel was expectingcodeanddescriptionfields instead, causing a Pydantic validation error that crashed the TTS WebSocket connection instead of calling theon_warningcallback.Changes
Updated
SpeakV1WarningEventmodel:code: str→warn_code: strdescription: str→warn_msg: strUpdated all related tests to use the correct field names
Impact
on_warningcallback will be properly invoked for 429 rate limit warningsTest plan
test_speak_v1_models.pyto use new field names