AI Voice Agent with RAG: ElevenLabs, OpenAI & Qdrant
Integrates with:
Overview
Unlock Conversational AI with Your Data using this Voice RAG AI Agent
This n8n workflow empowers you to build a sophisticated AI Voice Agent. It integrates ElevenLabs for natural text-to-speech and speech-to-text, OpenAI for advanced language understanding and response generation, and Qdrant as a vector database for Retrieval Augmented Generation (RAG). The agent can access documents from Google Drive, embed them, store them in Qdrant, and then use this knowledge to provide informed, voice-based answers to user queries. This AI Agent effectively becomes a conversational interface to your own data.
Key Features & Benefits
- Voice Interaction: Provides a natural voice interface using ElevenLabs, making interactions more engaging and accessible.
- AI-Driven Q&A (RAG): Leverages OpenAI's LLMs and Qdrant to retrieve relevant information from your documents and generate accurate, context-aware answers.
- Custom Knowledge Base: Connects to Google Drive to ingest your documents (text files), creating a personalized knowledge source for the AI agent.
- Efficient Vector Storage: Utilizes Qdrant for storing and querying document embeddings, enabling fast and scalable information retrieval.
- Contextual Conversations: Incorporates LangChain's Window Buffer Memory to maintain conversation history for more coherent interactions.
- Real-time Webhook Integration: Listens for voice inputs via an n8n webhook and responds in real-time through ElevenLabs.
- Automated Document Processing: Includes steps for loading, splitting, and embedding documents for the RAG system.
Use Cases
- B2C E-commerce: Offer instant, voice-based product support or answer FAQs directly from your product documentation, enhancing customer experience 24/7.
- B2B SaaS: Provide an interactive, voice-enabled helpdesk that guides users through features or troubleshoots issues by querying your internal knowledge base and technical guides.
- Automate initial customer interactions for sales or support, qualifying leads or resolving common issues via a voice interface, freeing up human agents for complex tasks.
- Create an internal voice assistant for employees to quickly find information from company documents, SOPs, or internal wikis, boosting productivity.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- OpenAI API Key with access to chat models (e.g., gpt-3.5-turbo, gpt-4) and embedding models.
- ElevenLabs account and API Key.
- Qdrant instance (cloud or self-hosted) URL and API Key (if secured).
- Google Drive account and credentials configured in n8n for accessing documents.
Setup Instructions
- Download the n8n workflow JSON file.
- Import the workflow into your n8n instance.
- Configure Credentials: In n8n, add credentials for OpenAI, Qdrant (if API key is used for HTTP requests and for LangChain nodes), and Google Drive.
- ElevenLabs Agent Setup (External):
- Go to your ElevenLabs dashboard and create a new Voice AI Agent.
- Configure its 'First message' (greeting) and 'System Prompt' (e.g., 'You are a helpful assistant. Use the provided tool to answer questions based on company documents.').
- In the 'Tools' section, add a 'Webhook' tool.
- Set the webhook URL to your n8n webhook URL (from the 'Listen' node, e.g.,
YOUR_N8N_URL/webhook/test_voice_message_elevenlabs
). Use POST method. - Enable 'Body Parameters', add a string property named
question
, set its value type to 'LLM Prompt', and give it a description like 'User's question to the assistant'.
- Qdrant Configuration in n8n:
- In the 'Create collection' and 'Refresh collection' HTTP Request nodes: update
QDRANTURL
with your Qdrant instance URL andCOLLECTION
with your desired collection name. Assign your Qdrant HTTP Auth credential. - In the 'Qdrant Vector Store' and 'Qdrant Vector Store1' LangChain nodes: update the 'Qdrant Collection' parameter with the same
COLLECTION
name. Assign your Qdrant API credential.
- In the 'Create collection' and 'Refresh collection' HTTP Request nodes: update
- Google Drive Configuration in n8n: In the 'Get folder' node, select your Google Drive credential and specify the 'Folder ID' from which to load documents. Documents should preferably be plain text (.txt) for optimal processing by the 'Default Data Loader'.
- OpenAI Configuration in n8n: Ensure your OpenAI credentials are assigned to all OpenAI nodes ('Embeddings OpenAI', 'Embeddings OpenAI1', 'OpenAI' Chat Model, 'OpenAI Chat Model' for Vector Store Tool).
- Initial Document Ingestion: Manually execute the workflow once using the 'When clicking ‘Test workflow’' trigger. This will create the Qdrant collection (if it doesn't exist), clear existing points, and ingest/vectorize documents from your specified Google Drive folder.
- Activate and Test: Activate the main workflow (triggered by the 'Listen' webhook node). Test the setup by interacting with your ElevenLabs voice agent. Ask it a question related to the documents you've ingested.
- (Optional) Embed ElevenLabs Widget: Add the ElevenLabs Convai widget to your website, replacing
AGENT_ID
with your ElevenLabs agent ID:<elevenlabs-convai agent-id="AGENT_ID"></elevenlabs-convai><script src="https://elevenlabs.io/convai-widget/index.js" async type="text/javascript"></script>
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation