Skip to content

Commit c7881f3

Browse files
jmugicagonzdavidzhao
andauthoredDec 23, 2024··
fix context when functions have been called (#1279)
Co-authored-by: David Zhao <dz@livekit.io>
1 parent 42b0e68 commit c7881f3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
 

‎.changeset/witty-fishes-stare.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"livekit-agents": patch
3+
---
4+
5+
fix context when functions have been called

‎livekit-agents/livekit/agents/pipeline/pipeline_agent.py

+5
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,11 @@ async def _synthesize_answer_task(
702702
not playing_speech.user_question or playing_speech.user_committed
703703
) and not playing_speech.speech_committed:
704704
# the speech is playing but not committed yet, add it to the chat context for this new reply synthesis
705+
# First add the previous function call message if any
706+
if playing_speech.extra_tools_messages:
707+
copied_ctx.messages.extend(playing_speech.extra_tools_messages)
708+
709+
# Then add the previous assistant message
705710
copied_ctx.messages.append(
706711
ChatMessage.create(
707712
text=playing_speech.synthesis_handle.tts_forwarder.played_text,

0 commit comments

Comments
 (0)
Please sign in to comment.