[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BXT405PWC4VD9Q6TTC74NS":3,"skill-same:01M6BXT405PWC4VD9Q6TTC74NS":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":45,"linkOnly":46,"markdownContent":47,"markdownBody":48,"frontMatter":49,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":53,"repositoryHtmlUrl":54,"repositoryHomepageUrl":55,"ownerHtmlUrl":56,"ownerBlogUrl":6,"ownerDescription":57,"updatedAt":58,"install":59,"resources":72},"01M6BXT405PWC4VD9Q6TTC74NS","flutter-edge-ai-rag",null,"Use when adding or debugging on-device RAG, semantic search, embeddings (EmbeddingGemma 2 .litertlm or .gguf through flutter_edge_ai_llama, EmbeddingGemma 1 or Gecko .tflite, ONNX models such as MiniLM), metadata filters, embedding profiles, image or audio document indexes, or pluggable sqlite-vec\u002Fqdrant-edge storage in a flutter_edge_ai app with flutter_edge_ai_rag, flutter_edge_ai_sqlite or flutter_edge_ai_qdrant. Also use when moving RAG code to flutter_edge_ai 2.0 or to flutter_edge_ai_rag 1.1 — FlutterEdgeAi.rag is undefined, initialize(vectorStore:) was removed, addText\u002FsearchText\u002FactiveEmbedderProfileId are undefined, or open() throws \"No vector-store provider can handle providerId\" or \"is bound to\" — and when QdrantLegacyStoreException or an embedding-profile mismatch is thrown.","DenisovAV\u002Fflutter_edge_ai","DenisovAV","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F9622910?v=4","01M6BXRH02KTWK364FYEH4AECE","Sasha Denisov","01M6BXRH45KJKJ712H82EV47AS",662,"MIT","https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fpackages\u002Fflutter_edge_ai\u002Fskills\u002Fflutter-edge-ai-rag\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"flutter edge ai rag","edge ai","flutter","rag","edge","when","tflite","filters","embedding","app","semantic search","storage","sqlite","code","image","debugging","open","onnx","vector","search","Audio","2026-11-10 10:12:30",false,"---\nname: flutter-edge-ai-rag\ndescription: Use when adding or debugging on-device RAG, semantic search, embeddings (EmbeddingGemma 2 .litertlm or .gguf through flutter_edge_ai_llama, EmbeddingGemma 1 or Gecko .tflite, ONNX models such as MiniLM), metadata filters, embedding profiles, image or audio document indexes, or pluggable sqlite-vec\u002Fqdrant-edge storage in a flutter_edge_ai app with flutter_edge_ai_rag, flutter_edge_ai_sqlite or flutter_edge_ai_qdrant. Also use when moving RAG code to flutter_edge_ai 2.0 or to flutter_edge_ai_rag 1.1 — FlutterEdgeAi.rag is undefined, initialize(vectorStore:) was removed, addText\u002FsearchText\u002FactiveEmbedderProfileId are undefined, or open() throws \"No vector-store provider can handle providerId\" or \"is bound to\" — and when QdrantLegacyStoreException or an embedding-profile mismatch is thrown.\n---\n\n# On-device RAG with Flutter Edge AI\n\n## Non-negotiable architecture\n\n1. RAG is not initialized by `FlutterEdgeAi.initialize()`. Use the independent\n   `flutter_edge_ai_rag` package and an app-owned `FlutterEdgeAiRag` instance.\n2. Storage packages are providers: `flutter_edge_ai_sqlite` registers\n   `SqliteVectorStoreProvider`; `flutter_edge_ai_qdrant` registers\n   `QdrantVectorStoreProvider`. Application code uses `RagIndex`.\n3. One persistent location belongs to one stable `EmbeddingProfile` and one\n   document modality (`VectorStoreSpec.documents`: text, image or audio). The\n   profile id versions weights, tokenizer, pooling, normalization, and\n   document\u002Fquery prefixes; a mutable URL or file path is not an identity.\n   Profile ids may not contain control characters.\n4. Keep one live `RagIndex` per location, make opening single-flight, and share\n   it across widgets. Web SQLite enforces this with an exclusive Web Lock.\n5. Dispose indexes before `FlutterEdgeAi.dispose()` or before disposing a\n   custom embedder. An index owns its vector store but only borrows its embedder.\n6. Declare every filter field in `VectorStoreSpec.filterSchema` before the\n   SQLite index is created. Changing SQLite's physical `vec0` schema requires a\n   new schema-versioned location and re-index.\n7. `location` is an absolute path on native — a database file for SQLite, a\n   directory for Qdrant; build it from `getApplicationDocumentsDirectory()` —\n   and a plain name on Web.\n\n## Packages\n\n```sh\nflutter pub add flutter_edge_ai flutter_edge_ai_rag flutter_edge_ai_sqlite path path_provider\n```\n\nFor the default core embedder also add its runtime\u002Ftokenizer packages, usually\n`flutter_edge_ai_litertlm` and `flutter_edge_ai_embeddings`. Replace SQLite\nwith `flutter_edge_ai_qdrant` for qdrant-edge on native platforms. SQLite runs\non Android, iOS, Web, macOS, Windows, and Linux; qdrant-edge has no Web arm.\n\n`flutter_edge_ai_sqlite` needs Flutter 3.47 or newer. On older Flutter use\n`flutter_edge_ai_qdrant` (native only) or upgrade Flutter.\n\n`flutter_edge_ai_rag` re-exports `EmbeddingInput`, `EmbeddingModality`,\n`TaskType` and the `EmbeddingException` family, so RAG code needs no core\nimport for them.\n\n## Default active embedder\n\nInitialize only embedding runtime pieces in core and install the embedder\nbefore opening an index: `open()` resolves the embedder's profile, which loads\nthe model. Pin model downloads to an immutable revision.\n\n`FlutterEdgeAiActiveEmbedder.forActiveModel(namespace:)` derives the profile id\nfrom the installed file names (`'\u003Cnamespace>@\u003Cfiles joined by +>'`, with `%`,\n`@` and `+` inside a name percent-encoded), so\ninstalling a model under different file names changes the id and the old\nlocation refuses to open instead of mixing two embedding spaces. EmbeddingGemma\n1 and 2 are both 768-dimensional: the id is the only thing that tells them\napart. The id follows file NAMES, not bytes: install the registry build, as\nbelow — its file names carry the revision — so new weights under the same\ndownload name get a new id too. An app that installed under other names keeps\nthem: its id follows those.\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\nimport 'package:flutter_edge_ai_embeddings\u002Fflutter_edge_ai_embeddings.dart';\nimport 'package:flutter_edge_ai_litertlm\u002Fflutter_edge_ai_litertlm.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\n\u002F\u002F EmbeddingGemma is gated: build with --dart-define=HUGGINGFACE_TOKEN=hf_...\nconst hfToken = String.fromEnvironment('HUGGINGFACE_TOKEN');\n\nawait FlutterEdgeAi.initialize(\n  embeddingBackends: const [LiteRtEmbeddingBackend()],\n  embeddingTokenizers: const [GemmaEmbeddingTokenizers()],\n  huggingFaceToken: hfToken.isEmpty ? null : hfToken,\n);\n\u002F\u002F The registry build: commit 29888fce, revision-qualified file names.\nawait FlutterEdgeAi.installEmbedder().fromCatalog(LiteRtEmbedders.embeddinggemma300m.seq256)\n    .install();\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\n\u002F\u002F Native: an absolute path to the database file. Web: a plain name.\nconst databaseName = 'knowledge-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n    filterSchema: FilterSchema(fields: [\n      FilterField(name: 'lang', type: FilterFieldType.string),\n      FilterField(name: 'year', type: FilterFieldType.number),\n    ]),\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(namespace: 'knowledge'),\n);\n```\n\nThe EmbeddingGemma repo is gated: the Hugging Face account behind the token\nmust accept the Gemma license on the model page, or the download is refused.\nKeep the token out of source — it is compiled into the app, so a shipped app\nshould download from a repo that needs none.\n\nAn explicit id is the alternative when one store must outlive a file rename,\nor serve several bundles known to produce identical vectors. Name everything\nthat shapes the vectors:\n\n```dart\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\n\nfinal embedder = FlutterEdgeAiActiveEmbedder(\n  profileId:\n      'embeddinggemma-300m-seq256-mp-rev-29888fcee321-'\n      'retrieval-prefix-meanpool-l2-v1',\n);\n```\n\nThe adapter pins the embedding model that is active when it is created and\nresolves the model again on every operation, so it follows core's embedder\ncache. After switching embedders it throws `StateError`: create a new embedder\nand open a new index at a new location. A request that failed because core\nreplaced the model before it ran (`EmbedderClosedException`) is retried once.\nQueries over text documents use `TaskType.retrievalQuery`; pass `queryTask:`\nfor another task, e.g. `TaskType.questionAnswering`.\n\n## GGUF embeddings (`flutter_edge_ai_llama` 0.0.3+)\n\n`LlamaEmbeddingBackend` in `flutter_edge_ai_llama` 0.0.3 (core 2.5.0, llamadart\n0.15.1) runs EmbeddingGemma 2 GGUF text embeddings natively. 0.0.6 moves to\nllamadart 0.17.5: measured there on macOS CPU\u002FMetal (#764); Linux\u002FWindows CPU were\nmeasured on 0.15.1 only; Android (CPU only) and iOS are not qualified, and only\nthe Q8_0 file below is numerically qualified. An explicit GPU request on\nAndroid, iOS simulators and, from 0.0.6, macOS x64 loads on the CPU, or fails\nwith `backendFallback: false`. A `.gguf` carries its own\ntokenizer: a `tokenizerFrom…()` makes `install()` throw `ArgumentError`.\n\nApp setup (that package's README, *Add it to your app*, and `doc\u002Fplatforms.md`):\n`hooks: user_defines: llamadart: llamadart_native_runtimes: [llama_cpp]` in the\napp's pubspec, or the workspace root's; on iOS\u002FmacOS also\n`llamadart_llama_cpp_flutter: 0.17.3` (0.15.0 before 0.0.6) in the app's own dependencies,\n`flutter config --enable-swift-package-manager`, and iOS 16.4 \u002F macOS 14\ndeployment targets; on Android arm64-v8a and x86_64 only. From\n`flutter_edge_ai_litertlm` 1.19.0 LiteRT-LM keeps Swift Package Manager on too,\nand both native libraries load in one macOS app; running both engines' models\nin one app is not qualified.\n\n```dart\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\nimport 'package:flutter_edge_ai_llama\u002Fflutter_edge_ai_llama.dart';\n\nawait FlutterEdgeAi.initialize(\n  embeddingBackends: const [LlamaEmbeddingBackend()],\n);\nawait FlutterEdgeAi.installEmbedder()\n    .modelFromNetwork(\n      'https:\u002F\u002Fhuggingface.co\u002Fggml-org\u002Fembeddinggemma-2-GGUF\u002Fresolve\u002F'\n      'bfcd298762cc34d0357ece5ebdd31791a3a374d8\u002Fembeddinggemma-2-Q8_0.gguf',\n    ) \u002F\u002F no tokenizer\n    .install();\nfinal embedder = await FlutterEdgeAi.getActiveEmbedder();\n```\n\n- Text only: `supportImage`, `supportAudio` and `PreferredBackend.npu` throw\n  `EmbeddingLoadException`. On Android (every device), iOS simulators and, from\n  0.0.6, macOS x64\u002FRosetta an explicit `gpu` falls back to CPU with a warning, or throws with\n  `LlamaEmbeddingBackend(backendFallback: false)`; `activeBackend` reports what\n  loaded.\n- Only a mean-pooled `gemma-embedding2` GGUF loads; any other architecture or\n  pooling throws `EmbeddingLoadException`.\n- `maxInputTokens` is 1024, task prefix and special tokens included. A longer\n  input throws `EmbeddingInputTooLongException` and is never truncated.\n- A URL that does not end in `.gguf` needs\n  `modelFromNetwork(url, filename: '\u003Cname>.gguf')`; without it `install()`\n  throws `StateError` asking for a tokenizer.\n- On Web it claims no file: with it the only backend registered, installing a\n  `.gguf` throws `UnsupportedError` before anything is downloaded.\n- Keep GGUF and LiteRT under separate profile ids, even at 768 dimensions.\n  `FlutterEdgeAiActiveEmbedder.forActiveModel(namespace:)` does it by itself,\n  because the file names differ; with an explicit `profileId`, name the format\n  and quantization (e.g. `embeddinggemma2-gguf-q8_0`). A store bound to the\n  LiteRT id refuses to open with the GGUF embedder.\n\n## Custom embedding providers (core 2.5.0)\n\nEngine authors import the SPI:\n\n```dart\nimport 'package:flutter_edge_ai\u002Fengine.dart';\n```\n\nCore accepts self-contained `.gguf` embedding files without a separate\ntokenizer (the app recipe is the GGUF embeddings section above). When backends are registered, installation requires one that can run\nthe file; with none registered, installation can proceed.\n`flutter_edge_ai_embeddings` contains tokenizer implementations only; runtime\npasses belong to their engine packages.\n\nProviders declare explicit accelerator capabilities with `honouredBackends(spec)`;\ncore computes the cache key. Automatic requests reuse only a non-NPU embedder\nfor the same installed model, while NPU requests always retain a separate key.\nRepeated explicit CPU\u002FGPU requests reuse their originating fallback until a\nrebuild is needed or the model is closed.\nGPU-capable providers must report their actual loaded accelerator through\n`EmbeddingPassInfo.activeBackend`; legacy fixed descriptors remain compatible.\nReporting providers print one release-visible WARNING per new fallback load,\nincluding an NPU request; reuse does not repeat it.\n`EmbeddingModel.maxInputTokens` is the effective loaded context\u002Fsingle-pass batch\ncapacity, including task prefixes and special tokens. A GGUF profile configured\nwith a 1024-token micro-batch cannot embed a longer chunk even if the file names\na larger context. Core hosts, caches and closes the pass.\n\n## EmbeddingGemma 2 (one `.litertlm` file)\n\nEmbeddingGemma 2 ships as one `.litertlm` bundle that carries its own\ntokenizer: install the model alone — no `tokenizerFrom…()` call, and no\n`flutter_edge_ai_embeddings` or `embeddingTokenizers:` needed. The repo is not\ngated:\n\n```dart\nconst eg2Revision = '9be6e8b90982095dc05c2bd162e4b954ee4dbac7';\n\u002F\u002F One id for the 270m, 440m and 740m bundles: their text towers are identical.\nconst eg2ProfileId = 'embeddinggemma2-litertlm-text-4410a540ce75-prefix-v1';\n\nawait FlutterEdgeAi.initialize(\n  embeddingBackends: const [LiteRtEmbeddingBackend()],\n);\nawait FlutterEdgeAi.installEmbedder()\n    .modelFromNetwork(\n      'https:\u002F\u002Fhuggingface.co\u002Flitert-community\u002F'\n      'embeddinggemma-2-text-270m-litert-lm\u002Fresolve\u002F$eg2Revision\u002F'\n      'embeddinggemma-2-text-270m.litertlm',\n    )\n    .install();\nfinal embedder = await FlutterEdgeAi.getActiveEmbedder();\nfinal limit = embedder.maxInputTokens; \u002F\u002F 1024\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal eg2Index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: p.join(\n      (await getApplicationDocumentsDirectory()).path,\n      'knowledge-embeddinggemma2-text-v1.db',\n    ),\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder(profileId: eg2ProfileId),\n);\n```\n\n- Android, iOS, macOS, Linux, Windows (`flutter_edge_ai_litertlm` 1.13.0 for\n  text, 1.13.1 for images and audio), and Web on WebGPU through\n  `@litert-lm\u002Fcore`'s EmbeddingEngine (1.13.1 for text and images, 1.13.2 for\n  audio and combined inputs). The Web page needs\n  `window.EmbeddingEngine = m.EmbeddingEngine;` next to `window.Engine =\n  m.Engine;` in its `@litert-lm\u002Fcore` module script; without it the load fails\n  with an `EmbeddingLoadException` naming that line. The browser needs WebGPU:\n  the CPU (WebAssembly) path of `@litert-lm\u002Fcore` 0.18.0 cannot read these\n  bundles' external weights, so there is no CPU fallback, and a browser\n  without WebGPU (no `navigator.gpu`, or no adapter) fails the load with an\n  `EmbeddingLoadException` that says so.\n- The 270m is text only: `getActiveEmbedder(supportImage: true)` throws\n  `EmbeddingLoadException` naming the 440m bundle — natively before any engine\n  or cache is made (below); on Web only after the bundle was read, when the\n  runtime refuses to create the engine. `supportAudio: true` needs the 740m\n  bundle (below): on the 270m and the 440m it throws `EmbeddingLoadException`\n  naming the 740m, read from the bundle's container header before any engine\n  exists — on Web too.\n- `maxInputTokens` is 1024 — task prefix, BOS and EOS included. Keep chunks at\n  512 tokens or fewer: memory grows with the input length. A longer text throws\n  `EmbeddingInputTooLongException` with the exact `actualTokens` (natively\n  from `flutter_edge_ai_litertlm` 1.13.1, from a truncated run; on Web read\n  after the engine ran the whole input in 1024-token windows). Either way an\n  over-long chunk still costs a full embedding before it is refused: split\n  before embedding.\n- It runs on CPU natively (`activeBackend` is `PreferredBackend.cpu`) and on\n  WebGPU on Web (`PreferredBackend.gpu`), and refuses `PreferredBackend.npu`:\n  the NPU runs the per-SoC bundles (next section). Native GPU support is\n  enabled in code (`native_hosts.dart`) per host and bundle: Linux x64 for the\n  270m, 440m and 740m; Windows x64 for the 270m; macOS arm64 for the 270m and\n  740m. Other bundle combinations on those GPU hosts throw\n  `EmbeddingLoadException` as unmeasured. The Linux rows were measured on an\n  NVIDIA L4, 2026-10-26 ([PR #714](https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fpull\u002F714));\n  the Windows 270m passed on Panther Lake Arc B390 and Lunar Lake Arc 140V,\n  2026-11-04\n  ([0.19 paid-run report](https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fdoc\u002Fresearch\u002Flitertlm-0.19-l1-paid-runs.md));\n  the macOS rows were measured on an M5 Pro, 2026-11-04, at 24 ms\n  ([0.19 phase-1 report](https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fdoc\u002Fresearch\u002Flitertlm-0.19-phase1.md)).\n  Only the text tower runs on GPU; 440m\u002F740m vision and audio towers run on CPU\n  beside it. On iOS, Android and Linux arm64, `gpu` is not applied and the\n  embedder runs on CPU with core's notice. Web vectors therefore\n  differ slightly from native ones — measured min cos about 0.995 for text and\n  0.998 for images against the native CPU vectors — and retrieval across\n  platforms holds: web queries find natively embedded images and native\n  queries find web-embedded images, top-1 10\u002F10 on the example's ten scenes.\n  Natively it keeps a weight cache of about 71 MB, on top of the 165 MB\n  bundle, in the app's cache directory: never backed up, and rebuilt at the\n  next load if the OS clears it. A load whose cache file cannot be created (a\n  path past Windows MAX_PATH, a directory the app cannot write to, possibly no\n  free space at all) still runs, slower and larger, with a printed warning;\n  `LiteRtEmbeddingBackend(requireWeightCache: true)`\n  (`flutter_edge_ai_litertlm` 1.14.0) refuses it with `EmbeddingLoadException`\n  instead — on CPU, and on the NPU with declared audio. A disk that fills\n  while the cache is being written aborts the process in native code\n  (XNNPack); no flag catches that. Web keeps no weight cache and ignores the\n  flag, and so does a `.tflite` embedder (EmbeddingGemma 1, Gecko); each says\n  so once, in a debug-build log line.\n- EmbeddingGemma 1, 2 and Gecko all produce 768-d vectors but are different\n  spaces: give each its own location and profile ID — the dimension check alone\n  cannot tell them apart. `FlutterEdgeAiActiveEmbedder.forActiveModel` already\n  gives them different ids (different file names); the explicit id above is for\n  one text store shared by the three EmbeddingGemma 2 bundles.\n\n### EmbeddingGemma 2 at 128, 256 or 512 dimensions (Matryoshka)\n\nEmbeddingGemma 2 is trained with Matryoshka representation learning: the first\n128, 256 or 512 values of its 768-d text vector, L2-normalized again, are an\nembedding of their own. There is no API for it, and none is needed: take the\nfirst N values of the vector the embedder returns and normalize them.\nMeasured 2026-10-22 on the 270m bundle (CPU, the ten golden texts): this is\nthe same vector LiteRT-LM's own `output_size` option returns (cos 1.000000 at\n128, 256 and 512), each query still ranks its document first (5\u002F5), and the\nminimum cosine to Sentence Transformers fp32 cut to the same size is 0.976\n(512) to 0.986 (128), against 0.977 at the full 768.\nImages and audio were not measured; keep truncation to text.\n\n```dart\nimport 'dart:math' as math;\n\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\n\nList\u003Cdouble> truncateEmbedding(List\u003Cdouble> vector, int dimension) {\n  final head = vector.sublist(0, dimension);\n  final norm = math.sqrt(head.fold(0.0, (sum, x) => sum + x * x));\n  return [for (final x in head) x \u002F norm];\n}\n\nfinal embedder = await FlutterEdgeAi.getActiveEmbedder();\nfinal full = await embedder.embed(\n  EmbeddingInput.text('Flutter runs on six platforms.'),\n  taskType: TaskType.retrievalDocument,\n);\nfinal small = truncateEmbedding(full, 256); \u002F\u002F 256 values, unit length\n```\n\nA truncated vector is another embedding space. In RAG, wrap the embedder so\nthe index gets the smaller dimension and its own profile id: an id without\nthe size would let 256-d and 768-d vectors share a location.\n`FlutterEdgeAiActiveEmbedder.forActiveModel` builds ids from file names only,\nso it cannot tell the sizes apart either.\n\n```text\nfinal class MatryoshkaEmbedder implements RagEmbedder {\n  MatryoshkaEmbedder(this.inner, {required this.dimension, required this.profileId});\n\n  final RagEmbedder inner;\n  final int dimension;\n  final String profileId; \u002F\u002F a new space: never the full-size id\n\n  @override\n  Future\u003CEmbeddingProfile> resolveProfile() async {\n    final full = await inner.resolveProfile();\n    if (dimension > full.dimension) {\n      throw ArgumentError.value(dimension, 'dimension', 'exceeds ${full.dimension}');\n    }\n    return EmbeddingProfile(id: profileId, dimension: dimension);\n  }\n\n  @override\n  Set\u003CEmbeddingModality> get modalities => const {EmbeddingModality.text};\n\n  @override\n  Future\u003CList\u003Cdouble>> embedDocument(EmbeddingInput document) async =>\n      truncateEmbedding(await inner.embedDocument(document), dimension);\n\n  @override\n  Future\u003CList\u003Cdouble>> embedQuery(\n    EmbeddingInput query, {\n    required EmbeddingModality documentModality,\n  }) async => truncateEmbedding(\n    await inner.embedQuery(query, documentModality: documentModality),\n    dimension,\n  );\n}\n\nfinal index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n  ),\n  embedder: MatryoshkaEmbedder(\n    FlutterEdgeAiActiveEmbedder(profileId: eg2ProfileId),\n    dimension: 256,\n    profileId: '$eg2ProfileId-mrl256',\n  ),\n);\n```\n\nOnly Matryoshka-trained models keep their quality this way. EmbeddingGemma 1,\nGecko, MiniLM and the GGUF EmbeddingGemma 2 were not measured here; do not\ntruncate a model without measuring it.\n\n### EmbeddingGemma 2 on a Qualcomm NPU (`flutter_edge_ai_litertlm` 1.13.1)\n\nThe same repos hold each bundle compiled for one SoC's NPU\n(`embeddinggemma-2-text-270m_Qualcomm_SM8850.litertlm`,\n`embeddinggemma-2-text-vision-440m_Qualcomm_QCS8275.litertlm`, …). It runs on\nQualcomm Android (arm64) and Qualcomm Linux arm64, in an app whose pubspec (the\nworkspace root's, for a workspace member) sets\n`hooks: user_defines: flutter_edge_ai_litertlm: qualcomm_npu: true` (the flag\nthe LLM NPU path uses), loaded with `preferredBackend: PreferredBackend.npu`:\n\n```dart\nconst eg2Revision = '9be6e8b90982095dc05c2bd162e4b954ee4dbac7';\n\u002F\u002F Its own id: NPU vectors are not the CPU bundle's. Shared by the SoC's 270m\n\u002F\u002F and 440m (byte-identical text towers).\nconst npuProfileId =\n    'embeddinggemma2-litertlm-text-4410a540ce75-prefix-v1-npu-sm8850';\n\nawait FlutterEdgeAi.installEmbedder()\n    .modelFromNetwork(\n      'https:\u002F\u002Fhuggingface.co\u002Flitert-community\u002F'\n      'embeddinggemma-2-text-270m-litert-lm\u002Fresolve\u002F$eg2Revision\u002F'\n      'embeddinggemma-2-text-270m_Qualcomm_SM8850.litertlm',\n    )\n    .install();\nfinal npu = await FlutterEdgeAi.getActiveEmbedder(\n  preferredBackend: PreferredBackend.npu,\n);\nassert(npu.activeBackend == PreferredBackend.npu);\n\nfinal rag = FlutterEdgeAiRag(providers: const [SqliteVectorStoreProvider()]);\nfinal npuIndex = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: p.join(\n      (await getApplicationDocumentsDirectory()).path,\n      'knowledge-embeddinggemma2-npu-sm8850.db',\n    ),\n  ),\n  \u002F\u002F The adapter loads the embedder per operation: pass npu here too.\n  embedder: FlutterEdgeAiActiveEmbedder(\n    profileId: npuProfileId,\n    preferredBackend: PreferredBackend.npu,\n  ),\n);\n```\n\n- Run on device: SM8850, SM8650 and QCS8275. Google also publishes SM8550,\n  SM8750 (accepted by the loader, not run by us), Intel PTL (Windows, below),\n  Tensor G5\u002FG6 (below; G6 run, G5 not) and MediaTek MT6991\u002FMT6993 (below).\n  Per build: https:\u002F\u002Fflutteredge.ai\u002Fdocs\u002Fregistry. What a bundle targets is\n  read from the bundle.\n- Its vectors are close to the CPU bundle's, not equal (SM8650: cosine\n  0.79–0.86 for a few words, 0.99 from about 200 words; images 0.86–0.88), so\n  never compare NPU vectors with CPU ones; within the NPU space retrieval\n  holds (text → image 10\u002F10).\n- Nothing falls back: a per-SoC bundle without `npu`, the generic bundle with\n  `npu`, `npu` on iOS\u002FmacOS\u002FLinux x64\u002FWeb, a Qualcomm bundle on Windows, a\n  Tensor or MediaTek bundle off Android, a build without the bundle vendor's flag\n  (`qualcomm_npu`, `google_tensor_npu`, `mediatek_npu`), a device without a\n  reachable NPU of\n  that vendor (for Tensor: not a Tensor Pixel on Android 16 or later, or a BP2A\n  build; for MediaTek: below Android 12, a SoC manufacturer other than\n  Mediatek or MTK, or no NeuroPilot adapter opens in the app), and a bundle the NPU cannot run (another SoC's or Tensor\n  generation's) each throw\n  `EmbeddingLoadException` with the fix. A loaded embedder is never reused for\n  the other backend.\n- Give an NPU index its own profile id (above); never open a CPU index with an\n  NPU embedder or the reverse. `FlutterEdgeAiActiveEmbedder.forActiveModel`\n  keys on the file name, so it separates them by itself.\n- **Intel Panther Lake (Windows x64, `flutter_edge_ai_litertlm` 1.13.2).** `…_Intel_PTL.litertlm` (270m, 440m, 740m) loads the\n  same way with `preferredBackend: PreferredBackend.npu`, with no opt-in flag:\n  every Windows x64 build carries the Intel stack (LiteRtDispatch.dll,\n  OpenVINO, TBB) beside the executable, and its absence is refused by name.\n  Profile id: the CPU text id plus `-npu-ptl`, shared by the 270m, the 440m and\n  the 740m.\n  An Intel bundle on Android or Linux is refused. The 270m was measured on a\n  Panther Lake PC (2026-10-21, OpenVINO 2026.4.1, the stack of\n  `flutter_edge_ai_litertlm` 1.17.0): 768-dimensional vectors, load about\n  0.9 s; the 440m is not measured. Each 270m load writes a 74.5 MB weight bank\n  to `%TEMP%` (the 440m's is not measured), deleted when the embedder closes.\n- **Google Tensor G5\u002FG6 (Android arm64, `flutter_edge_ai_litertlm` 1.15.0).**\n  `…_Google_Tensor_G5.litertlm` \u002F `…_Google_Tensor_G6.litertlm` (270m, 440m)\n  load the same way with `preferredBackend: PreferredBackend.npu`, in an app\n  whose pubspec (the workspace root's, for a workspace member) sets\n  `hooks: user_defines: flutter_edge_ai_litertlm: google_tensor_npu: true` (the\n  flag the LLM path uses), on\n  a Pixel with that Tensor generation and Android 16 or later, not a BP2A\n  build. Profile id: the CPU text id plus the SoC, e.g. `-npu-tensor_g6`,\n  shared by the 270m and the 440m. Run on a Pixel 11 (Tensor G6) with a debug\n  build; a Tensor G5 and a release-signed build are not run yet.\n- **MediaTek MT6991\u002FMT6993 (Android arm64, `flutter_edge_ai_litertlm` 1.17.0).**\n  `…_MediaTek_MT6991.litertlm` \u002F `…_MediaTek_MT6993.litertlm` are accepted the\n  same way with `preferredBackend: PreferredBackend.npu`, in an app whose pubspec\n  (the workspace root's, for a workspace member) sets\n  `hooks: user_defines: flutter_edge_ai_litertlm: mediatek_npu: true`, on a phone with that SoC, Android 12 or later, whose\n  vendor exposes NeuroPilot to apps. Profile id: the CPU text id plus the SoC,\n  e.g. `-npu-mt6991`. Not run on an MT6991\u002FMT6993 phone yet; the LLM path\n  runs on an MT6989.\n\n### EmbeddingGemma 2 images (440m; `flutter_edge_ai_litertlm` 1.13.1 native, 1.13.1 Web)\n\nThe 440m bundle adds a vision encoder to the same text tower, so one model\nembeds both and a text finds photos. Install it like the 270m (ungated):\n\n```dart\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst visionRevision = 'e301f74d5551b0c2641bd5cb4652a76239d5c5f8';\n\u002F\u002F The text id of the 270m section; image vectors also depend on the vision\n\u002F\u002F budget, so image indexes add it.\nconst photosProfileId =\n    'embeddinggemma2-litertlm-text-4410a540ce75-prefix-v1-vis140';\n\nawait FlutterEdgeAi.installEmbedder()\n    .modelFromNetwork(\n      'https:\u002F\u002Fhuggingface.co\u002Flitert-community\u002F'\n      'embeddinggemma-2-text-vision-440m-litert-lm\u002Fresolve\u002F$visionRevision\u002F'\n      'embeddinggemma-2-text-vision-440m.litertlm',\n      filename: 'embeddinggemma-2-text-vision-440m__rev-e301f74d5551.litertlm',\n    )\n    .install();\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal photos = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: p.join(\n      (await getApplicationDocumentsDirectory()).path,\n      'photos-embeddinggemma2-vis140.db',\n    ),\n    documents: EmbeddingModality.image,\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder(\n    profileId: photosProfileId,\n    supportImage: true,\n  ),\n);\nawait photos.add(\n  id: 'photo-1',\n  document: EmbeddingInput.image(bytes), \u002F\u002F upright, ≤ 1024 px: see below\n  content: path, \u002F\u002F a reference to the photo, never its bytes\n);\nfinal hits = await photos.search(query: EmbeddingInput.text('a red bicycle'));\n```\n\nPass upright, downscaled images. The engine decodes the file itself, ignores\nEXIF orientation — a portrait phone photo, stored sideways with an orientation\ntag, is embedded lying on its side (measured cos 0.89 against the upright\npicture) — and decodes at full size, which a 12 MP photo pays for. Decode with\nFlutter first: it applies the orientation and decodes straight to the target\nsize:\n\n```dart\nimport 'dart:math' as math;\nimport 'dart:ui' as ui;\n\nfinal codec = await ui.instantiateImageCodecWithSize(\n  await ui.ImmutableBuffer.fromUint8List(bytes), \u002F\u002F the photo as picked\n  getTargetSize: (w, h) => math.max(w, h) \u003C= 1024\n      ? const ui.TargetImageSize()\n      : w >= h\n      ? const ui.TargetImageSize(width: 1024)\n      : const ui.TargetImageSize(height: 1024),\n);\nfinal image = (await codec.getNextFrame()).image;\nfinal png = await image.toByteData(format: ui.ImageByteFormat.png);\nimage.dispose();\ncodec.dispose();\nfinal upright = EmbeddingInput.image(png!.buffer.asUint8List());\n```\n\nThis also converts what Flutter decodes and the engine does not (WebP; HEIC on\nAndroid). Keep the original for display; give the model the result. The same\ncode runs on Web (CanvasKit and skwasm decode through the browser), on the\npage itself: there are no isolates there.\n\n- Formats the engine decodes: JPEG, PNG, GIF and BMP. HEIC, WebP, TIFF and\n  AVIF throw `EmbeddingFormatNotSupportedException` (with `detected` and\n  `accepted`) before anything is sent — decode them as above. A corrupt or\n  truncated file of an accepted type reaches the model and fails with\n  `EmbeddingEngineException` (`nativeCode` 3 on native; on Web the message\n  carries the runtime's reason); the model keeps working.\n- Vision budget: 140 tokens per image by default (closest to the reference\n  model, min cos 0.985 on our test images);\n  `LiteRtEmbeddingBackend(visionTokensPerImage: 70)` — what the model card and\n  Google AI Edge Gallery use — is about twice as fast with slightly lower\n  fidelity (min cos 0.970); give its image indexes their own id (`…-vis70`). Any other value throws `EmbeddingLoadException`. Text vectors\n  do not depend on it. `forActiveModel` ids follow file names only, so an app\n  that changes the budget puts it in the namespace (`'photos-vis70'`).\n- On Web the vision encoder does not fit next to a loaded `.litertlm` LLM:\n  the page's `@litert-lm\u002Fcore` module has 4 GB of WebAssembly memory, and the\n  440m's vision engine (about 3.3 GB) and Gemma 4 E2B do not share it —\n  whichever loads second fails, the embedder with an `EmbeddingLoadException`\n  that says to close the LLM first. Text-only embedding loads next to the LLM.\n- Cost (CPU, measured): 388 MB on disk plus a 218 MB vision weight cache\n  written every time the model loads — also when it only embeds text. The\n  first image adds RAM: about 385 MB on an M4 Pro Mac, about 500 MB on a\n  Pixel 8. Per image at 140 tokens: about 0.35 s on an Apple-silicon Mac,\n  about 2 s on an Android flagship (Pixel 8 Pro 1.8 s, Pixel 8a 2.3 s), more\n  on mid-range phones and rising under sustained load as the phone heats up;\n  70 tokens takes about half. A 440m loaded for text alone still loads its\n  vision tower: apps that embed only text use the 270m. LiteRT-LM's thread\n  setting reaches the text tower only. Close the embedder after a large photo\n  ingest on low-RAM devices.\n- A text query over an image index is sent raw (`TaskType.none`): measured,\n  the retrieval-query prefix found the same photos with a smaller margin. Do\n  not set `queryTask` for it: that applies to text documents only.\n\n### EmbeddingGemma 2 audio and combined inputs (740m; `flutter_edge_ai_litertlm` 1.13.1 native, 1.13.2 Web)\n\nThe 740m bundle (`litert-community\u002Fembeddinggemma-2-740m-litert-lm`, revision\n`24d962e906c7d332c6428e71c9676855024569e2`, ungated, 485 MB) has the 440m's\ntext and vision towers — the same text and image vectors, so the same profile\nids — plus an audio encoder. On Web audio and combined inputs run on WebGPU\n(from 1.13.2) with the same formats, limits and errors.\n\n```dart\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal clips = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: path, \u002F\u002F its own location: one modality per location\n    documents: EmbeddingModality.audio,\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(\n    namespace: 'clips',\n    supportAudio: true,\n  ),\n);\nawait clips.add(\n  id: 'memo-1',\n  document: EmbeddingInput.audio(bytes), \u002F\u002F encoded WAV, MP3 or FLAC bytes\n  content: 'file:\u002F\u002F\u002Fmemos\u002F1.wav',\n);\nfinal hits = await clips.search(\n  query: EmbeddingInput.text('turn off the kitchen lights'),\n);\n\n\u002F\u002F Several parts in one vector (flutter_edge_ai 2.3.1), outside an index:\nfinal embedder = await FlutterEdgeAi.getActiveEmbedder(\n  supportImage: true,\n  supportAudio: true,\n);\nfinal vector = await embedder.embed(\n  EmbeddingInput(text: 'kitchen', audio: bytes),\n  taskType: TaskType.retrievalDocument,\n);\n```\n\n- Formats: WAV, MP3 and FLAC, any rate and channel count (the engine mixes\n  down to mono and resamples to 16 kHz). Ogg and M4A throw\n  `EmbeddingFormatNotSupportedException` before anything is sent; a corrupt\n  file of an accepted type throws `EmbeddingEngineException` (`nativeCode` 2\n  on native; on Web the runtime's message) and the model keeps working. One\n  clip per vector.\n- Length: about 25 tokens per second, so up to about 40 seconds fit the\n  1024-token cap; a 60-second clip throws `EmbeddingInputTooLongException`\n  with `actualTokens` 1504. Split long recordings.\n- `EmbeddingInput(text:, images:, audio:)` puts the text (with its task\n  prefix), then the images in order, then the audio into one vector, whatever\n  order the arguments are written in. Declare every medium it carries. Any\n  input with more than one part — several modalities, or several images — is\n  a combined input: an engine that embeds one part per vector (every other one\n  here, and EmbeddingGemma 2 on Web before `flutter_edge_ai_litertlm` 1.13.2)\n  refuses it with\n  `UnsupportedEmbeddingCombinationException` before anything is sent.\n- An audio index keeps the text profile id: audio vectors do not depend on the\n  vision budget, and the store's `documents` modality keeps it apart from a\n  text store. A text query over it is sent raw (`TaskType.none`).\n- Audio vectors are not bit-portable: the audio encoder quantizes activations\n  to 8 bits, so another CPU kernel can move a clip's vector by up to cos 0.05\n  (text and image vectors do not move that way); Web (WebGPU) audio vectors\n  are within cos 0.97 of the native ones. Retrieval holds: every test\n  sentence was found by its text query on every build measured, Web included.\n- Cost (CPU, M4 Pro Mac): 385 MB of weight caches written at every load (text\n  71 MB, vision 218 MB, audio 95 MB), also for text-only use; about 0.2–0.3 s\n  per 3-second clip. On Web (WebGPU, Tesla T4) about 0.3 s per clip after a\n  first one of about 4 s, and no weight cache. Use the 270m for text, the 440m\n  for text and images.\n\n## Index and search\n\n```dart\nimport 'dart:convert';\n\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst databaseName = 'knowledge-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n    filterSchema: FilterSchema(fields: [\n      FilterField(name: 'lang', type: FilterFieldType.string),\n      FilterField(name: 'year', type: FilterFieldType.number),\n    ]),\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(namespace: 'knowledge'),\n);\nawait index.add(\n  id: 'doc-1',\n  document: EmbeddingInput.text(chunk),\n  metadata: jsonEncode({'lang': 'en', 'year': 2024}),\n);\n\nfinal hits = await index.search(\n  query: EmbeddingInput.text(question),\n  topK: 5,\n  threshold: 0.3,\n  filter: Filter(\n    must: [FieldEquals(key: 'lang', value: 'en')],\n    mustNot: [FieldRange(key: 'year', lte: 2010)],\n  ),\n);\n\nawait index.flush();\n```\n\n`add` embeds with the embedder's document role and stores the chunk as the\nhit's `content` (pass `content:` to store something else); `search` uses the\nquery role. For precomputed batches, embed with `TaskType.retrievalDocument`,\nthen use `addVector`; use `searchVector` for precomputed queries. `remove`,\n`stats`, `clear`, and `flush` operate on the owned index. Flush after a write\nbatch: it is required for qdrant durability, a Web SQLite durability fence,\nand a no-op on native SQLite. Every field a `Filter` names must be declared in\n`filterSchema`; an undeclared one throws `ArgumentError`.\n\nChunk text below the embedder's input limit,\n`(await FlutterEdgeAi.getActiveEmbedder()).maxInputTokens` — 256 tokens for the\nEmbeddingGemma seq256 file above, task prefix, BOS and EOS included. A longer\nchunk or query is never truncated: `add` and `search` throw\n`EmbeddingInputTooLongException`, whose `maxInputTokens` and `actualTokens`\nsay by how much. A null `maxInputTokens` means the loaded pass cannot establish\nan effective limit, not that input is unlimited.\n\n## Image and audio documents\n\nA location holds documents of one modality. An image index needs an embedder\nthat embeds images (`RagEmbedder.modalities`); `open()` refuses one that does\nnot with `ArgumentError`. `content` is required and is a reference to the\nmedia — a URI, file path or asset id — never its bytes; search results return\nit. A text query over an image index is text-to-image search:\n\n```dart\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal photos = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: path, \u002F\u002F its own location: one modality per location\n    documents: EmbeddingModality.image,\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(\n    namespace: 'photos',\n    supportImage: true,\n  ),\n);\nawait photos.add(\n  id: 'photo-1',\n  document: EmbeddingInput.image(bytes), \u002F\u002F encoded JPEG\u002FPNG bytes\n  content: 'content:\u002F\u002Fmedia\u002Fexternal\u002Fimages\u002F1',\n);\nfinal matches = await photos.search(query: EmbeddingInput.text('a red bicycle'));\n```\n\nThe active embedder embeds images with the EmbeddingGemma 2 440m or 740m\nbundle (above; on Web from `flutter_edge_ai_litertlm` 1.13.1). With any other\nmodel — the 270m, EmbeddingGemma 1, Gecko, ONNX, a GGUF —\n`getActiveEmbedder(supportImage: true)`, and therefore `open()` of an image\nindex with the active embedder, fails with `EmbeddingLoadException`. A\ncustom `RagEmbedder` can embed media with any model. A text index and an image\nindex can share one installed model: each adapter declares what it needs, and\ncore reloads the embedder once with both.\n\nCross-modal scores are not on one scale, so mixed corpora use one index per\nmodality and the app merges results. Text locations open in both directions\nbetween this release and flutter_edge_ai_rag 1.0 with the 2.0.x stores. On an\nimage or audio location those older releases refuse every open that names a\nprofile, legacy adoption, every text operation and a rebind.\n\n## Vector-only and custom embedders\n\nRAG can run without `FlutterEdgeAi.initialize()`.\n\nFor vector-only use, open with the profile of the pipeline that produced the\nvectors and call only vector APIs:\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst databaseName = 'vectors-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal index = await rag.openVectors(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n  ),\n  profile: EmbeddingProfile(\n    id: 'my-precomputed-embedding-pipeline-v1',\n    dimension: 768,\n  ),\n);\nfinal vector = List\u003Cdouble>.filled(768, 0);\nfinal queryVector = List\u003Cdouble>.filled(768, 0);\nawait index.addVector(id: 'doc-1', content: chunk, embedding: vector);\nfinal hits = await index.searchVector(embedding: queryVector);\n```\n\nFor independent RAG, implement `RagEmbedder`. It maps the document and query\nroles to its model's conventions. `EmbeddingProfile` has no `const`\nconstructor — it validates its arguments:\n\n```text\nclass AppEmbedder implements RagEmbedder {\n  AppEmbedder(this.model);\n  final MyEmbeddingModel model;\n\n  @override\n  Future\u003CEmbeddingProfile> resolveProfile() async => EmbeddingProfile(\n    id: 'my-model-tokenizer-pooling-prefix-v1',\n    dimension: 384,\n  );\n\n  @override\n  Set\u003CEmbeddingModality> get modalities => const {EmbeddingModality.text};\n\n  @override\n  Future\u003CList\u003Cdouble>> embedDocument(EmbeddingInput document) =>\n      model.embed('document: ${document.text}');\n\n  @override\n  Future\u003CList\u003Cdouble>> embedQuery(\n    EmbeddingInput query, {\n    required EmbeddingModality documentModality,\n  }) => model.embed('query: ${query.text}');\n}\n\nfinal index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: customDatabasePath, \u002F\u002F absolute path on native, a name on Web\n  ),\n  embedder: AppEmbedder(model),\n);\n```\n\nDifferent indexes may use different embedders. Never mix their vectors in one\nlocation, even when dimensions match.\n\n## qdrant-edge storage (native only)\n\n```dart\nimport 'package:flutter_edge_ai_qdrant\u002Fflutter_edge_ai_qdrant.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [QdrantVectorStoreProvider()],\n);\n\u002F\u002F A directory, not a file — qdrant creates its shard files inside it.\nfinal storeDirectory = p.join(\n  (await getApplicationDocumentsDirectory()).path,\n  'knowledge-qdrant-v1',\n);\ntry {\n  final index = await rag.open(\n    spec: VectorStoreSpec(providerId: 'qdrant', location: storeDirectory),\n    embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(namespace: 'knowledge'),\n  );\n} on QdrantLegacyStoreException catch (e) {\n  \u002F\u002F Written by flutter_gemma_rag_qdrant 1.2 or earlier: not readable.\n  \u002F\u002F e.message names the files to delete; delete them, then re-index.\n  print(e.message);\n}\n```\n\n`QdrantVectorStoreProvider` has no static providerId constant: pass the string\n`'qdrant'`. Keep the directory apart from any SQLite database. A store written\nby `flutter_gemma_rag_qdrant` 1.2 or earlier makes `open()` throw\n`QdrantLegacyStoreException`: its format cannot be read or adopted, so delete\nthe files its message names and re-index. Catch that type, not the base\n`VectorStoreException` — the base type also covers a shard that is only locked\nby another open store. The legacy-adoption path below applies to profile-less\nqdrant stores written by 1.3.x.\n\n## Existing stores and lifecycle\n\nA nonempty 1.x store has no profile metadata. Prefer a new profile-versioned\nlocation and re-index. Only when the exact old embedding pipeline is known may\nthe app open it with that profile and `allowLegacyProfileAdoption: true`. That\nflag is a `VectorStoreSpec` field, not an `open()` argument, applies to text\nlocations only, and the provider also checks vector dimension:\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst oldDatabaseName = 'rag.db'; \u002F\u002F the location the 1.x app already used\nfinal databasePath = kIsWeb\n    ? oldDatabaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, oldDatabaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal index = await rag.openVectors(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n    allowLegacyProfileAdoption: true,\n  ),\n  profile: EmbeddingProfile(\n    id: 'the-verified-old-embedding-pipeline-v1',\n    dimension: 768,\n  ),\n);\n```\n\nStores written by flutter_edge_ai_rag 1.0 (`flutter_edge_ai_sqlite` \u002F\n`flutter_edge_ai_qdrant` 2.0.x) open unchanged as text locations.\n\nMake open\u002Fdispose app-owned and idempotent:\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst databaseName = 'knowledge-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nFuture\u003CRagIndex>? opening;\nFuture\u003Cvoid>? disposing;\n\nopening ??= rag.openVectors(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n  ),\n  profile: EmbeddingProfile(id: 'embedding-pipeline-v1', dimension: 768),\n);\ndisposing ??= () async {\n  final pending = opening;\n  if (pending != null) await (await pending).dispose();\n}();\nawait disposing;\n```\n\nDo not create an index in each widget or reopen the same Web location while a\nprevious index is live. Shutdown order is:\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst databaseName = 'knowledge-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal index = await rag.openVectors(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n  ),\n  profile: EmbeddingProfile(id: 'embedding-pipeline-v1', dimension: 768),\n);\nawait index.dispose();\nawait FlutterEdgeAi.dispose(); \u002F\u002F resets core's registries; closes no model\n```\n\n## Moving from flutter_edge_ai_rag 1.0 to 1.1\n\n| rag 1.0 | rag 1.1 |\n| --- | --- |\n| `open(spec:, activeEmbedderProfileId: id)` | `open(spec:, embedder: FlutterEdgeAiActiveEmbedder(profileId: id))`, or `.forActiveModel(namespace:)` |\n| `open(spec:, embeddingProfile: p)` (vectors only) | `openVectors(spec:, profile: p)` |\n| `open()` bound the profile on the first text operation | `open()` resolves the profile and binds the location at once; install the embedder first |\n| `index.addText(id:, content: c)` | `index.add(id:, document: EmbeddingInput.text(c))` |\n| `index.searchText(query: q)` | `index.search(query: EmbeddingInput.text(q))` |\n| `index.embeddingProfile` could be null | never null; `index.documents` names the modality |\n| `RagEmbedder` with a `profile` getter, `embedDocument(String)`, `embedQuery(String)` | `resolveProfile()`, `modalities`, `embedDocument(EmbeddingInput)`, `embedQuery(EmbeddingInput, documentModality:)` |\n| a filter on an undeclared field was ignored | `ArgumentError` |\n| `VectorStoreRepository` (`implements`), `readEmbeddingProfile`\u002F`bindEmbeddingProfile` | `abstract base class` (`extends`), `readBinding()`\u002F`bind(VectorStoreBinding)` |\n\nUpgrade every flutter_edge_ai package together: the stores of this release\nneed flutter_edge_ai_rag 1.1.\n\n## Moving from 1.x core RAG to 2.0\n\nIn flutter_edge_ai 2.0 RAG left core: the `FlutterEdgeAi.rag.…` calls and the\n`vectorStore:` and `filterSchema:` parameters of `FlutterEdgeAi.initialize()`\nare gone. Add `flutter_edge_ai_rag` and a storage package, remove those two\nparameters, and open a `RagIndex`:\n\n| 1.x (`FlutterEdgeAi.rag.…`) | `RagIndex` |\n| --- | --- |\n| `initialize(vectorStore: ...)` on core | `FlutterEdgeAiRag(providers: [...])` |\n| `rag.initialize(location)` | `rag.open(spec: VectorStoreSpec(...), embedder: ...)` |\n| `addDocument(...)` | `add(id:, document: EmbeddingInput.text(...))` |\n| `addDocumentWithEmbedding(...)` | `addVector(...)` |\n| `searchSimilar(query: ...)` | `search(query: EmbeddingInput.text(...))` |\n| `removeDocument(id: ...)` | `remove(id: ...)` |\n| `stats()` \u002F `flush()` \u002F `clear()` | the same methods on the index |\n\n`No vector-store provider can handle providerId \"…\"` means the provider for\nthat ID was not passed to `FlutterEdgeAiRag(providers: ...)`, or cannot run on\nthis platform (qdrant on Web). A nonempty store written by 1.x is usable only\nthrough the legacy-adoption path above, or after re-indexing into a new\nlocation.\n\n## Web assets and common failures\n\n- Copy `web\u002Frag\u002Fsqlite3.wasm` from `flutter_edge_ai_sqlite` to the same path in\n  the app. Copy the four matching LiteRT embedding files from\n  `flutter_edge_ai_litertlm\u002Fweb\u002F` when that runtime is used, and copy them\n  again after upgrading it: a stale `litert_embeddings.js` fails\n  `getActiveEmbedder()` with an `EmbeddingLoadException` that names the file.\n  EmbeddingGemma 2 (`.litertlm`) needs none of those files, only\n  `window.EmbeddingEngine = m.EmbeddingEngine;` in the `@litert-lm\u002Fcore`\n  module script of `web\u002Findex.html`, and a browser with WebGPU.\n- `EmbeddingLoadException` starting \"EmbeddingGemma 2 on the web needs\n  WebGPU\": the browser has no `navigator.gpu` or no GPU adapter. There is no\n  CPU path for these bundles on Web; use a browser with WebGPU enabled.\n- `ArgumentError` naming an undeclared filter field: add it to `filterSchema`.\n  SQLite names must match `^[A-Za-z][A-Za-z0-9_]*$` and avoid reserved columns.\n- `StateError: Vector store \"…\" is bound to …, not …`: the location belongs to\n  another profile or document modality — model or preprocessing bytes\n  changed, a different model is installed, or the wrong location was opened.\n  Do not bypass it; choose the correct profile\u002Flocation.\n- Vector-only indexes need `openVectors(profile:)`: raw numbers cannot\n  identify their embedding space.\n- `EmbeddingInputTooLongException` from `add` or `search`: the text is longer\n  than the embedder's `maxInputTokens`. Split it into smaller chunks; older\n  releases truncated it silently. With EmbeddingGemma 2 its `actualTokens` is\n  the exact count (natively from `flutter_edge_ai_litertlm` 1.13.1).\n- `EmbeddingLoadException` from `open()` of an image index: the installed\n  model has no vision encoder — \"has no vision encoder; install\n  embeddinggemma-2-text-vision-440m\" on the 270m — or is not an EmbeddingGemma\n  2 bundle. From an audio index: \"has no audio encoder; install\n  embeddinggemma-2-740m\" on the 270m and the 440m, natively and on Web.\n- `EmbeddingFormatNotSupportedException` from `add` or `search` on an image\n  index: HEIC, WebP, TIFF or AVIF; convert to JPEG or PNG.\n- `VectorStoreException` \"… is not a valid embedding profile\" on open: the\n  location was bound by flutter_edge_ai_rag 1.0 to an id with a control\n  character, which 1.1 refuses; this version cannot open it.\n- `StateError` mentioning that the active embedding model changed: an adapter\n  is pinned to the model active when it was created. After switching\n  embedders, create a new embedder and open a new index at a new location.\n","# On-device RAG with Flutter Edge AI\n\n## Non-negotiable architecture\n\n1. RAG is not initialized by `FlutterEdgeAi.initialize()`. Use the independent\n   `flutter_edge_ai_rag` package and an app-owned `FlutterEdgeAiRag` instance.\n2. Storage packages are providers: `flutter_edge_ai_sqlite` registers\n   `SqliteVectorStoreProvider`; `flutter_edge_ai_qdrant` registers\n   `QdrantVectorStoreProvider`. Application code uses `RagIndex`.\n3. One persistent location belongs to one stable `EmbeddingProfile` and one\n   document modality (`VectorStoreSpec.documents`: text, image or audio). The\n   profile id versions weights, tokenizer, pooling, normalization, and\n   document\u002Fquery prefixes; a mutable URL or file path is not an identity.\n   Profile ids may not contain control characters.\n4. Keep one live `RagIndex` per location, make opening single-flight, and share\n   it across widgets. Web SQLite enforces this with an exclusive Web Lock.\n5. Dispose indexes before `FlutterEdgeAi.dispose()` or before disposing a\n   custom embedder. An index owns its vector store but only borrows its embedder.\n6. Declare every filter field in `VectorStoreSpec.filterSchema` before the\n   SQLite index is created. Changing SQLite's physical `vec0` schema requires a\n   new schema-versioned location and re-index.\n7. `location` is an absolute path on native — a database file for SQLite, a\n   directory for Qdrant; build it from `getApplicationDocumentsDirectory()` —\n   and a plain name on Web.\n\n## Packages\n\n```sh\nflutter pub add flutter_edge_ai flutter_edge_ai_rag flutter_edge_ai_sqlite path path_provider\n```\n\nFor the default core embedder also add its runtime\u002Ftokenizer packages, usually\n`flutter_edge_ai_litertlm` and `flutter_edge_ai_embeddings`. Replace SQLite\nwith `flutter_edge_ai_qdrant` for qdrant-edge on native platforms. SQLite runs\non Android, iOS, Web, macOS, Windows, and Linux; qdrant-edge has no Web arm.\n\n`flutter_edge_ai_sqlite` needs Flutter 3.47 or newer. On older Flutter use\n`flutter_edge_ai_qdrant` (native only) or upgrade Flutter.\n\n`flutter_edge_ai_rag` re-exports `EmbeddingInput`, `EmbeddingModality`,\n`TaskType` and the `EmbeddingException` family, so RAG code needs no core\nimport for them.\n\n## Default active embedder\n\nInitialize only embedding runtime pieces in core and install the embedder\nbefore opening an index: `open()` resolves the embedder's profile, which loads\nthe model. Pin model downloads to an immutable revision.\n\n`FlutterEdgeAiActiveEmbedder.forActiveModel(namespace:)` derives the profile id\nfrom the installed file names (`'\u003Cnamespace>@\u003Cfiles joined by +>'`, with `%`,\n`@` and `+` inside a name percent-encoded), so\ninstalling a model under different file names changes the id and the old\nlocation refuses to open instead of mixing two embedding spaces. EmbeddingGemma\n1 and 2 are both 768-dimensional: the id is the only thing that tells them\napart. The id follows file NAMES, not bytes: install the registry build, as\nbelow — its file names carry the revision — so new weights under the same\ndownload name get a new id too. An app that installed under other names keeps\nthem: its id follows those.\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\nimport 'package:flutter_edge_ai_embeddings\u002Fflutter_edge_ai_embeddings.dart';\nimport 'package:flutter_edge_ai_litertlm\u002Fflutter_edge_ai_litertlm.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\n\u002F\u002F EmbeddingGemma is gated: build with --dart-define=HUGGINGFACE_TOKEN=hf_...\nconst hfToken = String.fromEnvironment('HUGGINGFACE_TOKEN');\n\nawait FlutterEdgeAi.initialize(\n  embeddingBackends: const [LiteRtEmbeddingBackend()],\n  embeddingTokenizers: const [GemmaEmbeddingTokenizers()],\n  huggingFaceToken: hfToken.isEmpty ? null : hfToken,\n);\n\u002F\u002F The registry build: commit 29888fce, revision-qualified file names.\nawait FlutterEdgeAi.installEmbedder().fromCatalog(LiteRtEmbedders.embeddinggemma300m.seq256)\n    .install();\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\n\u002F\u002F Native: an absolute path to the database file. Web: a plain name.\nconst databaseName = 'knowledge-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n    filterSchema: FilterSchema(fields: [\n      FilterField(name: 'lang', type: FilterFieldType.string),\n      FilterField(name: 'year', type: FilterFieldType.number),\n    ]),\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(namespace: 'knowledge'),\n);\n```\n\nThe EmbeddingGemma repo is gated: the Hugging Face account behind the token\nmust accept the Gemma license on the model page, or the download is refused.\nKeep the token out of source — it is compiled into the app, so a shipped app\nshould download from a repo that needs none.\n\nAn explicit id is the alternative when one store must outlive a file rename,\nor serve several bundles known to produce identical vectors. Name everything\nthat shapes the vectors:\n\n```dart\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\n\nfinal embedder = FlutterEdgeAiActiveEmbedder(\n  profileId:\n      'embeddinggemma-300m-seq256-mp-rev-29888fcee321-'\n      'retrieval-prefix-meanpool-l2-v1',\n);\n```\n\nThe adapter pins the embedding model that is active when it is created and\nresolves the model again on every operation, so it follows core's embedder\ncache. After switching embedders it throws `StateError`: create a new embedder\nand open a new index at a new location. A request that failed because core\nreplaced the model before it ran (`EmbedderClosedException`) is retried once.\nQueries over text documents use `TaskType.retrievalQuery`; pass `queryTask:`\nfor another task, e.g. `TaskType.questionAnswering`.\n\n## GGUF embeddings (`flutter_edge_ai_llama` 0.0.3+)\n\n`LlamaEmbeddingBackend` in `flutter_edge_ai_llama` 0.0.3 (core 2.5.0, llamadart\n0.15.1) runs EmbeddingGemma 2 GGUF text embeddings natively. 0.0.6 moves to\nllamadart 0.17.5: measured there on macOS CPU\u002FMetal (#764); Linux\u002FWindows CPU were\nmeasured on 0.15.1 only; Android (CPU only) and iOS are not qualified, and only\nthe Q8_0 file below is numerically qualified. An explicit GPU request on\nAndroid, iOS simulators and, from 0.0.6, macOS x64 loads on the CPU, or fails\nwith `backendFallback: false`. A `.gguf` carries its own\ntokenizer: a `tokenizerFrom…()` makes `install()` throw `ArgumentError`.\n\nApp setup (that package's README, *Add it to your app*, and `doc\u002Fplatforms.md`):\n`hooks: user_defines: llamadart: llamadart_native_runtimes: [llama_cpp]` in the\napp's pubspec, or the workspace root's; on iOS\u002FmacOS also\n`llamadart_llama_cpp_flutter: 0.17.3` (0.15.0 before 0.0.6) in the app's own dependencies,\n`flutter config --enable-swift-package-manager`, and iOS 16.4 \u002F macOS 14\ndeployment targets; on Android arm64-v8a and x86_64 only. From\n`flutter_edge_ai_litertlm` 1.19.0 LiteRT-LM keeps Swift Package Manager on too,\nand both native libraries load in one macOS app; running both engines' models\nin one app is not qualified.\n\n```dart\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\nimport 'package:flutter_edge_ai_llama\u002Fflutter_edge_ai_llama.dart';\n\nawait FlutterEdgeAi.initialize(\n  embeddingBackends: const [LlamaEmbeddingBackend()],\n);\nawait FlutterEdgeAi.installEmbedder()\n    .modelFromNetwork(\n      'https:\u002F\u002Fhuggingface.co\u002Fggml-org\u002Fembeddinggemma-2-GGUF\u002Fresolve\u002F'\n      'bfcd298762cc34d0357ece5ebdd31791a3a374d8\u002Fembeddinggemma-2-Q8_0.gguf',\n    ) \u002F\u002F no tokenizer\n    .install();\nfinal embedder = await FlutterEdgeAi.getActiveEmbedder();\n```\n\n- Text only: `supportImage`, `supportAudio` and `PreferredBackend.npu` throw\n  `EmbeddingLoadException`. On Android (every device), iOS simulators and, from\n  0.0.6, macOS x64\u002FRosetta an explicit `gpu` falls back to CPU with a warning, or throws with\n  `LlamaEmbeddingBackend(backendFallback: false)`; `activeBackend` reports what\n  loaded.\n- Only a mean-pooled `gemma-embedding2` GGUF loads; any other architecture or\n  pooling throws `EmbeddingLoadException`.\n- `maxInputTokens` is 1024, task prefix and special tokens included. A longer\n  input throws `EmbeddingInputTooLongException` and is never truncated.\n- A URL that does not end in `.gguf` needs\n  `modelFromNetwork(url, filename: '\u003Cname>.gguf')`; without it `install()`\n  throws `StateError` asking for a tokenizer.\n- On Web it claims no file: with it the only backend registered, installing a\n  `.gguf` throws `UnsupportedError` before anything is downloaded.\n- Keep GGUF and LiteRT under separate profile ids, even at 768 dimensions.\n  `FlutterEdgeAiActiveEmbedder.forActiveModel(namespace:)` does it by itself,\n  because the file names differ; with an explicit `profileId`, name the format\n  and quantization (e.g. `embeddinggemma2-gguf-q8_0`). A store bound to the\n  LiteRT id refuses to open with the GGUF embedder.\n\n## Custom embedding providers (core 2.5.0)\n\nEngine authors import the SPI:\n\n```dart\nimport 'package:flutter_edge_ai\u002Fengine.dart';\n```\n\nCore accepts self-contained `.gguf` embedding files without a separate\ntokenizer (the app recipe is the GGUF embeddings section above). When backends are registered, installation requires one that can run\nthe file; with none registered, installation can proceed.\n`flutter_edge_ai_embeddings` contains tokenizer implementations only; runtime\npasses belong to their engine packages.\n\nProviders declare explicit accelerator capabilities with `honouredBackends(spec)`;\ncore computes the cache key. Automatic requests reuse only a non-NPU embedder\nfor the same installed model, while NPU requests always retain a separate key.\nRepeated explicit CPU\u002FGPU requests reuse their originating fallback until a\nrebuild is needed or the model is closed.\nGPU-capable providers must report their actual loaded accelerator through\n`EmbeddingPassInfo.activeBackend`; legacy fixed descriptors remain compatible.\nReporting providers print one release-visible WARNING per new fallback load,\nincluding an NPU request; reuse does not repeat it.\n`EmbeddingModel.maxInputTokens` is the effective loaded context\u002Fsingle-pass batch\ncapacity, including task prefixes and special tokens. A GGUF profile configured\nwith a 1024-token micro-batch cannot embed a longer chunk even if the file names\na larger context. Core hosts, caches and closes the pass.\n\n## EmbeddingGemma 2 (one `.litertlm` file)\n\nEmbeddingGemma 2 ships as one `.litertlm` bundle that carries its own\ntokenizer: install the model alone — no `tokenizerFrom…()` call, and no\n`flutter_edge_ai_embeddings` or `embeddingTokenizers:` needed. The repo is not\ngated:\n\n```dart\nconst eg2Revision = '9be6e8b90982095dc05c2bd162e4b954ee4dbac7';\n\u002F\u002F One id for the 270m, 440m and 740m bundles: their text towers are identical.\nconst eg2ProfileId = 'embeddinggemma2-litertlm-text-4410a540ce75-prefix-v1';\n\nawait FlutterEdgeAi.initialize(\n  embeddingBackends: const [LiteRtEmbeddingBackend()],\n);\nawait FlutterEdgeAi.installEmbedder()\n    .modelFromNetwork(\n      'https:\u002F\u002Fhuggingface.co\u002Flitert-community\u002F'\n      'embeddinggemma-2-text-270m-litert-lm\u002Fresolve\u002F$eg2Revision\u002F'\n      'embeddinggemma-2-text-270m.litertlm',\n    )\n    .install();\nfinal embedder = await FlutterEdgeAi.getActiveEmbedder();\nfinal limit = embedder.maxInputTokens; \u002F\u002F 1024\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal eg2Index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: p.join(\n      (await getApplicationDocumentsDirectory()).path,\n      'knowledge-embeddinggemma2-text-v1.db',\n    ),\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder(profileId: eg2ProfileId),\n);\n```\n\n- Android, iOS, macOS, Linux, Windows (`flutter_edge_ai_litertlm` 1.13.0 for\n  text, 1.13.1 for images and audio), and Web on WebGPU through\n  `@litert-lm\u002Fcore`'s EmbeddingEngine (1.13.1 for text and images, 1.13.2 for\n  audio and combined inputs). The Web page needs\n  `window.EmbeddingEngine = m.EmbeddingEngine;` next to `window.Engine =\n  m.Engine;` in its `@litert-lm\u002Fcore` module script; without it the load fails\n  with an `EmbeddingLoadException` naming that line. The browser needs WebGPU:\n  the CPU (WebAssembly) path of `@litert-lm\u002Fcore` 0.18.0 cannot read these\n  bundles' external weights, so there is no CPU fallback, and a browser\n  without WebGPU (no `navigator.gpu`, or no adapter) fails the load with an\n  `EmbeddingLoadException` that says so.\n- The 270m is text only: `getActiveEmbedder(supportImage: true)` throws\n  `EmbeddingLoadException` naming the 440m bundle — natively before any engine\n  or cache is made (below); on Web only after the bundle was read, when the\n  runtime refuses to create the engine. `supportAudio: true` needs the 740m\n  bundle (below): on the 270m and the 440m it throws `EmbeddingLoadException`\n  naming the 740m, read from the bundle's container header before any engine\n  exists — on Web too.\n- `maxInputTokens` is 1024 — task prefix, BOS and EOS included. Keep chunks at\n  512 tokens or fewer: memory grows with the input length. A longer text throws\n  `EmbeddingInputTooLongException` with the exact `actualTokens` (natively\n  from `flutter_edge_ai_litertlm` 1.13.1, from a truncated run; on Web read\n  after the engine ran the whole input in 1024-token windows). Either way an\n  over-long chunk still costs a full embedding before it is refused: split\n  before embedding.\n- It runs on CPU natively (`activeBackend` is `PreferredBackend.cpu`) and on\n  WebGPU on Web (`PreferredBackend.gpu`), and refuses `PreferredBackend.npu`:\n  the NPU runs the per-SoC bundles (next section). Native GPU support is\n  enabled in code (`native_hosts.dart`) per host and bundle: Linux x64 for the\n  270m, 440m and 740m; Windows x64 for the 270m; macOS arm64 for the 270m and\n  740m. Other bundle combinations on those GPU hosts throw\n  `EmbeddingLoadException` as unmeasured. The Linux rows were measured on an\n  NVIDIA L4, 2026-10-26 ([PR #714](https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fpull\u002F714));\n  the Windows 270m passed on Panther Lake Arc B390 and Lunar Lake Arc 140V,\n  2026-11-04\n  ([0.19 paid-run report](https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fdoc\u002Fresearch\u002Flitertlm-0.19-l1-paid-runs.md));\n  the macOS rows were measured on an M5 Pro, 2026-11-04, at 24 ms\n  ([0.19 phase-1 report](https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fdoc\u002Fresearch\u002Flitertlm-0.19-phase1.md)).\n  Only the text tower runs on GPU; 440m\u002F740m vision and audio towers run on CPU\n  beside it. On iOS, Android and Linux arm64, `gpu` is not applied and the\n  embedder runs on CPU with core's notice. Web vectors therefore\n  differ slightly from native ones — measured min cos about 0.995 for text and\n  0.998 for images against the native CPU vectors — and retrieval across\n  platforms holds: web queries find natively embedded images and native\n  queries find web-embedded images, top-1 10\u002F10 on the example's ten scenes.\n  Natively it keeps a weight cache of about 71 MB, on top of the 165 MB\n  bundle, in the app's cache directory: never backed up, and rebuilt at the\n  next load if the OS clears it. A load whose cache file cannot be created (a\n  path past Windows MAX_PATH, a directory the app cannot write to, possibly no\n  free space at all) still runs, slower and larger, with a printed warning;\n  `LiteRtEmbeddingBackend(requireWeightCache: true)`\n  (`flutter_edge_ai_litertlm` 1.14.0) refuses it with `EmbeddingLoadException`\n  instead — on CPU, and on the NPU with declared audio. A disk that fills\n  while the cache is being written aborts the process in native code\n  (XNNPack); no flag catches that. Web keeps no weight cache and ignores the\n  flag, and so does a `.tflite` embedder (EmbeddingGemma 1, Gecko); each says\n  so once, in a debug-build log line.\n- EmbeddingGemma 1, 2 and Gecko all produce 768-d vectors but are different\n  spaces: give each its own location and profile ID — the dimension check alone\n  cannot tell them apart. `FlutterEdgeAiActiveEmbedder.forActiveModel` already\n  gives them different ids (different file names); the explicit id above is for\n  one text store shared by the three EmbeddingGemma 2 bundles.\n\n### EmbeddingGemma 2 at 128, 256 or 512 dimensions (Matryoshka)\n\nEmbeddingGemma 2 is trained with Matryoshka representation learning: the first\n128, 256 or 512 values of its 768-d text vector, L2-normalized again, are an\nembedding of their own. There is no API for it, and none is needed: take the\nfirst N values of the vector the embedder returns and normalize them.\nMeasured 2026-10-22 on the 270m bundle (CPU, the ten golden texts): this is\nthe same vector LiteRT-LM's own `output_size` option returns (cos 1.000000 at\n128, 256 and 512), each query still ranks its document first (5\u002F5), and the\nminimum cosine to Sentence Transformers fp32 cut to the same size is 0.976\n(512) to 0.986 (128), against 0.977 at the full 768.\nImages and audio were not measured; keep truncation to text.\n\n```dart\nimport 'dart:math' as math;\n\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\n\nList\u003Cdouble> truncateEmbedding(List\u003Cdouble> vector, int dimension) {\n  final head = vector.sublist(0, dimension);\n  final norm = math.sqrt(head.fold(0.0, (sum, x) => sum + x * x));\n  return [for (final x in head) x \u002F norm];\n}\n\nfinal embedder = await FlutterEdgeAi.getActiveEmbedder();\nfinal full = await embedder.embed(\n  EmbeddingInput.text('Flutter runs on six platforms.'),\n  taskType: TaskType.retrievalDocument,\n);\nfinal small = truncateEmbedding(full, 256); \u002F\u002F 256 values, unit length\n```\n\nA truncated vector is another embedding space. In RAG, wrap the embedder so\nthe index gets the smaller dimension and its own profile id: an id without\nthe size would let 256-d and 768-d vectors share a location.\n`FlutterEdgeAiActiveEmbedder.forActiveModel` builds ids from file names only,\nso it cannot tell the sizes apart either.\n\n```text\nfinal class MatryoshkaEmbedder implements RagEmbedder {\n  MatryoshkaEmbedder(this.inner, {required this.dimension, required this.profileId});\n\n  final RagEmbedder inner;\n  final int dimension;\n  final String profileId; \u002F\u002F a new space: never the full-size id\n\n  @override\n  Future\u003CEmbeddingProfile> resolveProfile() async {\n    final full = await inner.resolveProfile();\n    if (dimension > full.dimension) {\n      throw ArgumentError.value(dimension, 'dimension', 'exceeds ${full.dimension}');\n    }\n    return EmbeddingProfile(id: profileId, dimension: dimension);\n  }\n\n  @override\n  Set\u003CEmbeddingModality> get modalities => const {EmbeddingModality.text};\n\n  @override\n  Future\u003CList\u003Cdouble>> embedDocument(EmbeddingInput document) async =>\n      truncateEmbedding(await inner.embedDocument(document), dimension);\n\n  @override\n  Future\u003CList\u003Cdouble>> embedQuery(\n    EmbeddingInput query, {\n    required EmbeddingModality documentModality,\n  }) async => truncateEmbedding(\n    await inner.embedQuery(query, documentModality: documentModality),\n    dimension,\n  );\n}\n\nfinal index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n  ),\n  embedder: MatryoshkaEmbedder(\n    FlutterEdgeAiActiveEmbedder(profileId: eg2ProfileId),\n    dimension: 256,\n    profileId: '$eg2ProfileId-mrl256',\n  ),\n);\n```\n\nOnly Matryoshka-trained models keep their quality this way. EmbeddingGemma 1,\nGecko, MiniLM and the GGUF EmbeddingGemma 2 were not measured here; do not\ntruncate a model without measuring it.\n\n### EmbeddingGemma 2 on a Qualcomm NPU (`flutter_edge_ai_litertlm` 1.13.1)\n\nThe same repos hold each bundle compiled for one SoC's NPU\n(`embeddinggemma-2-text-270m_Qualcomm_SM8850.litertlm`,\n`embeddinggemma-2-text-vision-440m_Qualcomm_QCS8275.litertlm`, …). It runs on\nQualcomm Android (arm64) and Qualcomm Linux arm64, in an app whose pubspec (the\nworkspace root's, for a workspace member) sets\n`hooks: user_defines: flutter_edge_ai_litertlm: qualcomm_npu: true` (the flag\nthe LLM NPU path uses), loaded with `preferredBackend: PreferredBackend.npu`:\n\n```dart\nconst eg2Revision = '9be6e8b90982095dc05c2bd162e4b954ee4dbac7';\n\u002F\u002F Its own id: NPU vectors are not the CPU bundle's. Shared by the SoC's 270m\n\u002F\u002F and 440m (byte-identical text towers).\nconst npuProfileId =\n    'embeddinggemma2-litertlm-text-4410a540ce75-prefix-v1-npu-sm8850';\n\nawait FlutterEdgeAi.installEmbedder()\n    .modelFromNetwork(\n      'https:\u002F\u002Fhuggingface.co\u002Flitert-community\u002F'\n      'embeddinggemma-2-text-270m-litert-lm\u002Fresolve\u002F$eg2Revision\u002F'\n      'embeddinggemma-2-text-270m_Qualcomm_SM8850.litertlm',\n    )\n    .install();\nfinal npu = await FlutterEdgeAi.getActiveEmbedder(\n  preferredBackend: PreferredBackend.npu,\n);\nassert(npu.activeBackend == PreferredBackend.npu);\n\nfinal rag = FlutterEdgeAiRag(providers: const [SqliteVectorStoreProvider()]);\nfinal npuIndex = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: p.join(\n      (await getApplicationDocumentsDirectory()).path,\n      'knowledge-embeddinggemma2-npu-sm8850.db',\n    ),\n  ),\n  \u002F\u002F The adapter loads the embedder per operation: pass npu here too.\n  embedder: FlutterEdgeAiActiveEmbedder(\n    profileId: npuProfileId,\n    preferredBackend: PreferredBackend.npu,\n  ),\n);\n```\n\n- Run on device: SM8850, SM8650 and QCS8275. Google also publishes SM8550,\n  SM8750 (accepted by the loader, not run by us), Intel PTL (Windows, below),\n  Tensor G5\u002FG6 (below; G6 run, G5 not) and MediaTek MT6991\u002FMT6993 (below).\n  Per build: https:\u002F\u002Fflutteredge.ai\u002Fdocs\u002Fregistry. What a bundle targets is\n  read from the bundle.\n- Its vectors are close to the CPU bundle's, not equal (SM8650: cosine\n  0.79–0.86 for a few words, 0.99 from about 200 words; images 0.86–0.88), so\n  never compare NPU vectors with CPU ones; within the NPU space retrieval\n  holds (text → image 10\u002F10).\n- Nothing falls back: a per-SoC bundle without `npu`, the generic bundle with\n  `npu`, `npu` on iOS\u002FmacOS\u002FLinux x64\u002FWeb, a Qualcomm bundle on Windows, a\n  Tensor or MediaTek bundle off Android, a build without the bundle vendor's flag\n  (`qualcomm_npu`, `google_tensor_npu`, `mediatek_npu`), a device without a\n  reachable NPU of\n  that vendor (for Tensor: not a Tensor Pixel on Android 16 or later, or a BP2A\n  build; for MediaTek: below Android 12, a SoC manufacturer other than\n  Mediatek or MTK, or no NeuroPilot adapter opens in the app), and a bundle the NPU cannot run (another SoC's or Tensor\n  generation's) each throw\n  `EmbeddingLoadException` with the fix. A loaded embedder is never reused for\n  the other backend.\n- Give an NPU index its own profile id (above); never open a CPU index with an\n  NPU embedder or the reverse. `FlutterEdgeAiActiveEmbedder.forActiveModel`\n  keys on the file name, so it separates them by itself.\n- **Intel Panther Lake (Windows x64, `flutter_edge_ai_litertlm` 1.13.2).** `…_Intel_PTL.litertlm` (270m, 440m, 740m) loads the\n  same way with `preferredBackend: PreferredBackend.npu`, with no opt-in flag:\n  every Windows x64 build carries the Intel stack (LiteRtDispatch.dll,\n  OpenVINO, TBB) beside the executable, and its absence is refused by name.\n  Profile id: the CPU text id plus `-npu-ptl`, shared by the 270m, the 440m and\n  the 740m.\n  An Intel bundle on Android or Linux is refused. The 270m was measured on a\n  Panther Lake PC (2026-10-21, OpenVINO 2026.4.1, the stack of\n  `flutter_edge_ai_litertlm` 1.17.0): 768-dimensional vectors, load about\n  0.9 s; the 440m is not measured. Each 270m load writes a 74.5 MB weight bank\n  to `%TEMP%` (the 440m's is not measured), deleted when the embedder closes.\n- **Google Tensor G5\u002FG6 (Android arm64, `flutter_edge_ai_litertlm` 1.15.0).**\n  `…_Google_Tensor_G5.litertlm` \u002F `…_Google_Tensor_G6.litertlm` (270m, 440m)\n  load the same way with `preferredBackend: PreferredBackend.npu`, in an app\n  whose pubspec (the workspace root's, for a workspace member) sets\n  `hooks: user_defines: flutter_edge_ai_litertlm: google_tensor_npu: true` (the\n  flag the LLM path uses), on\n  a Pixel with that Tensor generation and Android 16 or later, not a BP2A\n  build. Profile id: the CPU text id plus the SoC, e.g. `-npu-tensor_g6`,\n  shared by the 270m and the 440m. Run on a Pixel 11 (Tensor G6) with a debug\n  build; a Tensor G5 and a release-signed build are not run yet.\n- **MediaTek MT6991\u002FMT6993 (Android arm64, `flutter_edge_ai_litertlm` 1.17.0).**\n  `…_MediaTek_MT6991.litertlm` \u002F `…_MediaTek_MT6993.litertlm` are accepted the\n  same way with `preferredBackend: PreferredBackend.npu`, in an app whose pubspec\n  (the workspace root's, for a workspace member) sets\n  `hooks: user_defines: flutter_edge_ai_litertlm: mediatek_npu: true`, on a phone with that SoC, Android 12 or later, whose\n  vendor exposes NeuroPilot to apps. Profile id: the CPU text id plus the SoC,\n  e.g. `-npu-mt6991`. Not run on an MT6991\u002FMT6993 phone yet; the LLM path\n  runs on an MT6989.\n\n### EmbeddingGemma 2 images (440m; `flutter_edge_ai_litertlm` 1.13.1 native, 1.13.1 Web)\n\nThe 440m bundle adds a vision encoder to the same text tower, so one model\nembeds both and a text finds photos. Install it like the 270m (ungated):\n\n```dart\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst visionRevision = 'e301f74d5551b0c2641bd5cb4652a76239d5c5f8';\n\u002F\u002F The text id of the 270m section; image vectors also depend on the vision\n\u002F\u002F budget, so image indexes add it.\nconst photosProfileId =\n    'embeddinggemma2-litertlm-text-4410a540ce75-prefix-v1-vis140';\n\nawait FlutterEdgeAi.installEmbedder()\n    .modelFromNetwork(\n      'https:\u002F\u002Fhuggingface.co\u002Flitert-community\u002F'\n      'embeddinggemma-2-text-vision-440m-litert-lm\u002Fresolve\u002F$visionRevision\u002F'\n      'embeddinggemma-2-text-vision-440m.litertlm',\n      filename: 'embeddinggemma-2-text-vision-440m__rev-e301f74d5551.litertlm',\n    )\n    .install();\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal photos = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: p.join(\n      (await getApplicationDocumentsDirectory()).path,\n      'photos-embeddinggemma2-vis140.db',\n    ),\n    documents: EmbeddingModality.image,\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder(\n    profileId: photosProfileId,\n    supportImage: true,\n  ),\n);\nawait photos.add(\n  id: 'photo-1',\n  document: EmbeddingInput.image(bytes), \u002F\u002F upright, ≤ 1024 px: see below\n  content: path, \u002F\u002F a reference to the photo, never its bytes\n);\nfinal hits = await photos.search(query: EmbeddingInput.text('a red bicycle'));\n```\n\nPass upright, downscaled images. The engine decodes the file itself, ignores\nEXIF orientation — a portrait phone photo, stored sideways with an orientation\ntag, is embedded lying on its side (measured cos 0.89 against the upright\npicture) — and decodes at full size, which a 12 MP photo pays for. Decode with\nFlutter first: it applies the orientation and decodes straight to the target\nsize:\n\n```dart\nimport 'dart:math' as math;\nimport 'dart:ui' as ui;\n\nfinal codec = await ui.instantiateImageCodecWithSize(\n  await ui.ImmutableBuffer.fromUint8List(bytes), \u002F\u002F the photo as picked\n  getTargetSize: (w, h) => math.max(w, h) \u003C= 1024\n      ? const ui.TargetImageSize()\n      : w >= h\n      ? const ui.TargetImageSize(width: 1024)\n      : const ui.TargetImageSize(height: 1024),\n);\nfinal image = (await codec.getNextFrame()).image;\nfinal png = await image.toByteData(format: ui.ImageByteFormat.png);\nimage.dispose();\ncodec.dispose();\nfinal upright = EmbeddingInput.image(png!.buffer.asUint8List());\n```\n\nThis also converts what Flutter decodes and the engine does not (WebP; HEIC on\nAndroid). Keep the original for display; give the model the result. The same\ncode runs on Web (CanvasKit and skwasm decode through the browser), on the\npage itself: there are no isolates there.\n\n- Formats the engine decodes: JPEG, PNG, GIF and BMP. HEIC, WebP, TIFF and\n  AVIF throw `EmbeddingFormatNotSupportedException` (with `detected` and\n  `accepted`) before anything is sent — decode them as above. A corrupt or\n  truncated file of an accepted type reaches the model and fails with\n  `EmbeddingEngineException` (`nativeCode` 3 on native; on Web the message\n  carries the runtime's reason); the model keeps working.\n- Vision budget: 140 tokens per image by default (closest to the reference\n  model, min cos 0.985 on our test images);\n  `LiteRtEmbeddingBackend(visionTokensPerImage: 70)` — what the model card and\n  Google AI Edge Gallery use — is about twice as fast with slightly lower\n  fidelity (min cos 0.970); give its image indexes their own id (`…-vis70`). Any other value throws `EmbeddingLoadException`. Text vectors\n  do not depend on it. `forActiveModel` ids follow file names only, so an app\n  that changes the budget puts it in the namespace (`'photos-vis70'`).\n- On Web the vision encoder does not fit next to a loaded `.litertlm` LLM:\n  the page's `@litert-lm\u002Fcore` module has 4 GB of WebAssembly memory, and the\n  440m's vision engine (about 3.3 GB) and Gemma 4 E2B do not share it —\n  whichever loads second fails, the embedder with an `EmbeddingLoadException`\n  that says to close the LLM first. Text-only embedding loads next to the LLM.\n- Cost (CPU, measured): 388 MB on disk plus a 218 MB vision weight cache\n  written every time the model loads — also when it only embeds text. The\n  first image adds RAM: about 385 MB on an M4 Pro Mac, about 500 MB on a\n  Pixel 8. Per image at 140 tokens: about 0.35 s on an Apple-silicon Mac,\n  about 2 s on an Android flagship (Pixel 8 Pro 1.8 s, Pixel 8a 2.3 s), more\n  on mid-range phones and rising under sustained load as the phone heats up;\n  70 tokens takes about half. A 440m loaded for text alone still loads its\n  vision tower: apps that embed only text use the 270m. LiteRT-LM's thread\n  setting reaches the text tower only. Close the embedder after a large photo\n  ingest on low-RAM devices.\n- A text query over an image index is sent raw (`TaskType.none`): measured,\n  the retrieval-query prefix found the same photos with a smaller margin. Do\n  not set `queryTask` for it: that applies to text documents only.\n\n### EmbeddingGemma 2 audio and combined inputs (740m; `flutter_edge_ai_litertlm` 1.13.1 native, 1.13.2 Web)\n\nThe 740m bundle (`litert-community\u002Fembeddinggemma-2-740m-litert-lm`, revision\n`24d962e906c7d332c6428e71c9676855024569e2`, ungated, 485 MB) has the 440m's\ntext and vision towers — the same text and image vectors, so the same profile\nids — plus an audio encoder. On Web audio and combined inputs run on WebGPU\n(from 1.13.2) with the same formats, limits and errors.\n\n```dart\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal clips = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: path, \u002F\u002F its own location: one modality per location\n    documents: EmbeddingModality.audio,\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(\n    namespace: 'clips',\n    supportAudio: true,\n  ),\n);\nawait clips.add(\n  id: 'memo-1',\n  document: EmbeddingInput.audio(bytes), \u002F\u002F encoded WAV, MP3 or FLAC bytes\n  content: 'file:\u002F\u002F\u002Fmemos\u002F1.wav',\n);\nfinal hits = await clips.search(\n  query: EmbeddingInput.text('turn off the kitchen lights'),\n);\n\n\u002F\u002F Several parts in one vector (flutter_edge_ai 2.3.1), outside an index:\nfinal embedder = await FlutterEdgeAi.getActiveEmbedder(\n  supportImage: true,\n  supportAudio: true,\n);\nfinal vector = await embedder.embed(\n  EmbeddingInput(text: 'kitchen', audio: bytes),\n  taskType: TaskType.retrievalDocument,\n);\n```\n\n- Formats: WAV, MP3 and FLAC, any rate and channel count (the engine mixes\n  down to mono and resamples to 16 kHz). Ogg and M4A throw\n  `EmbeddingFormatNotSupportedException` before anything is sent; a corrupt\n  file of an accepted type throws `EmbeddingEngineException` (`nativeCode` 2\n  on native; on Web the runtime's message) and the model keeps working. One\n  clip per vector.\n- Length: about 25 tokens per second, so up to about 40 seconds fit the\n  1024-token cap; a 60-second clip throws `EmbeddingInputTooLongException`\n  with `actualTokens` 1504. Split long recordings.\n- `EmbeddingInput(text:, images:, audio:)` puts the text (with its task\n  prefix), then the images in order, then the audio into one vector, whatever\n  order the arguments are written in. Declare every medium it carries. Any\n  input with more than one part — several modalities, or several images — is\n  a combined input: an engine that embeds one part per vector (every other one\n  here, and EmbeddingGemma 2 on Web before `flutter_edge_ai_litertlm` 1.13.2)\n  refuses it with\n  `UnsupportedEmbeddingCombinationException` before anything is sent.\n- An audio index keeps the text profile id: audio vectors do not depend on the\n  vision budget, and the store's `documents` modality keeps it apart from a\n  text store. A text query over it is sent raw (`TaskType.none`).\n- Audio vectors are not bit-portable: the audio encoder quantizes activations\n  to 8 bits, so another CPU kernel can move a clip's vector by up to cos 0.05\n  (text and image vectors do not move that way); Web (WebGPU) audio vectors\n  are within cos 0.97 of the native ones. Retrieval holds: every test\n  sentence was found by its text query on every build measured, Web included.\n- Cost (CPU, M4 Pro Mac): 385 MB of weight caches written at every load (text\n  71 MB, vision 218 MB, audio 95 MB), also for text-only use; about 0.2–0.3 s\n  per 3-second clip. On Web (WebGPU, Tesla T4) about 0.3 s per clip after a\n  first one of about 4 s, and no weight cache. Use the 270m for text, the 440m\n  for text and images.\n\n## Index and search\n\n```dart\nimport 'dart:convert';\n\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst databaseName = 'knowledge-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n    filterSchema: FilterSchema(fields: [\n      FilterField(name: 'lang', type: FilterFieldType.string),\n      FilterField(name: 'year', type: FilterFieldType.number),\n    ]),\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(namespace: 'knowledge'),\n);\nawait index.add(\n  id: 'doc-1',\n  document: EmbeddingInput.text(chunk),\n  metadata: jsonEncode({'lang': 'en', 'year': 2024}),\n);\n\nfinal hits = await index.search(\n  query: EmbeddingInput.text(question),\n  topK: 5,\n  threshold: 0.3,\n  filter: Filter(\n    must: [FieldEquals(key: 'lang', value: 'en')],\n    mustNot: [FieldRange(key: 'year', lte: 2010)],\n  ),\n);\n\nawait index.flush();\n```\n\n`add` embeds with the embedder's document role and stores the chunk as the\nhit's `content` (pass `content:` to store something else); `search` uses the\nquery role. For precomputed batches, embed with `TaskType.retrievalDocument`,\nthen use `addVector`; use `searchVector` for precomputed queries. `remove`,\n`stats`, `clear`, and `flush` operate on the owned index. Flush after a write\nbatch: it is required for qdrant durability, a Web SQLite durability fence,\nand a no-op on native SQLite. Every field a `Filter` names must be declared in\n`filterSchema`; an undeclared one throws `ArgumentError`.\n\nChunk text below the embedder's input limit,\n`(await FlutterEdgeAi.getActiveEmbedder()).maxInputTokens` — 256 tokens for the\nEmbeddingGemma seq256 file above, task prefix, BOS and EOS included. A longer\nchunk or query is never truncated: `add` and `search` throw\n`EmbeddingInputTooLongException`, whose `maxInputTokens` and `actualTokens`\nsay by how much. A null `maxInputTokens` means the loaded pass cannot establish\nan effective limit, not that input is unlimited.\n\n## Image and audio documents\n\nA location holds documents of one modality. An image index needs an embedder\nthat embeds images (`RagEmbedder.modalities`); `open()` refuses one that does\nnot with `ArgumentError`. `content` is required and is a reference to the\nmedia — a URI, file path or asset id — never its bytes; search results return\nit. A text query over an image index is text-to-image search:\n\n```dart\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal photos = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: path, \u002F\u002F its own location: one modality per location\n    documents: EmbeddingModality.image,\n  ),\n  embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(\n    namespace: 'photos',\n    supportImage: true,\n  ),\n);\nawait photos.add(\n  id: 'photo-1',\n  document: EmbeddingInput.image(bytes), \u002F\u002F encoded JPEG\u002FPNG bytes\n  content: 'content:\u002F\u002Fmedia\u002Fexternal\u002Fimages\u002F1',\n);\nfinal matches = await photos.search(query: EmbeddingInput.text('a red bicycle'));\n```\n\nThe active embedder embeds images with the EmbeddingGemma 2 440m or 740m\nbundle (above; on Web from `flutter_edge_ai_litertlm` 1.13.1). With any other\nmodel — the 270m, EmbeddingGemma 1, Gecko, ONNX, a GGUF —\n`getActiveEmbedder(supportImage: true)`, and therefore `open()` of an image\nindex with the active embedder, fails with `EmbeddingLoadException`. A\ncustom `RagEmbedder` can embed media with any model. A text index and an image\nindex can share one installed model: each adapter declares what it needs, and\ncore reloads the embedder once with both.\n\nCross-modal scores are not on one scale, so mixed corpora use one index per\nmodality and the app merges results. Text locations open in both directions\nbetween this release and flutter_edge_ai_rag 1.0 with the 2.0.x stores. On an\nimage or audio location those older releases refuse every open that names a\nprofile, legacy adoption, every text operation and a rebind.\n\n## Vector-only and custom embedders\n\nRAG can run without `FlutterEdgeAi.initialize()`.\n\nFor vector-only use, open with the profile of the pipeline that produced the\nvectors and call only vector APIs:\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst databaseName = 'vectors-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal index = await rag.openVectors(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n  ),\n  profile: EmbeddingProfile(\n    id: 'my-precomputed-embedding-pipeline-v1',\n    dimension: 768,\n  ),\n);\nfinal vector = List\u003Cdouble>.filled(768, 0);\nfinal queryVector = List\u003Cdouble>.filled(768, 0);\nawait index.addVector(id: 'doc-1', content: chunk, embedding: vector);\nfinal hits = await index.searchVector(embedding: queryVector);\n```\n\nFor independent RAG, implement `RagEmbedder`. It maps the document and query\nroles to its model's conventions. `EmbeddingProfile` has no `const`\nconstructor — it validates its arguments:\n\n```text\nclass AppEmbedder implements RagEmbedder {\n  AppEmbedder(this.model);\n  final MyEmbeddingModel model;\n\n  @override\n  Future\u003CEmbeddingProfile> resolveProfile() async => EmbeddingProfile(\n    id: 'my-model-tokenizer-pooling-prefix-v1',\n    dimension: 384,\n  );\n\n  @override\n  Set\u003CEmbeddingModality> get modalities => const {EmbeddingModality.text};\n\n  @override\n  Future\u003CList\u003Cdouble>> embedDocument(EmbeddingInput document) =>\n      model.embed('document: ${document.text}');\n\n  @override\n  Future\u003CList\u003Cdouble>> embedQuery(\n    EmbeddingInput query, {\n    required EmbeddingModality documentModality,\n  }) => model.embed('query: ${query.text}');\n}\n\nfinal index = await rag.open(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: customDatabasePath, \u002F\u002F absolute path on native, a name on Web\n  ),\n  embedder: AppEmbedder(model),\n);\n```\n\nDifferent indexes may use different embedders. Never mix their vectors in one\nlocation, even when dimensions match.\n\n## qdrant-edge storage (native only)\n\n```dart\nimport 'package:flutter_edge_ai_qdrant\u002Fflutter_edge_ai_qdrant.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nfinal rag = FlutterEdgeAiRag(\n  providers: const [QdrantVectorStoreProvider()],\n);\n\u002F\u002F A directory, not a file — qdrant creates its shard files inside it.\nfinal storeDirectory = p.join(\n  (await getApplicationDocumentsDirectory()).path,\n  'knowledge-qdrant-v1',\n);\ntry {\n  final index = await rag.open(\n    spec: VectorStoreSpec(providerId: 'qdrant', location: storeDirectory),\n    embedder: FlutterEdgeAiActiveEmbedder.forActiveModel(namespace: 'knowledge'),\n  );\n} on QdrantLegacyStoreException catch (e) {\n  \u002F\u002F Written by flutter_gemma_rag_qdrant 1.2 or earlier: not readable.\n  \u002F\u002F e.message names the files to delete; delete them, then re-index.\n  print(e.message);\n}\n```\n\n`QdrantVectorStoreProvider` has no static providerId constant: pass the string\n`'qdrant'`. Keep the directory apart from any SQLite database. A store written\nby `flutter_gemma_rag_qdrant` 1.2 or earlier makes `open()` throw\n`QdrantLegacyStoreException`: its format cannot be read or adopted, so delete\nthe files its message names and re-index. Catch that type, not the base\n`VectorStoreException` — the base type also covers a shard that is only locked\nby another open store. The legacy-adoption path below applies to profile-less\nqdrant stores written by 1.3.x.\n\n## Existing stores and lifecycle\n\nA nonempty 1.x store has no profile metadata. Prefer a new profile-versioned\nlocation and re-index. Only when the exact old embedding pipeline is known may\nthe app open it with that profile and `allowLegacyProfileAdoption: true`. That\nflag is a `VectorStoreSpec` field, not an `open()` argument, applies to text\nlocations only, and the provider also checks vector dimension:\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst oldDatabaseName = 'rag.db'; \u002F\u002F the location the 1.x app already used\nfinal databasePath = kIsWeb\n    ? oldDatabaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, oldDatabaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal index = await rag.openVectors(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n    allowLegacyProfileAdoption: true,\n  ),\n  profile: EmbeddingProfile(\n    id: 'the-verified-old-embedding-pipeline-v1',\n    dimension: 768,\n  ),\n);\n```\n\nStores written by flutter_edge_ai_rag 1.0 (`flutter_edge_ai_sqlite` \u002F\n`flutter_edge_ai_qdrant` 2.0.x) open unchanged as text locations.\n\nMake open\u002Fdispose app-owned and idempotent:\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst databaseName = 'knowledge-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nFuture\u003CRagIndex>? opening;\nFuture\u003Cvoid>? disposing;\n\nopening ??= rag.openVectors(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n  ),\n  profile: EmbeddingProfile(id: 'embedding-pipeline-v1', dimension: 768),\n);\ndisposing ??= () async {\n  final pending = opening;\n  if (pending != null) await (await pending).dispose();\n}();\nawait disposing;\n```\n\nDo not create an index in each widget or reopen the same Web location while a\nprevious index is live. Shutdown order is:\n\n```dart\nimport 'package:flutter\u002Ffoundation.dart';\nimport 'package:flutter_edge_ai\u002Fflutter_edge_ai.dart';\nimport 'package:flutter_edge_ai_rag\u002Fflutter_edge_ai_rag.dart';\nimport 'package:flutter_edge_ai_sqlite\u002Fflutter_edge_ai_sqlite.dart';\nimport 'package:path\u002Fpath.dart' as p;\nimport 'package:path_provider\u002Fpath_provider.dart';\n\nconst databaseName = 'knowledge-v1.db';\nfinal databasePath = kIsWeb\n    ? databaseName\n    : p.join((await getApplicationDocumentsDirectory()).path, databaseName);\nfinal rag = FlutterEdgeAiRag(\n  providers: const [SqliteVectorStoreProvider()],\n);\nfinal index = await rag.openVectors(\n  spec: VectorStoreSpec(\n    providerId: SqliteVectorStoreProvider.providerId,\n    location: databasePath,\n  ),\n  profile: EmbeddingProfile(id: 'embedding-pipeline-v1', dimension: 768),\n);\nawait index.dispose();\nawait FlutterEdgeAi.dispose(); \u002F\u002F resets core's registries; closes no model\n```\n\n## Moving from flutter_edge_ai_rag 1.0 to 1.1\n\n| rag 1.0 | rag 1.1 |\n| --- | --- |\n| `open(spec:, activeEmbedderProfileId: id)` | `open(spec:, embedder: FlutterEdgeAiActiveEmbedder(profileId: id))`, or `.forActiveModel(namespace:)` |\n| `open(spec:, embeddingProfile: p)` (vectors only) | `openVectors(spec:, profile: p)` |\n| `open()` bound the profile on the first text operation | `open()` resolves the profile and binds the location at once; install the embedder first |\n| `index.addText(id:, content: c)` | `index.add(id:, document: EmbeddingInput.text(c))` |\n| `index.searchText(query: q)` | `index.search(query: EmbeddingInput.text(q))` |\n| `index.embeddingProfile` could be null | never null; `index.documents` names the modality |\n| `RagEmbedder` with a `profile` getter, `embedDocument(String)`, `embedQuery(String)` | `resolveProfile()`, `modalities`, `embedDocument(EmbeddingInput)`, `embedQuery(EmbeddingInput, documentModality:)` |\n| a filter on an undeclared field was ignored | `ArgumentError` |\n| `VectorStoreRepository` (`implements`), `readEmbeddingProfile`\u002F`bindEmbeddingProfile` | `abstract base class` (`extends`), `readBinding()`\u002F`bind(VectorStoreBinding)` |\n\nUpgrade every flutter_edge_ai package together: the stores of this release\nneed flutter_edge_ai_rag 1.1.\n\n## Moving from 1.x core RAG to 2.0\n\nIn flutter_edge_ai 2.0 RAG left core: the `FlutterEdgeAi.rag.…` calls and the\n`vectorStore:` and `filterSchema:` parameters of `FlutterEdgeAi.initialize()`\nare gone. Add `flutter_edge_ai_rag` and a storage package, remove those two\nparameters, and open a `RagIndex`:\n\n| 1.x (`FlutterEdgeAi.rag.…`) | `RagIndex` |\n| --- | --- |\n| `initialize(vectorStore: ...)` on core | `FlutterEdgeAiRag(providers: [...])` |\n| `rag.initialize(location)` | `rag.open(spec: VectorStoreSpec(...), embedder: ...)` |\n| `addDocument(...)` | `add(id:, document: EmbeddingInput.text(...))` |\n| `addDocumentWithEmbedding(...)` | `addVector(...)` |\n| `searchSimilar(query: ...)` | `search(query: EmbeddingInput.text(...))` |\n| `removeDocument(id: ...)` | `remove(id: ...)` |\n| `stats()` \u002F `flush()` \u002F `clear()` | the same methods on the index |\n\n`No vector-store provider can handle providerId \"…\"` means the provider for\nthat ID was not passed to `FlutterEdgeAiRag(providers: ...)`, or cannot run on\nthis platform (qdrant on Web). A nonempty store written by 1.x is usable only\nthrough the legacy-adoption path above, or after re-indexing into a new\nlocation.\n\n## Web assets and common failures\n\n- Copy `web\u002Frag\u002Fsqlite3.wasm` from `flutter_edge_ai_sqlite` to the same path in\n  the app. Copy the four matching LiteRT embedding files from\n  `flutter_edge_ai_litertlm\u002Fweb\u002F` when that runtime is used, and copy them\n  again after upgrading it: a stale `litert_embeddings.js` fails\n  `getActiveEmbedder()` with an `EmbeddingLoadException` that names the file.\n  EmbeddingGemma 2 (`.litertlm`) needs none of those files, only\n  `window.EmbeddingEngine = m.EmbeddingEngine;` in the `@litert-lm\u002Fcore`\n  module script of `web\u002Findex.html`, and a browser with WebGPU.\n- `EmbeddingLoadException` starting \"EmbeddingGemma 2 on the web needs\n  WebGPU\": the browser has no `navigator.gpu` or no GPU adapter. There is no\n  CPU path for these bundles on Web; use a browser with WebGPU enabled.\n- `ArgumentError` naming an undeclared filter field: add it to `filterSchema`.\n  SQLite names must match `^[A-Za-z][A-Za-z0-9_]*$` and avoid reserved columns.\n- `StateError: Vector store \"…\" is bound to …, not …`: the location belongs to\n  another profile or document modality — model or preprocessing bytes\n  changed, a different model is installed, or the wrong location was opened.\n  Do not bypass it; choose the correct profile\u002Flocation.\n- Vector-only indexes need `openVectors(profile:)`: raw numbers cannot\n  identify their embedding space.\n- `EmbeddingInputTooLongException` from `add` or `search`: the text is longer\n  than the embedder's `maxInputTokens`. Split it into smaller chunks; older\n  releases truncated it silently. With EmbeddingGemma 2 its `actualTokens` is\n  the exact count (natively from `flutter_edge_ai_litertlm` 1.13.1).\n- `EmbeddingLoadException` from `open()` of an image index: the installed\n  model has no vision encoder — \"has no vision encoder; install\n  embeddinggemma-2-text-vision-440m\" on the 270m — or is not an EmbeddingGemma\n  2 bundle. From an audio index: \"has no audio encoder; install\n  embeddinggemma-2-740m\" on the 270m and the 440m, natively and on Web.\n- `EmbeddingFormatNotSupportedException` from `add` or `search` on an image\n  index: HEIC, WebP, TIFF or AVIF; convert to JPEG or PNG.\n- `VectorStoreException` \"… is not a valid embedding profile\" on open: the\n  location was bound by flutter_edge_ai_rag 1.0 to an id with a control\n  character, which 1.1 refuses; this version cannot open it.\n- `StateError` mentioning that the active embedding model changed: an adapter\n  is pinned to the model active when it was created. After switching\n  embedders, create a new embedder and open a new index at a new location.\n",{"name":5,"description":7},"main","723097aedd62adb1c52163fffe85259640c7f4fd","packages\u002Fflutter_edge_ai\u002Fskills\u002Fflutter-edge-ai-rag",180,"https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai","https:\u002F\u002Fflutteredge.ai","https:\u002F\u002Fgithub.com\u002FDenisovAV","Sasha is Flutter, Dart, Firebase and AI GDE, Co-organizer of Flutter Berlin Community, Expert in On-Device AI","2026-11-14 22:02:12",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":71},[61,64,67],{"tool":62,"command":63},"npx","npx skills add DenisovAV\u002Fflutter_edge_ai --skill flutter-edge-ai-rag",{"tool":65,"command":66},"bunx","bunx skills add DenisovAV\u002Fflutter_edge_ai --skill flutter-edge-ai-rag",{"tool":68,"command":69},"pnpm","pnpm dlx skills add DenisovAV\u002Fflutter_edge_ai --skill flutter-edge-ai-rag","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fpackages\u002Fflutter_edge_ai\u002Fskills\u002Fflutter-edge-ai-rag\u002FSKILL.md",true,[],[74,87,99,114,132,145],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":83,"publishedAt":45},"01M6BXTT3TADZ7NN5RY79ZZKDR","send-email","Send an email.","https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fpackages\u002Fflutter_edge_ai_agent\u002Fassets\u002Fskills\u002Fsend-email\u002FSKILL.md",[80],{"categoryNo":81,"categoryName":82,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000005","邮件与沟通",[84,85,86],"send","send email","email",{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":45},"01M6BXTQPW2BAVZ2SRVTMFF9FA","query-wikipedia","Query summary from Wikipedia for a given topic.","https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fpackages\u002Fflutter_edge_ai_agent\u002Fassets\u002Fskills\u002Fquery-wikipedia\u002FSKILL.md",[],[94,95,96,97,98],"wikipedia","query","query wikipedia","for","summary",{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":110,"publishedAt":45},"01M6BXTN6C4R4FZ5T9GRNY5MFG","qr-code","Generates a QR code for the given url.","https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fpackages\u002Fflutter_edge_ai_agent\u002Fassets\u002Fskills\u002Fqr-code\u002FSKILL.md",[105],{"categoryNo":106,"categoryName":107,"taxonomyType":108,"taxonomyTypeDesc":109},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[111,112,37,97,113],"qr","qr code","URL",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":45},"01M6BXTJXNJNW59BV5JM3V9YZD","kitchen-adventure","Act as a dungeon master for a text-based adventure set in a world where everyone is a sentient kitchen appliance. Trigger when user says \"start kitchen adventure\".","https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fpackages\u002Fflutter_edge_ai_agent\u002Fassets\u002Fskills\u002Fkitchen-adventure\u002FSKILL.md",[],[121,29,122,97,123,124,125,126,127,128,129,130,131],"kitchen adventure","dungeon master","trigger","as","act","world","master","user","text","SET","start",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":138,"publishedAt":45},"01M6BXTGEPGG025VBEQKPJZB8S","interactive-map","Show an interactive map view for the given location.","https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fpackages\u002Fflutter_edge_ai_agent\u002Fassets\u002Fskills\u002Finteractive-map\u002FSKILL.md",[],[139,140,141,142,143,144,97],"interactive map","interactive","map","view","show","location",{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":45},"01M6BXTED45RFKX4EYF9BSWC7H","get-current-time","Get the user's current local date, time, and day of the week.","https:\u002F\u002Fgithub.com\u002FDenisovAV\u002Fflutter_edge_ai\u002Fblob\u002Fmain\u002Fpackages\u002Fflutter_edge_ai_agent\u002Fassets\u002Fskills\u002Fget-current-time\u002FSKILL.md",[],[152,153,154,155,128,156],"current time","get current time","time","get","local"]