flutter_gemma_rag_qdrant 1.0.0
flutter_gemma_rag_qdrant: ^1.0.0 copied to clipboard
qdrant-edge on-device RAG vector store for flutter_gemma (native Rust FFI). Opt-in VectorStoreRepository with payload filtering. Native platforms only (no web).
flutter_gemma_rag_qdrant #
qdrant-edge on-device RAG vector store for flutter_gemma.
Opt-in package implementing VectorStoreRepository via a Rust FFI shim
(qdrant-edge) — ~75× faster search than the legacy sqlite + HNSW path.
Native only (Android, iOS, macOS, Linux, Windows). For web, use
flutter_gemma_rag_sqlite
(WebSqliteVectorStore).
Usage #
import 'package:flutter_gemma/flutter_gemma.dart';
import 'package:flutter_gemma_rag_qdrant/flutter_gemma_rag_qdrant.dart';
await FlutterGemma.initialize(
vectorStore: QdrantVectorStore(),
);
Then use the unchanged RAG API:
await FlutterGemmaPlugin.instance.initializeVectorStore('rag_store'); // a directory
await FlutterGemmaPlugin.instance.addDocument(/* ... */);
final hits = await FlutterGemmaPlugin.instance.searchSimilar(query, topK: 5);
QdrantVectorStore also honors the payload-aware Filter DSL on
searchSimilar(..., filter: Filter(must: [FieldEquals(key: 'lang', value: 'en')], mustNot: [...])).
The storage path passed to
initializeVectorStoreis treated as a shard directory (qdrant creates files under it), not a single.dbfile. Use a distinct path from any sqlite store so they don't collide on disk.
Behavior notes #
- Cross-platform web is not supported —
QdrantVectorStoreis native-only. enableHnswis accepted but a no-op: qdrant decides indexing internally (brute-forces below ~20k points, which is already faster than the Dart HNSW for typical RAG corpora).addDocument'smetadatais forwarded as a raw JSON string into the payload; filtering by metadata fields requires valid JSON.- Distance defaults to cosine.
Platforms #
| Platform | Support |
|---|---|
| Android / iOS | ✅ FFI (qdrant-edge) |
| macOS / Linux / Windows | ✅ FFI (qdrant-edge) |
| Web | ❌ — use flutter_gemma_rag_sqlite (WebSqliteVectorStore) |
The native library is fetched at build time by the package's Native-Assets hook (SHA256-verified) — no manual setup.