big-controller-60015
02/13/2025, 2:09 PMlkapi = api.LiveKitAPI()
created_room_info = await lkapi.room.create_room(
api.CreateRoomRequest(name=room_name, agents=[agentName])
)
error:
Failed to create room: Parameter to MergeFrom() must be instance of same class: expected <class 'agent_dispatch.RoomAgentDispatch'> got <class 'str'>.
Parameter to MergeFrom() must be instance of same class: expected <class 'agent_dispatch.RoomAgentDispatch'> got <class 'str'>.
what is the solve for this ?gray-monkey-83525
02/13/2025, 2:09 PMagents
parameter in CreateRoomRequest
expects an instance of RoomAgentDispatch
, not a string. You need to create a RoomAgentDispatch
object and pass it to the agents
parameter.
Here's how you can modify your code:
from livekit.api import RoomAgentDispatch
# Create a RoomAgentDispatch object
agent_dispatch = RoomAgentDispatch(agent_name=agentName)
# Pass the RoomAgentDispatch object to the agents parameter
created_room_info = await lkapi.room.create_room(
api.CreateRoomRequest(name=room_name, agents=[agent_dispatch])
)
Would you like more details on this?
Sources:
- https://livekit-users.slack.com/archives/C07FY8WHGPM/p1728956116.368569 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.