Change this setup to have only text to text intera...
# ask-ai
w
Change this setup to have only text to text interaction for now from dotenv import load_dotenv from livekit import agents from livekit.agents import AgentSession, Agent, RoomInputOptions from livekit.plugins import ( openai, cartesia, deepgram, noise_cancellation, silero, ) from livekit.plugins.turn_detector.multilingual import MultilingualModel load_dotenv() class Assistant(Agent): def __init__(self) -> None: super().__init__(instructions=“You are a helpful voice AI assistant.“) async def entrypoint(ctx: agents.JobContext): session = AgentSession( stt=openai.STT(model=“gpt-4o-transcribe”, language=“en” ), llm=openai.LLM(model=“gpt-4o-mini”), tts=openai.TTS(model=“gpt-4o-mini-tts”), vad=silero.VAD.load(), turn_detection=MultilingualModel(), ) await session.start( room=ctx.room, agent=Assistant(), room_input_options=RoomInputOptions( # LiveKit Cloud enhanced noise cancellation # - If self-hosting, omit this parameter # - For telephony applications, use
BVCTelephony
for best results noise_cancellation=noise_cancellation.BVC(), ), ) await session.generate_reply( instructions=“Greet users by saying: Hi, I’m your AI progress assistant. Do you have five minutes to complete your progress intake?” ) if name == “__main__“: agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint))
t
Thanks for reaching out, Ilya. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Could you help me understand which setup you mean? Are you talking about a LiveKit room configuration, a particular project, or maybe something else? Also, just to be sure, do you want to turn off all audio and video interactions completely?
w
This setup from dotenv import load_dotenv from livekit import agents from livekit.agents import AgentSession, Agent, RoomInputOptions from livekit.plugins import ( openai, cartesia, deepgram, noise_cancellation, silero, ) from livekit.plugins.turn_detector.multilingual import MultilingualModel load_dotenv() class Assistant(Agent): def __init__(self) -> None: super().__init__(instructions=“You are a helpful voice AI assistant.“) async def entrypoint(ctx: agents.JobContext): session = AgentSession( stt=openai.STT(model=“gpt-4o-transcribe”, language=“en” ), llm=openai.LLM(model=“gpt-4o-mini”), tts=openai.TTS(model=“gpt-4o-mini-tts”), vad=silero.VAD.load(), turn_detection=MultilingualModel(), ) await session.start( room=ctx.room, agent=Assistant(), room_input_options=RoomInputOptions( # LiveKit Cloud enhanced noise cancellation # - If self-hosting, omit this parameter # - For telephony applications, use
BVCTelephony
for best results noise_cancellation=noise_cancellation.BVC(), ), ) await session.generate_reply( instructions=“Greet users by saying: Hi, I’m your AI progress assistant. Do you have five minutes to complete your progress intake?” ) if name == “__main__“: agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint))
t
If you want to switch your setup to text-to-text interaction only, here’s a simple way to tweak your configuration: 1. Update the AgentSession:
Copy code
session = AgentSession(
    llm=openai.LLM(model="gpt-4o-mini"),
    # No STT, TTS, or VAD needed for text-only
)

await session.start(
    agent=Assistant(),
    room=ctx.room,
    room_input_options=RoomInputOptions(
        text_enabled=True,      # Enable text input
        audio_enabled=False,    # Disable audio input
        video_enabled=False     # Disable video input
    ),
    room_output_options=RoomOutputOptions(
        transcription_enabled=True,  # Enable text output
        audio_enabled=False         # Disable audio output
    )
)
2. Key Configuration Details:Input Options: Just set
audio_enabled=False
and
video_enabled=False
inside
RoomInputOptions
. • Output Options: Make sure
audio_enabled=False
and
transcription_enabled=True
are set in
RoomOutputOptions
. This way, you’ll have only text input and output active, and all audio and video features will be turned off. If you want me to walk you through anything else, just let me know—I’m here to help! Sources: examples/other/transcription/translator.py | Text and transcriptions | LiveKit Docs | Text and transcriptions | LiveKit Docs
w
Can I run locally console in text mode?
t
Hey there! You can totally run a LiveKit AgentSession right on your local machine in console text mode for text-to-text chats. Here’s a simple way to do it: 1. Create a Text-Only Agent:
Copy code
import logging
from dotenv import load_dotenv
from livekit.agents import (
    Agent,
    AgentSession,
    JobContext,
    RoomInputOptions,
    RoomOutputOptions,
    WorkerOptions,
    cli,
)
from livekit.plugins import openai

load_dotenv()

class MyAgent(Agent):
    def __init__(self) -> None:
        super().__init__(
            instructions="You are a helpful assistant.",
        )

async def entrypoint(ctx: JobContext):
    session = AgentSession(
        llm=openai.LLM(model="gpt-4o-mini"),
        # No TTS or STT needed for text-only
    )
    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),
    )

if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
2. Run in Console Mode:
Copy code
python agent.py console
3. Console Features: • Just type your messages and hit Enter to chat with the agent. • Use
[Ctrl+B]
anytime to switch between Text and Audio modes. • Press
[Q]
whenever you want to exit the console session. And that’s it! This setup makes it super easy to chat with your agent locally in text-only mode. If you run into any questions or want a hand with anything else, just give me a shout—I’m here to help! Sources: examples/other/chat-stream-receiver.py | Voice AI quickstart | LiveKit Docs | Text and transcriptions | LiveKit Docs
w
Does this slack ai assistant also available anywhere on the web or only here in slacK?
t
Hey there! Just to make sure I’m on the same page, could you tell me a bit more about what you mean by "Slack AI assistant"? Are you asking about a particular LiveKit feature or integration? For instance, are you looking into setting up a LiveKit-based assistant on Slack or maybe another platform? Or are you thinking about an assistant that’s already built? I’m here to help! Sources: LiveKit Docs | SDK Quickstarts | LiveKit Docs | Web and mobile frontends | LiveKit Docs | Voice Assistants | livekit/livekit_composite | DeepWiki