how to integrate deep infra with voice agent
# ask-ai
f
how to integrate deep infra with voice agent
t
Thanks for reaching out, venu. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! LiveKit currently supports integration with Deepgram for speech-to-text (STT) and text-to-speech (TTS) in voice agents. I noticed you mentioned Deep Infra, and I just wanted to check in with a few questions to better understand what you need: • Did you mean Deepgram instead of Deep Infra? • If you actually meant Deep Infra, are you planning to use it for STT, TTS, or something else? • Do you happen to have any specific API details or SDKs related to Deep Infra? If you could share a bit more, I’d be happy to help guide you from there! Sources: Deepgram integration guide | LiveKit Docs | Deepgram TTS integration guide | LiveKit Docs | Deepgram STT integration guide | LiveKit Docs | agent-examples/agent_examples/pipeline_agent.py | examples/src/outbound.ts
f
I meant deepseek
t
Hey there! If you’re looking to integrate DeepSeek with a voice agent in LiveKit, here’s a simple step-by-step guide to help you out: 1. Install the Plugin You Need:
pip install "livekit-agents[openai]~=1.2"
2. Set Up Your Environment Variables: Pop your DeepSeek API key into a
.env
file like this:
DEEPSEEK_API_KEY=<your-deepseek-api-key>
3. Get the DeepSeek LLM Ready: Here’s some code to set up the LLM: `from livekit.plugins import openai deepseek_llm = openai.LLM.with_deepseek( model="deepseek-chat", # Default model temperature=0.7, parallel_tool_calls=True, tool_choice="auto" )`Or, if you want to specify the DeepSeek base URL, try this:
Copy code
llm=openai.LLM(
    base_url="<https://api.deepseek.com/v1>",
    model="deepseek-chat",
    api_key=os.getenv("DEEPSEEK_API_KEY")
)
4. Plug It Into a VoicePipelineAgent: Use the LLM you just set up in your voice agent pipeline like so:
Copy code
agent = VoicePipelineAgent(
    vad=ctx.proc.userdata["vad"],
    stt=openai.STT.with_groq(),  # Or another STT provider
    llm=deepseek_llm,
    tts=openai.TTS(),  # Or another TTS provider
    chat_ctx=initial_ctx
)
5. Other Options: Just so you know, DeepSeek models also work with providers like Cerebras, Groq, and others that support OpenAI-compatible APIs. If you hit any bumps or want a hand with any of these steps, just give me a shout—I’m here to help! Sources: chain-of-thought-tts/agent.py | Cerebras and LiveKit | LiveKit Docs | Large language model (LLM) integrations | LiveKit Docs | DeepSeek LLM integration guide | LiveKit Docs | Building an Automated IVR Menu Caller | LiveKit Docs
f
client = OpenAI( _base_url_="https://api.deepinfra.com/v1/openai", _api_key_=os.getenv("OPENAI_API_KEY"), ) will this be enough
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
f
class Evi(Agent): def __init__(self) -> None: super().__init__(instructions=instructions) self.paused: bool = False async def on_enter(self) -> None: if not self.paused: await self.session.generate_reply( instructions=self.instructions ) async def on_exit(self) -> None: return await super().on_exit() how can I pass metadata to my agent along with instructions. this metadata will be unique to every user
class Evi(Agent): def __init__(self) -> None: super().__init__(instructions=instructions) self.paused: bool = False async def on_enter(self) -> None: if not self.paused: await self.session.generate_reply( instructions=self.instructions ) async def on_exit(self) -> None: return await super().on_exit() how can I pass metadata to my agent along with instructions. this metadata will be unique to every user