Skip to content

Commit 18a8f84

Browse files
authored
fix (google stt): set enable_word_time_offsets to False for chirp 3 (#4420)
1 parent 688e026 commit 18a8f84

File tree

1 file changed

+14
-2
lines changed
  • livekit-plugins/livekit-plugins-google/livekit/plugins/google

1 file changed

+14
-2
lines changed

livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def __init__(
123123
interim_results: bool = True,
124124
punctuate: bool = True,
125125
spoken_punctuation: bool = False,
126-
enable_word_time_offsets: bool = True,
126+
enable_word_time_offsets: NotGivenOr[bool] = NOT_GIVEN,
127127
enable_word_confidence: bool = False,
128128
enable_voice_activity_events: bool = False,
129129
model: SpeechModels | str = "latest_long",
@@ -148,7 +148,7 @@ def __init__(
148148
interim_results(bool): whether to return interim results (default: True)
149149
punctuate(bool): whether to punctuate the audio (default: True)
150150
spoken_punctuation(bool): whether to use spoken punctuation (default: False)
151-
enable_word_time_offsets(bool): whether to enable word time offsets (default: True)
151+
enable_word_time_offsets(bool): whether to enable word time offsets (default: None)
152152
enable_word_confidence(bool): whether to enable word confidence (default: False)
153153
enable_voice_activity_events(bool): whether to enable voice activity events (default: False)
154154
model(SpeechModels): the model to use for recognition default: "latest_long"
@@ -163,6 +163,18 @@ def __init__(
163163
"""
164164
if not is_given(use_streaming):
165165
use_streaming = True
166+
167+
if model == "chirp_3":
168+
if is_given(enable_word_time_offsets) and enable_word_time_offsets:
169+
logger.warning(
170+
"Chirp 3 does not support word timestamps, setting 'enable_word_time_offsets' to False."
171+
)
172+
enable_word_time_offsets = False
173+
elif is_given(enable_word_time_offsets):
174+
enable_word_time_offsets = enable_word_time_offsets
175+
else:
176+
enable_word_time_offsets = True
177+
166178
super().__init__(
167179
capabilities=stt.STTCapabilities(
168180
streaming=use_streaming,

0 commit comments

Comments
 (0)