services/rag_engine library

Unified RAG engine with simplified initialization.

This class combines tokenizer, embedding model, and RAG service initialization into a single initialize() call.

Quick Start

import 'package:mobile_rag_engine/mobile_rag_engine.dart';

// NOTE: For most apps, use [MobileRag] singleton instead.
// It wraps this class and handles global access.

// If you need a standalone engine instance:
final rag = await RagEngine.initialize(
  config: RagConfig.fromAssets(
    tokenizerAsset: 'assets/tokenizer.json',
    modelAsset: 'assets/model.onnx',
  ),
);

// Use the engine
await rag.addDocument('Your document text here');
await rag.rebuildIndex();
final result = await rag.search('query', tokenBudget: 2000);

Classes

RagEngine
Unified RAG engine with simplified initialization.