Skip to content

Commit

Permalink
handle llm stream returning false (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-purplefish authored Oct 8, 2024
1 parent eaddf66 commit 3553810
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-eggs-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-agents": patch
---

Fixed bug where agent would freeze if before_llm_cb returned false
1 change: 1 addition & 0 deletions livekit-agents/livekit/agents/pipeline/pipeline_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ async def _synthesize_answer_task(

llm_stream = self._opts.before_llm_cb(self, copied_ctx)
if llm_stream is False:
handle.interrupt()
return

if asyncio.iscoroutine(llm_stream):
Expand Down

0 comments on commit 3553810

Please sign in to comment.