diff --git a/livekit-agents/CHANGELOG.md b/livekit-agents/CHANGELOG.md index ad835b06fb..d17ab84317 100644 --- a/livekit-agents/CHANGELOG.md +++ b/livekit-agents/CHANGELOG.md @@ -8,6 +8,8 @@ - fix: invalid request on anthropic - [#1018](https://github.com/livekit/agents/pull/1018) ([@theomonnom](https://github.com/theomonnom)) +- fix: IndexError on tts metrics - [#1028](https://github.com/livekit/agents/pull/1028) ([@theomonnom](https://github.com/theomonnom)) + ## 0.11.0 ### Minor Changes diff --git a/livekit-agents/livekit/agents/tts/tts.py b/livekit-agents/livekit/agents/tts/tts.py index e4c7b453ee..5502014f7b 100644 --- a/livekit-agents/livekit/agents/tts/tts.py +++ b/livekit-agents/livekit/agents/tts/tts.py @@ -176,6 +176,9 @@ def _emit_metrics(): nonlocal start_time, audio_duration, ttfb, request_id duration = time.perf_counter() - start_time + if not self._mtc_pending_texts: + return + text = self._mtc_pending_texts.pop(0) if not text: return