why am Igetting *participantInfo*: {identity: 'ag...
# ask-ai
h
why am Igetting participantInfo: {identity: 'agent-AJ_34QGakHuyeVy'} same identity for both user and agent while getting live transcription?
t
Thanks for reaching out, Abhishek. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm glad you reached out! The issue of receiving the same
participantInfo
identity for both user and agent during live transcription usually happens because of a configuration hiccup. Let's walk through some steps that can help clear this up: 1. Ensure Unique Participant Identities: It’s important to assign distinct identities to the user and agent when they join the room. For instance, the user might have an identity like
user-123
, while the agent could use something like
agent-support-bot
. 2. Verify Agent Configuration: If you’re using
RoomIO
, double-check that the
participant
parameter points to the user, and the agent uses its own unique identity when publishing transcriptions. 3. Check Transcription Output: Make sure the agent’s transcription output is set up with its own identity, and the user’s transcription output is linked correctly to their identity. 4. Frontend Handling: Take a look at your frontend logic to confirm it properly distinguishes between the
participant_identity
for the user and the agent. If any of these steps feel tricky or if you'd like me to walk you through them in more detail, please don’t hesitate to ask. I’m here to help you get this sorted out smoothly! Sources: How to set a fixed participant for agent audio processing | pkg/rtc/participant.go | packages/livekit-rtc/src/proto/room_pb.ts | livekit-agents/livekit/agents/voice/room_io/_output.py | Rooms, participants, and tracks | LiveKit Docs
h
How do I set the unique participant Identity myself to user
t
To set a unique participant identity for a user in LiveKit, you’ll want to include the desired identity in the access token when connecting to a room. Here’s a simple way to do it: 1. Server-Side Token Generation: When you generate the access token, include the identity in the token payload. For example:
Copy code
{
  "identity": "user-123",
  "room": "example-room",
  "permissions": [
    "publish",
    "subscribe"
  ]
}
2. Ensure Uniqueness: It’s important to make sure the identity is unique within the room. If two participants share the same identity, the first one will be disconnected automatically. 3. Use Meaningful Identifiers: For production, try to use meaningful identifiers like user IDs from your backend system. For testing, you can use random generators such as
generateRandomUserId()
. If you’d like any help with token generation or the implementation process, please don’t hesitate to reach out—I’m here to support you! Sources: Connecting to LiveKit | LiveKit Docs | SIP APIs | LiveKit Docs | src/components/playground/Playground.tsx | Rooms, participants, and tracks | LiveKit Docs | examples/nextjs/lib/helper.ts
h
while using import { useTranscriptions } from "@livekit/components-react"; hook from livekit for live transcription I see that participantInfo: {identity: 'agent-AJ_34QGakHuyeVy'} identity is same for both agent and user .. why so?
t
Hi there! The
useTranscriptions
hook in
@livekit/components-react
helps you get transcription data streams at the room level and identifies participants by their
identity
. If you’re seeing the same identity for both the agent and user transcriptions, it might be because of a couple of reasons: 1. Duplicate Identities: It’s important to make sure the agent and user each have unique identities when joining the room. If they share the same identity, the system won’t be able to tell them apart. 2. Default Behavior of `useTranscriptions`: This hook pulls in all transcriptions without distinguishing between agent and user by default. So, unless you apply extra filtering or assign roles, it will show everything together. To help you separate agent and user transcriptions clearly, you might want to try: • Using
useVoiceAssistant
to get agent-specific transcriptions. • Combining that with user transcriptions by using participant-specific hooks like
useTrackTranscription
. If you’d like, I’m here to guide you through setting this up or answer any questions you have. Just let me know! Sources: packages/react/src/hooks/useVoiceAssistant.ts | complex-agents/nutrition-assistant/nutrition-assistant-frontend/hooks/useCo...