Hey everyone, I’m seeing an issue where session.g...
# agents
l
Hey everyone, I’m seeing an issue where session.generate_reply() times out with: generate_reply timed out waiting for generation_created event It only happens when using the Gemini live API — other realtime models work fine. I’ve added retries and longer timeouts, but the generation_created event just never arrives. Has anyone else run into this or found a workaround? Thanks! 🙏
p
Same problem, only when I use avatars too
l
We have an example showing Gemini realtime and
generate_reply
: https://github.com/livekit/agents/blob/main/examples/voice_agents/realtime_video_agent.py. Does that work for you? I just tested it locally for myself and it seems to work.
a
Did you find a solution? I also have this issue
f
I've also been running into this issue, with all the Gemini realtime models I've tried
Adding a dummy "Please continue" audio when the timeout error occurs helps to make the agent speak again, but I haven't been able to find a way to prevent it entirely
p
How do you send it? Can send is the piece of code?
f
In the realtime_api.py file Added this function: def inject_from_wav(self, path: str) -> None: # Load audio (always returns float32 by default) audio_array, sr = sf.read(path, dtype="int16") # Resample if needed if sr != 16000: logger.info("resampling") audio_array = librosa.resample( audio_array.astype(np.float32), orig_sr=sr, target_sr=16000 ).astype(np.int16) sr = 16000 # Ensure shape = (samples, channels) if audio_array.ndim == 1: audio_array = np.expand_dims(audio_array, axis=-1) channels = audio_array.shape[1] # Chunk into ~20ms frames (320 samples @ 16kHz) frame_size = 320 for start in range(0, len(audio_array), frame_size): chunk = audio_array[start:start+frame_size] if len(chunk) < frame_size: break # drop trailing partial frame frame = rtc.AudioFrame( data=chunk.tobytes(), # ✅ convert ndarray → bytes sample_rate=sr, num_channels=channels, samples_per_channel=frame_size, ) self.push_audio(frame) logger.info(f"Injected audio from {path}") and then called it in the on_timeout() function, using an audio file that plays the phrase "Please continue" as the argument