rag constant
GemmaRag
const rag
Retrieval-augmented-generation (vector store) operations, namespaced.
Opt-in: requires a RAG package (flutter_gemma_rag_qdrant /
flutter_gemma_rag_sqlite) registered via
FlutterGemma.initialize(vectorStore: ...). Without one, every call
throws a clear "add a RAG package" error.
// Native: an absolute path in a writable directory. A bare name resolves
// against the process working directory, which is not writable on
// Android or iOS. Web: a bare name is fine.
final dir = await getApplicationDocumentsDirectory(); // path_provider
await FlutterGemma.rag.initialize('${dir.path}/rag.db');
await FlutterGemma.rag.addDocument(id: '1', content: 'hello');
final hits = await FlutterGemma.rag.searchSimilar(query: 'hi');
await FlutterGemma.rag.removeDocument(id: '1');
Implementation
static const GemmaRag rag = GemmaRag._();