MobileRag class
Singleton facade for Mobile RAG Engine.
Use MobileRag.initialize to set up the engine, then access it via MobileRag.instance anywhere in your app.
Properties
- dbPath → String
-
Path to the SQLite database.
no setter
- engine → RagEngine
-
Access the underlying RagEngine for advanced operations.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- vocabSize → int
-
Vocabulary size of the loaded tokenizer.
no setter
Methods
-
addDocument(
String content, {String? metadata, String? filePath, ChunkingStrategy? strategy, void onProgress(int done, int total)?}) → Future< SourceAddResult> - Add a document with automatic chunking and embedding.
-
formatPrompt(
String query, RagSearchResult result) → String - Format search results as an LLM prompt.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rebuildIndex(
) → Future< void> - Rebuild the HNSW index after adding documents.
-
search(
String query, {int topK = 10, int tokenBudget = 2000, ContextStrategy strategy = ContextStrategy.relevanceFirst, int adjacentChunks = 0, bool singleSourceMode = false}) → Future< RagSearchResult> - Search for relevant chunks and assemble context for LLM.
-
toString(
) → String -
A string representation of this object.
inherited
-
tryLoadCachedIndex(
) → Future< bool> - Try to load a cached HNSW index.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → MobileRag
-
Get the singleton instance.
no setter
- isInitialized → bool
-
Check if the engine is initialized.
no setter