Hi, I'm having an issue with the usage of generate...
# agents
b
Hi, I'm having an issue with the usage of generate_reply, sometimes is not making the agent say something. I added logs to the LLMStream _parse_choice to see what I was receiving in those cases and it seems like an empty response. More details in ๐Ÿงต
livekit/plugins/openai/llm.py
I got:
"finish_reason": "stop", "before_len": 0, "after_len": 0, "has_tool_calls": false
which ends up in the agent not saying nothing when calling the method. This is even weirder in the sense that I don't even think it should be possible for an llm to give an empty response
I'm using the openai llm with the openrouter url and gemini as the model. Also, it usually works fine. When calling generate_reply it does it. But in my case, when I'm testing the agent and don't answer one of the questions and make my silence detector try to say something with generate_reply it doesn't. Possibly also related, sometimes in agent handoffs the agent stays silent, even though I have a generate reply in the on enter method. So this might be also related. tldr; calling generate_reply sometimes doesn't make the agent say anything, seems to happen more after the agent speaks without interruption
For additional reference, here is what successful call to generate a reply logs:
Copy code
livekit.plugins.openai โ”‚ OAI delta processed {"taskName": "Task-282", "finish_reason": null, "before_len": 3, "after_len": 3, "has_tool_calls": false}
livekit.plugins.openai โ”‚ OAI delta processed {"taskName": "Task-282", "finish_reason": "stop", "before_len": 31, "after_len": 31, "has_tool_calls": false}
livekit.plugins.openai โ”‚ OAI delta processed {"taskName": "Task-282", "finish_reason": null, "before_len": 0, "after_len": 0, "has_tool_calls": false}
And here is the silent one:
Copy code
livekit.plugins.openai โ”‚ OAI delta processed {"taskName": "Task-742", "finish_reason": "stop", "before_len": 0, "after_len": 0, "has_tool_calls": false}
livekit.plugins.openai โ”‚ OAI delta processed {"taskName": "Task-742", "finish_reason": null, "before_len": 0, "after_len": 0, "has_tool_calls": false}
Also managed to replicate this behaviour with groq + kimi k2
Hi, this issue might be worth looking into @refined-appointment-81829 / @dry-elephant-14928, I think this might be one of the biggest factors causing unexpected silences in calls
f
experiencing the same with openai realtime llm @refined-appointment-81829 @dry-elephant-14928