quaint-laptop-92257
08/05/2025, 1:43 PMtall-airline-16756
08/05/2025, 1:43 PMtall-airline-16756
08/05/2025, 1:43 PMsession = AgentSession(
llm=openai.LLM(model="gpt-4"),
# No TTS or STT are needed for text-only mode
)
await session.start(
agent=MyAgent(),
room=ctx.room,
room_input_options=RoomInputOptions(
text_enabled=True,
audio_enabled=False
),
room_output_options=RoomOutputOptions(
transcription_enabled=True,
audio_enabled=False
),
)
2. Run the Agent in Text Mode:
You can run the agent in terminal mode for text-only interactions using:
python myagent.py console
In this mode, the agent will monitor the lk.chat text stream topic for incoming messages and publish responses to the lk.transcription topic. Audio capabilities will be completely disabled, and the agent will operate entirely through text interactions.
Let me know if you need further assistance!
Sources: examples/voice_agents/llamaindex-rag/chat_engine.pyquaint-laptop-92257
08/05/2025, 2:00 PMtall-airline-16756
08/05/2025, 2:01 PMgenerate_reply with TTS in text-only mode, you can set up the agent to include a TTS plugin—even though it won’t actually play any audio. This little trick helps the agent work smoothly while sticking to text-only. Here’s a simple way to do it:
1. Set Up the LLM with Text-Only Modality:
session = AgentSession(
llm=openai.realtime.RealtimeModel(modalities=["text"]),
tts=openai.TTS(voice="ash")
)
2. Just Use generate_reply Like Usual:
The generate_reply method will create text responses, which get sent through the transcription stream. For example:
await session.generate_reply(instructions="Please provide your response.")
With this setup, your agent’s replies come through as text on the lk.transcription topic, and the TTS plugin quietly keeps things compatible—even without any audio output.
If anything’s unclear or you want to dive deeper, just let me know—I’m here to help!quaint-laptop-92257
08/05/2025, 2:24 PMtall-airline-16756
08/05/2025, 2:25 PMlk.transcription in LiveKit, here’s a simple way to get you started:
1. Listen for Transcription Events:
You can use the LiveKit SDK to subscribe to the lk.transcription text stream topic. For example:
`room.registerTextStreamHandler('lk.transcription', async (reader, participantInfo) => {
const message = await reader.readAll();
console.log(New transcription from ${participantInfo.identity}: ${message});
});`
2. Show Transcriptions in Your UI:
Create a UI component to display the transcriptions. Here’s a quick example:
function Transcript() {
const { displayTranscriptions } = useAgent();
return (
{displayTranscriptions.length === 0 ? (
Get talking to start the conversation!
) : (
{displayTranscriptions.map(({ segment }) => (
{segment.text.trim()}
))}
)}
);
}
3. Make It Even Better:
Think about adding features like auto-scrolling to the newest transcription or some cool typing effects to make the experience smoother and more engaging.
4. Set Up on the Server Side:
Make sure transcription output is turned on in your server setup. For example:
await session.start(
agent=Agent(
instructions="You are a helpful assistant that transcribes user speech to text.",
stt=deepgram.STT()
),
room=ctx.room,
transcription_enabled=True
);
If you hit any bumps or want to chat more about this, just let me know—I’m here to help!
Sources: Text and transcriptions | LiveKit Docs | web/src/components/transcript.tsx | components/typewriter.tsx | hardware/pi-zero-transcriber/README.md