addDocument method

Future<SourceAddResult> addDocument(
  1. String content, {
  2. String? metadata,
  3. String? filePath,
  4. ChunkingStrategy? strategy,
  5. void onProgress(
    1. int done,
    2. int total
    )?,
})

Add a document with automatic chunking and embedding.

The document is split into chunks, embedded, and stored. Remember to call rebuildIndex after adding documents.

Implementation

Future<SourceAddResult> addDocument(
  String content, {
  String? metadata,
  String? filePath,
  ChunkingStrategy? strategy,
  void Function(int done, int total)? onProgress,
}) => _engine!.addDocument(
  content,
  metadata: metadata,
  filePath: filePath,
  strategy: strategy,
  onProgress: onProgress,
);