Skip to main content

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.
The RAG service is disabled by default. You need to explicitly enable it in your configuration.

Prerequisites

Before enabling the RAG service, ensure you have:
1

Docker or Nix

The RAG service requires either Docker or Nix to run. For macOS users, OrbStack is recommended as a Docker alternative.
2

LLM Provider

Configure an LLM provider (OpenAI, Ollama, DashScope, or OpenRouter) for the RAG service.
3

Embedding Provider

Configure an embedding model provider for semantic search capabilities.

Configuration

Enable and configure the RAG service in your Avante setup:

Configuration Options

boolean
default:"false"
Enables or disables the RAG service
string
default:"$HOME"
The path on the host machine that will be mounted to the container. This allows the RAG service to access your files.
You can mount:
  • Your home directory (default)
  • The project directory only
  • The root directory / for system-wide access
The mount will be read-only for security.
string
default:"docker"
The container runtime to use. Options:
  • "docker" - Use Docker
  • "nix" - Use Nix
string
Additional arguments to pass to the Docker command

LLM Configuration

The llm block configures the language model used for RAG operations:
string
required
Model provider. Supported providers:
  • "openai"
  • "ollama"
  • "dashscope"
  • "openrouter"
string
required
API endpoint URL for the LLM provider
string
required
Environment variable name containing the API key
string
required
Model name to use for RAG operations
table
Additional configuration options for the LLM

Embedding Configuration

The embed block configures the embedding model for semantic search:
string
required
Embedding provider. Same options as llm.provider
string
required
API endpoint URL for the embedding provider
string
required
Environment variable name containing the API key
string
required
Embedding model name
table
Additional configuration options for the embedding model

Supported Providers

Container Management

After changing the RAG service configuration, you need to manually delete the container to ensure the new configuration is used:
The container will be recreated automatically the next time you use Avante.

Mount Path Considerations

Choose your host_mount path carefully based on where your projects are stored.
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.
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.
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:
The RAG service will:
  1. Index your codebase
  2. Find relevant code snippets
  3. Provide them as context to the AI
  4. Generate a more informed response
For more information on using mentions, see the Completion Sources documentation.

Troubleshooting

  1. Ensure Docker/Nix is running
  2. Check that you have internet connectivity
  3. Verify API keys are set correctly
  4. Remove and recreate the container:
  1. Consider using a faster embedding model
  2. Use gpt-4o-mini instead of larger models for LLM
  3. Reduce the scope of your host_mount
Ensure your project is within the host_mount path. If projects are outside your home directory, you may need to set host_mount = "/".

Completion Sources

Learn about @codebase and other mentions

Providers

Configure AI providers