Hi! I started out with the openai realtime API exa...
# ask-ai
c
Hi! I started out with the openai realtime API example. I then added a chat where I can send a message using the
send
method from
useChat
. On the server side, I added a listener like this:
Copy code
async def async_handle_text_stream(reader, participant_identity):
    info = <http://reader.info|reader.info>

    <http://logger.info|logger.info>(
        f'Text stream received from {participant_identity}\n'
        f'  Topic: {info.topic}\n'
        f'  Timestamp: {info.timestamp}\n'
        f'  ID: {info.stream_id}'
    )

    text = await reader.read_all()
    <http://logger.info|logger.info>(f"Received text: {text}")


def handle_text_stream(reader, participant_identity):
    task = asyncio.create_task(async_handle_text_stream(reader, participant_identity))
    _active_tasks.add(task)
    task.add_done_callback(lambda t: _active_tasks.remove(t))

def run_multimodal_agent(ctx: JobContext, participant: rtc.RemoteParticipant):
    <http://logger.info|logger.info>("starting multimodal agent")

    ctx.room.register_text_stream_handler("chat-bubbles", handle_text_stream)
I don't seem to receive any messages on the server. I can't find anything in the documentation clearly stating anything else to do. Am I found anything wrong? I thought maybe I was listening to the wrong topic, but I can't specify a topic in the send method from
useChat
.
t
Thanks for reaching out, Stian. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm sorry, but I don't have the information you need at the moment. If you would like a member of the LiveKit team to respond, please ask your question in one of the other channels.
c
Which channel would be most suitable for this question?