From f2e49bd40ae5a3c683e292d62778b48904fd44f0 Mon Sep 17 00:00:00 2001 From: jayesh Date: Thu, 28 Nov 2024 20:18:18 +0530 Subject: [PATCH 1/3] fix: empty agent transcript --- .../livekit/agents/pipeline/pipeline_agent.py | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/livekit-agents/livekit/agents/pipeline/pipeline_agent.py b/livekit-agents/livekit/agents/pipeline/pipeline_agent.py index ccd394652..b9adb4a69 100644 --- a/livekit-agents/livekit/agents/pipeline/pipeline_agent.py +++ b/livekit-agents/livekit/agents/pipeline/pipeline_agent.py @@ -882,25 +882,25 @@ async def _execute_function_calls() -> None: if interrupted: collected_text += "..." + if collected_text: + msg = ChatMessage.create(text=collected_text, role="assistant") + self._chat_ctx.messages.append(msg) - msg = ChatMessage.create(text=collected_text, role="assistant") - self._chat_ctx.messages.append(msg) - - speech_handle.mark_speech_committed() + speech_handle.mark_speech_committed() - if interrupted: - self.emit("agent_speech_interrupted", msg) - else: - self.emit("agent_speech_committed", msg) + if interrupted: + self.emit("agent_speech_interrupted", msg) + else: + self.emit("agent_speech_committed", msg) - logger.debug( - "committed agent speech", - extra={ - "agent_transcript": collected_text, - "interrupted": interrupted, - "speech_id": speech_handle.id, - }, - ) + logger.debug( + "committed agent speech", + extra={ + "agent_transcript": collected_text, + "interrupted": interrupted, + "speech_id": speech_handle.id, + }, + ) # mark the speech as done speech_handle._set_done() From baaed13589bb8df54a4d12431f7f4cb6d2b20a53 Mon Sep 17 00:00:00 2001 From: jayesh Date: Thu, 28 Nov 2024 20:20:21 +0530 Subject: [PATCH 2/3] fix: empty agent transcript --- livekit-agents/livekit/agents/pipeline/pipeline_agent.py | 1 + 1 file changed, 1 insertion(+) diff --git a/livekit-agents/livekit/agents/pipeline/pipeline_agent.py b/livekit-agents/livekit/agents/pipeline/pipeline_agent.py index b9adb4a69..5772a14bb 100644 --- a/livekit-agents/livekit/agents/pipeline/pipeline_agent.py +++ b/livekit-agents/livekit/agents/pipeline/pipeline_agent.py @@ -882,6 +882,7 @@ async def _execute_function_calls() -> None: if interrupted: collected_text += "..." + if collected_text: msg = ChatMessage.create(text=collected_text, role="assistant") self._chat_ctx.messages.append(msg) From 146820f453c12e51b988b42b4599c585ab4628b3 Mon Sep 17 00:00:00 2001 From: jayesh Date: Thu, 28 Nov 2024 20:36:32 +0530 Subject: [PATCH 3/3] changeset --- .changeset/brave-plums-help.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/brave-plums-help.md diff --git a/.changeset/brave-plums-help.md b/.changeset/brave-plums-help.md new file mode 100644 index 000000000..c2364ad6b --- /dev/null +++ b/.changeset/brave-plums-help.md @@ -0,0 +1,5 @@ +--- +"livekit-agents": patch +--- + +fix: empty agent transcript