Skip to content

Fix Google STT Word‑timings error. #3204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2025
Merged

Fix Google STT Word‑timings error. #3204

merged 2 commits into from
Aug 21, 2025

Conversation

itskyf
Copy link
Contributor

@itskyf itskyf commented Aug 20, 2025

Error

When using google.TTS(model="chirp_2", enable_word_time_offsets=False), since there is no word offsets, the resp.results[0].alternatives[0].words[0].start_offset call in _recognize_response_to_speech_event raise an error.

Traceback (most recent call last):
  File "agents/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py", line 267, in _recognize_impl
    return _recognize_response_to_speech_event(raw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "agents/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py", line 565, in _recognize_response_to_speech_event
    start_offset = resp.results[0].alternatives[0].words[0].start_offset
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
  File ".venv/lib/python3.12/site-packages/proto/marshal/collections/repeated.py", line 130, in __getitem__
    return self._marshal.to_python(self._pb_type, self.pb[key])
                                                  ~~~~~~~^^^^^
IndexError: list index out of range

Related links

From Google Chirp 2: "Word-timings (Timestamps): Automatically generated by the model and can be optionally enabled. It is possible that transcrption quality and speed will degrade slightly."

@CLAassistant
Copy link

CLAassistant commented Aug 20, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@longcw longcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! could you sign the CLA before we merging?

@itskyf
Copy link
Contributor Author

itskyf commented Aug 20, 2025

@longcw Sure, I have signed the CLA

@davidzhao davidzhao merged commit 02b2910 into livekit:main Aug 21, 2025
8 of 9 checks passed
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.

4 participants