Overview
The RAG (Retrieval-Augmented Generation) service is a powerful tool that helps the AI obtain the required context for generating better code suggestions. By indexing your codebase and providing relevant context to the AI, RAG significantly improves the quality and accuracy of AI responses.Prerequisites
Before enabling the RAG service, ensure you have:Docker or Nix
The RAG service requires either Docker or Nix to run. For macOS users, OrbStack is recommended as a Docker alternative.
LLM Provider
Configure an LLM provider (OpenAI, Ollama, DashScope, or OpenRouter) for the RAG service.
Configuration
Enable and configure the RAG service in your Avante setup:Configuration Options
Enables or disables the RAG service
The path on the host machine that will be mounted to the container. This allows the RAG service to access your files.
The mount will be read-only for security.
The container runtime to use. Options:
"docker"- Use Docker"nix"- Use Nix
Additional arguments to pass to the Docker command
LLM Configuration
Thellm block configures the language model used for RAG operations:
Model provider. Supported providers:
"openai""ollama""dashscope""openrouter"
API endpoint URL for the LLM provider
Environment variable name containing the API key
Model name to use for RAG operations
Additional configuration options for the LLM
Embedding Configuration
Theembed block configures the embedding model for semantic search:
Embedding provider. Same options as
llm.providerAPI endpoint URL for the embedding provider
Environment variable name containing the API key
Embedding model name
Additional configuration options for the embedding model
Supported Providers
- OpenAI
- Ollama
- DashScope
- OpenRouter
Container Management
After changing the RAG service configuration, you need to manually delete the container to ensure the new configuration is used:Mount Path Considerations
Home Directory (Default)
Home Directory (Default)
Path:
os.getenv("HOME")Use when: All your projects are within your home directory.Pros: Secure, limits access to your user files only.Cons: Cannot access projects outside your home directory.Project Directory
Project Directory
Path:
/path/to/your/projectUse when: You want to limit RAG to a specific project.Pros: Most restrictive, best security.Cons: Need to reconfigure for different projects.Root Directory
Root Directory
Path:
/Use when: Projects are scattered across your file system.Pros: Access to all files on your system.Cons: Broader access (though still read-only).Usage with @codebase
Once the RAG service is enabled, you can use the@codebase mention to leverage it:
- Index your codebase
- Find relevant code snippets
- Provide them as context to the AI
- Generate a more informed response
Troubleshooting
Container fails to start
Container fails to start
- Ensure Docker/Nix is running
- Check that you have internet connectivity
- Verify API keys are set correctly
- Remove and recreate the container:
RAG service is slow
RAG service is slow
- Consider using a faster embedding model
- Use
gpt-4o-miniinstead of larger models for LLM - Reduce the scope of your
host_mount
Cannot access project files
Cannot access project files
Ensure your project is within the
host_mount path. If projects are outside your home directory, you may need to set host_mount = "/".Related Documentation
Completion Sources
Learn about @codebase and other mentions
Providers
Configure AI providers