Documentation agent
Build a voice assistant that answers questions about your docs
Try our live implementation using the voice widget in the bottom-right corner of this page.
Overview
Build a voice-powered documentation assistant step by step. Use API requests (shown below) or the Vapi Dashboard.
You’ll learn to:
- Index your docs with LlamaCloud
- Create a RAG tool for document retrieval
- Create an assistant with Claude 3.5 Sonnet and attach the tool
- Use the Web SDK to create a widget
- Analyze user sessions and improve the quality of your agent overtime
Prerequisites
- Vapi account with API access
- Documentation content - use your
llms-full.txt
file (example), available out-of-box on Fern or Mintlify - LlamaCloud account for indexing
Get started
Index your documentation
Upload and index your documentation in LlamaCloud using text-embedding-3-small
.
- Create a new project in LlamaCloud
- Upload your documentation files (you can use a single consolidated file like llms-full.txt)
- Configure embedding model to
text-embedding-3-small
- Set chunking to 512 tokens with 50 token overlap
- Note your index ID and API credentials
Consolidate your documentation into a single text file for better RAG performance. You can see our example at docs.vapi.ai/llms-full.txt.
Create the RAG tool
Create a tool that connects your assistant to your LlamaCloud index using the Tools API.
You can also create this tool in the Vapi Dashboard.
Replace YOUR_PIPELINE_ID
with your LlamaCloud pipeline ID and YOUR_LLAMACLOUD_API_KEY
with your API key. Save the tool ID from the response for the next step.
Create an assistant with the tool
Create an assistant using the Assistant API with the RAG tool attached.
You can also create this assistant in the Vapi Dashboard.
Replace YOUR_TOOL_ID_FROM_STEP_2
with the tool ID from step 2. Save the assistant ID from the response for the next step.
See our complete documentation agent prompt that includes detailed personality, style guidelines, and interaction patterns.
Create a web component
Use the Vapi Web SDK to create a voice widget.
Replace YOUR_PUBLIC_API_KEY
and YOUR_ASSISTANT_ID
with your actual values:
For a complete implementation with waveform visualization, real-time transcripts, and responsive design, check out our voice widget component on GitHub.
Improve your prompts with call analysis
Vapi automatically analyzes every call. The assistant above includes an analysisPlan
with summary and success evaluation configured.
Configure additional analysis options in your assistant:
- Summary plan: Custom prompts for call summaries
- Structured data plan: Extract specific information using JSON schemas
- Success evaluation plan: Score calls with custom rubrics
- Structured data multi plan: Multiple extraction schemas
Retrieve analysis results using the Get Call API:
The response includes call.analysis
with your configured analysis results. Learn more about call analysis configuration.
Iterative improvements:
- Review analysis summaries to identify common user questions
- Use structured data to track conversation patterns
- Monitor success evaluations to optimize assistant performance
- Update your system prompt based on recurring issues
- Refine RAG retrieval based on query success patterns