how does llm fallback adapter work?
# ask-ai
i
how does llm fallback adapter work?
t
Thanks for reaching out, Ed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The FallbackAdapter in LiveKit ensures high availability and reliability when working with multiple LLM (Large Language Model) providers by providing automatic failover capabilities. Here's how it works: • Automatic Failover: It tries the primary LLM first and switches to the next available LLM if the primary fails due to timeouts or errors. This continues until a successful response is received or all LLMs are tried. • Background Recovery: Failed LLMs are periodically checked in the background to see if they become available again. If they recover, an event is emitted to notify listeners. • Configurable Retry Policies: You can customize retry behavior, including timeouts, retry intervals, and the number of retries per LLM. • Availability Events: The adapter emits events whenever an LLM's availability status changes, allowing dynamic monitoring and adjustments. For example, you can initialize the adapter with multiple LLMs and configure parameters like
attempt_timeout
and
max_retry_per_llm
. When a request is made, the adapter handles failover and recovery seamlessly. If you'd like more details or need help implementing this, let me know!
i
so if primary model is rate limited it will quickly use the second fallback model>
t
Yes, if the primary model hits a rate limit, the FallbackAdapter will catch that and smoothly switch over to the next fallback model in line. This way, your app keeps running without a hitch, as long as there’s another model ready to step in. Feel free to reach out if you want me to explain anything further or help you get this set up!
i
but it will use the same prompt?