Hi what node is called in pipeline when participan...
# agents
t
Hi what node is called in pipeline when participants sends a text message to room so that i can add context for the agent to reply Thanks
j
it’s a callback of
RoomInputOptions
https://github.com/livekit/agents/blob/livekit-agents@1.2.11/livekit-agents/livekit/agents/voice/room_io/room_io.py#L71, by default the input text will be used as input of
generate_reply()
g
Hi @jolly-air-155, I need small help. Have you ever worked on a text chatbot room with multiple participants. • I have 3 participants (user1, agent, user2). • assume user1 and user2 joining from different browsers on react (frontend) on same room. • they can subscribe the msgs on the room on ui(react) with
room.registerTextStreamHandler('lk.transcription', async (reader) => {
const message = await reader.readAll()
// other code
}
• and can send msgs using
await room.localParticipant.sendText(message, { topic: 'lk.chat' });
• on livekit server side, its getting under a callback fn
def handle_text_input(session: AgentSession, ev):
logger.info(f"Received text from {ev.participant.identity}: {ev.text}")
session.generate_reply(user_input=ev.text)
await call_session.session.start(
room=call_session.ctx.room,
agent=main_agent,
room_input_options=RoomInputOptions(
text_enabled=True, audio_enabled=False, text_input_cb=handle_text_input
),
room_output_options=RoomOutputOptions(transcription_enabled=True, audio_enabled=False),
)
• But the issue I am facing is lets say user1 initiates the agent and room with lk tokens and dispatch the agent. then whatever user1 texting coming on this callback fn, but whatever user2 who joined the room later, texting is not coming on this callback fn handle_text_input Is this callback fn can't handle interaction from multiple participants? Please help
j
> Is this callback fn can’t handle interaction from multiple participants? yeah the RoomIO can only listen to one user for both audio and text inputs. If you want to handle text input from multiple users, you can disable the text input in RoomIO and add a custom text stream handler like https://github.com/livekit/agents/blob/livekit-agents@1.3.3/livekit-agents/livekit/agents/voice/room_io/room_io.py#L103 but handle multiple users.