ai_edge_rag 0.0.1
ai_edge_rag: ^0.0.1 copied to clipboard
Flutter plugin for on-device AI inference with MediaPipe RAG.
0.0.1 #
Features #
-
RAG Support: Complete implementation of Retrieval Augmented Generation capabilities
- Semantic search using vector similarity
- Context-aware response generation
- Document retrieval from vector stores
-
Embedding Models: Support for both local and cloud-based embeddings
- Local embedding models (Gemma and Gecko)
- Gemini API-based embeddings for cloud processing
- On-device embedding generation for privacy
-
Vector Storage: Flexible storage options for embeddings
- In-memory vector store for fast access
- SQLite vector store for persistent storage
- Automatic persistence across app restarts
-
Document Processing: Comprehensive text chunking capabilities
- Manual chunk management (
memorizeChunk,memorizeChunks) - Automatic text chunking with configurable size and overlap
- Support for large document processing
- Manual chunk management (
-
Streaming Responses: Real-time text generation
- Streaming API for progressive response display
- Full text accumulation in
partialResult - Event-based completion notification
-
Customizable Retrieval: Fine-tuned context retrieval
- Configurable
topKfor number of retrieved chunks minSimilarityScorethreshold for relevance filtering- System instructions for RAG behavior control
- Configurable
Documentation #
- Comprehensive README.md with usage examples
- Detailed Dart doc comments for all public APIs
- API reference documentation
- Best practices and troubleshooting guides
- Use case examples and implementation patterns
Testing #
- Complete unit test suite (28 tests)
- Model and session creation tests
- Embedding model configuration tests
- Document memorization tests
- RAG generation tests
- Type validation tests
Platform Support #
- Android support (API level 24+)
- GPU acceleration support
- Hardware backend selection
- Large heap configuration for big models
API #
Core classes and methods:
AiEdgeRag- Main entry pointcreateEmbeddingModel()- Local embedding model setupcreateGeminiEmbedder()- Gemini API embedder setupmemorizeChunk()- Single chunk storagememorizeChunks()- Batch chunk storagememorizeChunkedText()- Automatic text chunking and storagesetSystemInstruction()- RAG behavior configurationgenerateResponseAsync()- Context-aware streaming generationEmbeddingModelConfig- Local embedding configurationGeminiEmbedderConfig- Gemini API configurationSystemInstruction- RAG system instructionVectorStore- Storage type enum (inMemory, sqlite)EmbeddingModelType- Model type enum (gemma, gecko)
Known Limitations #
- iOS support not yet implemented (Android only)
- Embedding models must be in MediaPipe format
- SQLite vector store uses basic similarity search without advanced indexing