Configuration Guide
Configure SmartRAG for your specific needs with detailed options and best practices
Basic Configuration
SmartRAG can be configured with various options to suit your needs:
services.AddSmartRAG(options =>
{
options.AIProvider = AIProvider.Anthropic;
options.StorageProvider = StorageProvider.Qdrant;
options.ApiKey = "your-api-key";
});
Configuration Options
Option | Type | Default | Description |
---|---|---|---|
AIProvider |
AIProvider |
Anthropic |
The AI provider to use for embeddings |
StorageProvider |
StorageProvider |
Qdrant |
The storage provider for vectors |
ApiKey |
string |
Required | Your API key for the AI provider |
ModelName |
string |
Provider default | The specific model to use |
ChunkSize |
int |
1000 | Size of document chunks |
ChunkOverlap |
int |
200 | Overlap between chunks |
AI Provider Configuration
Choose from multiple AI providers for embedding generation:
Anthropic (Claude)
services.AddSmartRAG(options =>
{
options.AIProvider = AIProvider.Anthropic;
options.ApiKey = "your-anthropic-key";
options.ModelName = "claude-3-sonnet-20240229";
});
OpenAI
services.AddSmartRAG(options =>
{
options.AIProvider = AIProvider.OpenAI;
options.ApiKey = "your-openai-key";
options.ModelName = "text-embedding-ada-002";
});
Azure OpenAI
services.AddSmartRAG(options =>
{
options.AIProvider = AIProvider.AzureOpenAI;
options.ApiKey = "your-azure-key";
options.Endpoint = "https://your-resource.openai.azure.com/";
options.ModelName = "text-embedding-ada-002";
});
Google Gemini
services.AddSmartRAG(options =>
{
options.AIProvider = AIProvider.Gemini;
options.ApiKey = "your-gemini-key";
options.ModelName = "embedding-001";
});
Custom AI Provider
services.AddSmartRAG(options =>
{
options.AIProvider = AIProvider.Custom;
options.CustomEndpoint = "https://your-custom-api.com/v1/embeddings";
options.ApiKey = "your-custom-key";
options.ModelName = "your-custom-model";
});
Storage Provider Configuration
Choose the storage backend that best fits your needs:
Qdrant (Vector Database)
services.AddSmartRAG(options =>
{
options.StorageProvider = StorageProvider.Qdrant;
options.QdrantUrl = "http://localhost:6333";
options.CollectionName = "smartrag_documents";
});
Redis (In-Memory Cache)
services.AddSmartRAG(options =>
{
options.StorageProvider = StorageProvider.Redis;
options.RedisConnectionString = "localhost:6379";
options.DatabaseId = 0;
});
SQLite (Local Database)
services.AddSmartRAG(options =>
{
options.StorageProvider = StorageProvider.Sqlite;
options.ConnectionString = "Data Source=smartrag.db";
});
In-Memory (Development)
services.AddSmartRAG(options =>
{
options.StorageProvider = StorageProvider.InMemory;
// No additional configuration needed
});
File System (Local Storage)
services.AddSmartRAG(options =>
{
options.StorageProvider = StorageProvider.FileSystem;
options.StoragePath = "./data/smartrag";
});
Advanced Configuration
Fine-tune SmartRAG for your specific requirements:
Custom Chunking
services.AddSmartRAG(options =>
{
options.ChunkSize = 500;
options.ChunkOverlap = 100;
options.ChunkingStrategy = ChunkingStrategy.Sentence;
});
Document Processing
services.AddSmartRAG(options =>
{
options.SupportedFormats = new[] { ".pdf", ".docx", ".txt" };
options.MaxFileSize = 10 * 1024 * 1024; // 10MB
options.EnableTextExtraction = true;
});
Environment Configuration
Configure SmartRAG using environment variables or configuration files:
appsettings.json
{
"SmartRAG": {
"AIProvider": "Anthropic",
"StorageProvider": "Qdrant",
"ApiKey": "your-api-key",
"ChunkSize": 1000,
"ChunkOverlap": 200
}
}
Environment Variables
export SMARTRAG_AI_PROVIDER=Anthropic
export SMARTRAG_STORAGE_PROVIDER=Qdrant
export SMARTRAG_API_KEY=your-api-key
Best Practices
API Keys
Never hardcode API keys in source code. Use environment variables or secure configuration.
Chunk Size
Balance between context and performance. Smaller chunks for precision, larger for context.
Storage
Choose storage provider based on your scale and requirements.
Security
Use appropriate access controls and monitoring for production environments.