addDocument method
Add a document with automatic chunking and embedding.
The document is:
- Split into chunks based on file type (auto-detected from
filePath) - Each chunk is embedded using the loaded model
- Source and chunks are stored in the database
Remember to call rebuildIndex after adding documents for optimal search performance.
Implementation
Future<SourceAddResult> addDocument(
String content, {
String? metadata,
String? filePath,
ChunkingStrategy? strategy,
void Function(int done, int total)? onProgress,
}) => _ragService.addSourceWithChunking(
content,
metadata: metadata,
filePath: filePath,
strategy: strategy,
onProgress: onProgress,
);