Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make agents stop speaking when sending a new message #1215

Open
AkiThuong opened this issue Dec 12, 2024 · 0 comments
Open

How to make agents stop speaking when sending a new message #1215

AkiThuong opened this issue Dec 12, 2024 · 0 comments
Labels
question Further information is requested

Comments

@AkiThuong
Copy link

Hi livekit team,
I tried to use the event from voice_pipeline_agent
@chat.on("message_received") def on_chat_received(msg: rtc.ChatMessage):

I want to interrupt agent speaking when the new message sent to agent. How to achieve this ?
Using following code is not working, It will wait the agent to complete its speech
async def answer_from_text(txt: str): # chat_ctx = agent.chat_ctx.copy() agent.chat_ctx.append(role="user", text=txt) stream = agent.llm.chat(chat_ctx=agent.chat_ctx, fnc_ctx=fnc_ctx) logger.info(f"Chat Context Log: ${agent.chat_ctx}") await agent.say(stream, allow_interruptions=True)

Best regards

@AkiThuong AkiThuong added the question Further information is requested label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant