Architecture
Vaani uses a factory pattern to abstract AI providers. Each provider type has a factory class that creates the appropriate SDK instance based on the agent’s configuration.Adding a New TTS Provider (Example)
Add Configuration
Add the API key to your environment:
agent-studio-livekit-agent/.env:config.py or relevant settings file:Update Agent Model (Optional)
If the provider needs new config fields, update:
app/db/models/agent.py— add columnsapp/db/schemas/agent.py— add Pydantic fields- Run
alembic revision --autogenerate -m "add newprovider fields" - Run
alembic upgrade head
Provider Pattern Reference
- LLM Factory
- STT Factory
- TTS Factory
File:
Also handles:
plugins/llm.py → LLMFactory| Provider | SDK | Method |
|---|---|---|
| OpenAI | livekit-plugins-openai | get_instance() |
| Groq | livekit-plugins-groq | get_instance() |
get_turn_detection() for VAD configuration.