flutter_edge_ai_rag library

Pluggable on-device RAG for Flutter Edge AI: independent vector-store providers, embedders and indexes.

Re-exports the core embedding types RAG code needs, so vector-store packages import only this library.

Classes

Condition
A predicate over one metadata field.
EmbeddingInput
One thing to embed, shaped like Message: optional text plus media.
EmbeddingProfile
Stable identity and vector dimension for one embedding space.
FieldEquals
Exact scalar equality against a metadata field.
FieldMatchAny
Set-membership predicate against a metadata field.
FieldRange
Inclusive numeric range against a metadata field.
Filter
Payload filter applied alongside vector similarity search.
FilterField
A metadata field promoted to a backend-native filterable field.
FilterSchema
Metadata fields a vector store should make filterable.
FlutterEdgeAiActiveEmbedder
Borrowed adapter over Flutter Edge AI's active embedding model.
FlutterEdgeAiRag
Instance-scoped RAG factory and vector-store provider registry.
HybridFusion
How a hybrid search fuses its vector and text results.
HybridSearchResult
A single hit from a hybrid (vector + text) search.
RagEmbedder
Embeds RAG documents and queries in one declared embedding space.
RagIndex
An independently-owned RAG index over one bound vector-store location.
RetrievalResult
A single retrieval hit from a vector store query.
RrfFusion
Reciprocal Rank Fusion: a document scores 1 / (k + rank) in each leg that returned it, summed over the legs. Ranks start at 1.
TextSearchResult
A single hit from a store's text search.
VectorStoreBinding
The durable association of one vector-store location with one embedding space (profile) and the one modality its documents have (documents).
VectorStoreProvider
Factory for fresh vector-store instances.
VectorStoreRepository
Storage contract implemented by pluggable vector-store packages: extend it (final class MyStore extends VectorStoreRepository).
VectorStoreSpec
Describes a vector-store instance to create.
VectorStoreStats
Summary statistics for a vector store.

Enums

EmbeddingModality
A kind of input an embedding model can turn into a vector.
FilterFieldType
TaskType
What an embedding is for. Every engine prepends prefix to the TEXT part of an input, native and web alike; media parts never get a prefix.

Functions

ragLog(String message) → void
Writes a debug-only diagnostic through Flutter Edge AI's shared logger.

Typedefs

ActiveEmbedderSpecResolver = EmbeddingModelSpec? Function()
ActiveEmbeddingModelResolver = Future<EmbeddingModel> Function()

Exceptions / Errors

EmbedderClosedException
The model was closed, or closed before this request started — so the request never ran.
EmbedderCloseTimeoutException
The previous embedder's close did not finish within the limit (60 s), measured from the moment that close STARTED, so FlutterEdgeAi.getActiveEmbedder built nothing: two native models are never resident at once.
EmbeddingCancelledException
embedAll was cancelled through its CancelToken. No partial results are returned.
EmbeddingEngineException
The engine failed while embedding.
EmbeddingException
Common base of every embedding failure. Not sealed, so a later kind of failure is an additive change; catch this to handle them all.
EmbeddingFormatNotSupportedException
A media part's container is not one the engine accepts (e.g. HEIC where the engine decodes JPEG/PNG/GIF/BMP only).
EmbeddingInputTooLongException
The input is longer than maxInputTokens — task prefix, BOS and EOS included. Nothing was truncated; split the text and embed the pieces.
EmbeddingLoadException
The engine could not load the model, or refused the requested configuration (e.g. a modality it cannot serve).
EmbeddingModalityNotLoadedException
The input carries modality, which this model was not loaded with (loaded is what it was loaded with). Declare media at load: getActiveEmbedder(supportImage: true).
UnsupportedEmbeddingCombinationException
The input carries several parts — several modalities, or several images (requested names its modalities) — and the engine embeds one part per vector.
VectorStoreException