agents icon indicating copy to clipboard operation
agents copied to clipboard

text_only example not working

Open wackenvoss opened this issue 1 year ago • 10 comments

It seems that the text_only example does not work correctly. To reproduce, run an agent, connect to it via the sandbox, and attempt to chat with the agent over text. The user's messages are registered but the assistant messages do not show up.

wackenvoss avatar Jun 02 '25 17:06 wackenvoss

which frontend are you using? most likely it's because the agent transcription is not shown up in the playground when there is no audio track published, we will fix that in the frontend soon. But for now you should be able to see the agent output from lk.transcription text stream topic (https://docs.livekit.io/agents/build/text/), or here is an example that joins the room and listen to the transcriptions.

longcw avatar Jun 03 '25 01:06 longcw

fixed in #2490

davidzhao avatar Jun 04 '25 07:06 davidzhao

Hey @davidzhao and @longcw thank you for taking a look at this! The fix made in #2490 was indeed a problem, but it seems that Playground requires some changes as well to support this usecase. Specifically, in text-only mode, I needed to merge in the lk.chat and lk.transcriptions topic into one message history (using the new useTranscriptions hook in livekit/components js 2.9.9). Interestingly, I tried using useChat with the lk.transcriptions topic, but it seems there may be a bug with registering to multiple topics possibly associated with this line.

Eventually I'd like to support voice and audio but as a first version we are using livekit agent exclusively with text, so I have a feeling later this may be a problem if I want to support both usecases, but for now this solution will work for me.

wackenvoss avatar Jun 04 '25 14:06 wackenvoss

I have a similar setup where I'm trying to implement text-only functionality using audio_enabled=False as specified on the docs https://docs.livekit.io/agents/build/text/.

I'm expecting the agent to publish text responses to the lk.transcription text stream topic. But when I tried to listen to the streams, I saw that the agent text responses are sent in lk.chat topic.

@longcw @davidzhao Any idea why? Or am I doing something wrong.

sid-js avatar Jun 06 '25 17:06 sid-js

@sid-js which livekit-agents version are you using, can you share the result of pip list | grep livekit? Only in a few old preview version it was sent to lk.chat topic, but after that it should always use the lk.transcription topic. And you can also test it with the this example by join the same room of the agent.

longcw avatar Jun 07 '25 02:06 longcw

Here are the versions that I'm using @longcw

livekit                            1.0.8
livekit-agents                     1.0.23
livekit-api                        1.0.2
livekit-plugins-deepgram           1.0.23
livekit-plugins-google             1.0.23
livekit-plugins-noise-cancellation 0.2.4
livekit-plugins-openai             1.0.23
livekit-plugins-silero             1.0.23
livekit-plugins-turn-detector      1.0.23
livekit-protocol                   1.0.3

I've tried the example to listen to the messages in the room, here is the logs:

Listening for chat messages. Press Ctrl+C to exit...


[agent-AJ_yMrUwiZW7WqV][chat][SG_458f9c42b5f8][new]: Nice to meet you! How can I assist you with your business today? [final=true]
[agent-AJ_yMrUwiZW7WqV][chat][SG_9ab6545fc381][new]: Of course, Please tell me more about what you need help with, and I'll do my best to assist you. [final=true]

sid-js avatar Jun 07 '25 04:06 sid-js

@sid-js from the logs the agent responses are there as expected.

longcw avatar Jun 07 '25 05:06 longcw

@longcw But aren't they sent in the chat topic instead of transcriptions topic?

sid-js avatar Jun 07 '25 05:06 sid-js

@sid-js the example is reading from transcription topic https://github.com/livekit/agents/blob/main/examples/other/chat-stream-receiver.py#L168 and we expect the agent transcription sent to that.

longcw avatar Jun 07 '25 05:06 longcw

@longcw Why would a text only agent output to lk.transcription and not lk.chat?

WalidZein avatar Aug 21 '25 19:08 WalidZein