@mastra/fastembed 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE-fastembed +21 -0
  3. package/README.md +26 -17
  4. package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +466 -1768
  5. package/dist/fastembed.d.ts +115 -0
  6. package/dist/fastembed.d.ts.map +1 -0
  7. package/dist/index.cjs +1801 -691
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +3 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1790 -690
  12. package/dist/index.js.map +1 -1
  13. package/package.json +22 -15
  14. package/LICENSE.md +0 -30
  15. package/dist/chunk-23EXJLET.cjs +0 -84
  16. package/dist/chunk-23EXJLET.cjs.map +0 -1
  17. package/dist/chunk-BSDWQEU3.js +0 -79
  18. package/dist/chunk-BSDWQEU3.js.map +0 -1
  19. package/dist/chunk-DGUM43GV.js +0 -10
  20. package/dist/chunk-DGUM43GV.js.map +0 -1
  21. package/dist/chunk-EQ4M72KU.js +0 -439
  22. package/dist/chunk-EQ4M72KU.js.map +0 -1
  23. package/dist/chunk-HJYHDIOC.js +0 -250
  24. package/dist/chunk-HJYHDIOC.js.map +0 -1
  25. package/dist/chunk-IDRQZVB4.cjs +0 -84
  26. package/dist/chunk-IDRQZVB4.cjs.map +0 -1
  27. package/dist/chunk-JEQ2X3Z6.cjs +0 -12
  28. package/dist/chunk-JEQ2X3Z6.cjs.map +0 -1
  29. package/dist/chunk-LIBOSOHM.cjs +0 -252
  30. package/dist/chunk-LIBOSOHM.cjs.map +0 -1
  31. package/dist/chunk-RC6RZVYE.js +0 -79
  32. package/dist/chunk-RC6RZVYE.js.map +0 -1
  33. package/dist/chunk-ZD3BKU5O.cjs +0 -441
  34. package/dist/chunk-ZD3BKU5O.cjs.map +0 -1
  35. package/dist/token-6GSAFR2W-ABXTQD64.js +0 -61
  36. package/dist/token-6GSAFR2W-ABXTQD64.js.map +0 -1
  37. package/dist/token-6GSAFR2W-TW2P7HCS.cjs +0 -63
  38. package/dist/token-6GSAFR2W-TW2P7HCS.cjs.map +0 -1
  39. package/dist/token-APYSY3BW-2DN6RAUY.js +0 -61
  40. package/dist/token-APYSY3BW-2DN6RAUY.js.map +0 -1
  41. package/dist/token-APYSY3BW-ZQ7TMBY7.cjs +0 -63
  42. package/dist/token-APYSY3BW-ZQ7TMBY7.cjs.map +0 -1
  43. package/dist/token-util-NEHG7TUY-GYFEVMWP.cjs +0 -10
  44. package/dist/token-util-NEHG7TUY-GYFEVMWP.cjs.map +0 -1
  45. package/dist/token-util-NEHG7TUY-XQP3QSPX.js +0 -8
  46. package/dist/token-util-NEHG7TUY-XQP3QSPX.js.map +0 -1
  47. package/dist/token-util-RMHT2CPJ-6TGPE335.cjs +0 -10
  48. package/dist/token-util-RMHT2CPJ-6TGPE335.cjs.map +0 -1
  49. package/dist/token-util-RMHT2CPJ-RJEA3FAN.js +0 -8
  50. package/dist/token-util-RMHT2CPJ-RJEA3FAN.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @mastra/fastembed
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Replace the abandoned `fastembed` npm dependency with a maintained, vendored implementation. The public API and all embedding models remain unchanged — no migration needed. ([#16772](https://github.com/mastra-ai/mastra/pull/16772))
8
+
9
+ ## 1.1.0-alpha.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Replace the abandoned `fastembed` npm dependency with a maintained, vendored implementation. The public API and all embedding models remain unchanged — no migration needed. ([#16772](https://github.com/mastra-ai/mastra/pull/16772))
14
+
3
15
  ## 1.0.1
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Anush
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @mastra/fastembed
2
2
 
3
- This package provides a FastEmbed embedding model integration for use with Mastra Memory.
3
+ Local embedding model integration for Mastra, powered by ONNX Runtime.
4
4
 
5
- **Note:** This functionality was previously included directly within `@mastra/core`. It has been moved to this separate package because `fastembed-js` relies on large native dependencies (like `onnxruntime-node`). Separating it keeps `@mastra/core` lightweight for users who may not need FastEmbed.
5
+ This package is a maintained fork of [fastembed-js](https://github.com/Anush008/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.
6
6
 
7
7
  ## Installation
8
8
 
@@ -10,15 +10,9 @@ This package provides a FastEmbed embedding model integration for use with Mastr
10
10
  pnpm add @mastra/fastembed
11
11
  ```
12
12
 
13
- ## AI SDK v2 Compatibility
14
-
15
- This package supports AI SDK v5 (specification version v2). The default exports use v2, which is compatible with `@mastra/core` and AI SDK v5.
16
-
17
- **Breaking Change:** Previous versions used AI SDK specification v1. If you need v1 compatibility for legacy code, use the `Legacy` exports.
18
-
19
13
  ## Usage
20
14
 
21
- ### Default (AI SDK v2)
15
+ ### Default (AI SDK v3)
22
16
 
23
17
  ```typescript
24
18
  import { Memory } from '@mastra/memory';
@@ -26,11 +20,8 @@ import { fastembed } from '@mastra/fastembed';
26
20
 
27
21
  const memory = new Memory({
28
22
  // ... other memory options
29
- embedder: fastembed, // Uses v2 specification
23
+ embedder: fastembed,
30
24
  });
31
-
32
- // Now you can use this memory instance with an Agent
33
- // const agent = new Agent({ memory, ... });
34
25
  ```
35
26
 
36
27
  ### Available Models
@@ -38,19 +29,23 @@ const memory = new Memory({
38
29
  ```typescript
39
30
  import { fastembed } from '@mastra/fastembed';
40
31
 
41
- // Default export (bge-small-en-v1.5 with v2 spec)
32
+ // Default export (bge-small-en-v1.5 with v3 spec)
42
33
  const embedder = fastembed;
43
34
 
44
- // Named exports for v2 models
35
+ // Named exports for v3 models
45
36
  const small = fastembed.small; // bge-small-en-v1.5
46
37
  const base = fastembed.base; // bge-base-en-v1.5
47
38
 
39
+ // V2 models (for AI SDK v5 compatibility)
40
+ const smallV2 = fastembed.smallV2;
41
+ const baseV2 = fastembed.baseV2;
42
+
48
43
  // Legacy v1 models (for backwards compatibility)
49
44
  const smallLegacy = fastembed.smallLegacy; // bge-small-en-v1.5 (v1 spec)
50
45
  const baseLegacy = fastembed.baseLegacy; // bge-base-en-v1.5 (v1 spec)
51
46
  ```
52
47
 
53
- ### Direct Usage with AI SDK v5
48
+ ### Direct Usage with AI SDK
54
49
 
55
50
  ```typescript
56
51
  import { embed } from 'ai';
@@ -64,4 +59,18 @@ const result = await embed({
64
59
  console.log(result.embedding); // number[]
65
60
  ```
66
61
 
67
- This package wraps the `fastembed-js` library to provide an embedding model compatible with the AI SDK and Mastra.
62
+ ## Supported Models
63
+
64
+ | Model | Dimensions | Description |
65
+ | ----------------------- | ---------- | --------------------------- |
66
+ | `bge-small-en-v1.5` | 384 | Fast, default English model |
67
+ | `bge-base-en-v1.5` | 768 | Base English model |
68
+ | `bge-small-en` | 384 | Fast English model |
69
+ | `bge-base-en` | 768 | Base English model |
70
+ | `bge-small-zh-v1.5` | 512 | Fast Chinese model |
71
+ | `all-MiniLM-L6-v2` | 384 | Sentence Transformer model |
72
+ | `multilingual-e5-large` | 1024 | Multilingual model |
73
+
74
+ ## Attribution
75
+
76
+ The core embedding engine is forked from [fastembed-js](https://github.com/Anush008/fastembed-js) by [Anush008](https://github.com/Anush008), licensed under MIT. See [LICENSE-fastembed](./LICENSE-fastembed) for the original license.