Can I override llm completely and instead specify ...
# ask-ai
n
Can I override llm completely and instead specify my own class for LLM that will generate answers
t
Thanks for reaching out, Hwuiwon. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Absolutely! You can totally override the LLM and plug in your own custom class for generating answers in LiveKit. There are two main ways to do this: 1. Override the
llm_node
Method:
• Just create a custom Agent class and override the
llm_node
method with your own LLM logic. This way, you can tweak how the LLM works, adjust the chat context, and even use a custom LLM provider without needing a plugin. 2. Create a Custom LLM Class: • You can also build a custom LLM class that extends the base
llm.LLM
class. You'll need to implement the required interface, including the
chat
method that returns an
LLMStream
. If you'd like, I’m here to help with more details or guide you through either approach—just let me know! Sources: Using Custom LLM Providers with the Agent | Voice pipeline nodes | LiveKit Docs | Modifying LLM output before TTS | LiveKit Docs | livekit-agents/livekit/agents/voice/agent.py