@mastra/fastembed 1.0.1 → 1.1.0-alpha.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.
- package/CHANGELOG.md +6 -0
- package/LICENSE-fastembed +21 -0
- package/README.md +26 -17
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +466 -1768
- package/dist/fastembed.d.ts +115 -0
- package/dist/fastembed.d.ts.map +1 -0
- package/dist/index.cjs +1801 -691
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1790 -690
- package/dist/index.js.map +1 -1
- package/package.json +22 -15
- package/LICENSE.md +0 -30
- package/dist/chunk-23EXJLET.cjs +0 -84
- package/dist/chunk-23EXJLET.cjs.map +0 -1
- package/dist/chunk-BSDWQEU3.js +0 -79
- package/dist/chunk-BSDWQEU3.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -10
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-EQ4M72KU.js +0 -439
- package/dist/chunk-EQ4M72KU.js.map +0 -1
- package/dist/chunk-HJYHDIOC.js +0 -250
- package/dist/chunk-HJYHDIOC.js.map +0 -1
- package/dist/chunk-IDRQZVB4.cjs +0 -84
- package/dist/chunk-IDRQZVB4.cjs.map +0 -1
- package/dist/chunk-JEQ2X3Z6.cjs +0 -12
- package/dist/chunk-JEQ2X3Z6.cjs.map +0 -1
- package/dist/chunk-LIBOSOHM.cjs +0 -252
- package/dist/chunk-LIBOSOHM.cjs.map +0 -1
- package/dist/chunk-RC6RZVYE.js +0 -79
- package/dist/chunk-RC6RZVYE.js.map +0 -1
- package/dist/chunk-ZD3BKU5O.cjs +0 -441
- package/dist/chunk-ZD3BKU5O.cjs.map +0 -1
- package/dist/token-6GSAFR2W-ABXTQD64.js +0 -61
- package/dist/token-6GSAFR2W-ABXTQD64.js.map +0 -1
- package/dist/token-6GSAFR2W-TW2P7HCS.cjs +0 -63
- package/dist/token-6GSAFR2W-TW2P7HCS.cjs.map +0 -1
- package/dist/token-APYSY3BW-2DN6RAUY.js +0 -61
- package/dist/token-APYSY3BW-2DN6RAUY.js.map +0 -1
- package/dist/token-APYSY3BW-ZQ7TMBY7.cjs +0 -63
- package/dist/token-APYSY3BW-ZQ7TMBY7.cjs.map +0 -1
- package/dist/token-util-NEHG7TUY-GYFEVMWP.cjs +0 -10
- package/dist/token-util-NEHG7TUY-GYFEVMWP.cjs.map +0 -1
- package/dist/token-util-NEHG7TUY-XQP3QSPX.js +0 -8
- package/dist/token-util-NEHG7TUY-XQP3QSPX.js.map +0 -1
- package/dist/token-util-RMHT2CPJ-6TGPE335.cjs +0 -10
- package/dist/token-util-RMHT2CPJ-6TGPE335.cjs.map +0 -1
- package/dist/token-util-RMHT2CPJ-RJEA3FAN.js +0 -8
- package/dist/token-util-RMHT2CPJ-RJEA3FAN.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mastra/fastembed
|
|
2
2
|
|
|
3
|
+
## 1.1.0-alpha.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
|
+
|
|
3
9
|
## 1.0.1
|
|
4
10
|
|
|
5
11
|
### 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
|
-
|
|
3
|
+
Local embedding model integration for Mastra, powered by ONNX Runtime.
|
|
4
4
|
|
|
5
|
-
|
|
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
|
|
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,
|
|
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
|
|
32
|
+
// Default export (bge-small-en-v1.5 with v3 spec)
|
|
42
33
|
const embedder = fastembed;
|
|
43
34
|
|
|
44
|
-
// Named exports for
|
|
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
|
|
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
|
-
|
|
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.
|