@mastra/fastembed
Local embedding model integration for Mastra, powered by ONNX Runtime.
This package is a maintained fork of fastembed-js (now archived). The upstream source has been vendored directly into this package so that @mastra/fastembed no longer depends on the unmaintained fastembed npm package.
Installation
npm install @mastra/fastembed
Usage
Default (AI SDK v3)
import { Memory } from '@mastra/memory';
import { fastembed } from '@mastra/fastembed';
const memory = new Memory({
embedder: fastembed,
});
Input length
FastEmbed models embed at most 512 tokens per input (roughly 2,000 to 2,500 characters of English text). Longer inputs are truncated: text past the limit doesn't affect the embedding. The AI SDK v3 models return a warning when this happens. Chunk long documents to fit the window, for example with maxSize: 1500 in MDocument.chunk().
Documentation
Changelog
See the package changelog for version history and release notes.
Support
We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.