@mastra/rag 2.6.1-alpha.0 → 2.6.1
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/README.md +24 -9
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mastra/rag
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@mastra/rag` provides document chunking, reranking, and graph-based retrieval utilities for retrieval-augmented generation. Use it to prepare source material for embedding and select the most relevant context before an agent generates a response.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,19 +8,34 @@ The Retrieval-Augmented Generation (RAG) module contains document processing and
|
|
|
8
8
|
npm install @mastra/rag
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Usage
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
The `MDocument` class represents text content with associated metadata:
|
|
13
|
+
Create a document and split it into chunks before embedding or indexing the content.
|
|
16
14
|
|
|
17
15
|
```typescript
|
|
18
16
|
import { MDocument } from '@mastra/rag';
|
|
19
17
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const document = MDocument.fromText(`
|
|
19
|
+
# Product guide
|
|
20
|
+
|
|
21
|
+
Mastra provides agents, workflows, memory, and retrieval tools.
|
|
22
|
+
`);
|
|
23
|
+
|
|
24
|
+
const chunks = await document.chunk({
|
|
25
|
+
strategy: 'recursive',
|
|
26
|
+
maxSize: 512,
|
|
27
|
+
overlap: 50,
|
|
23
28
|
});
|
|
24
29
|
```
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
- [@mastra/rag documentation](https://mastra.ai/reference/rag/overview)
|
|
34
|
+
|
|
35
|
+
## Changelog
|
|
36
|
+
|
|
37
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/packages/rag/CHANGELOG.md) for version history and release notes.
|
|
38
|
+
|
|
39
|
+
## Support
|
|
40
|
+
|
|
41
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/dist/docs/SKILL.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/rag",
|
|
3
|
-
"version": "2.6.1
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"typescript": "^7.0.2",
|
|
51
51
|
"vitest": "4.1.10",
|
|
52
52
|
"zod": "^4.4.3",
|
|
53
|
-
"@internal/ai-sdk-v4": "0.0.
|
|
54
|
-
"@internal/lint": "0.0.
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
53
|
+
"@internal/ai-sdk-v4": "0.0.77",
|
|
54
|
+
"@internal/lint": "0.0.130",
|
|
55
|
+
"@internal/types-builder": "0.0.105",
|
|
56
|
+
"@mastra/core": "1.64.0"
|
|
57
57
|
},
|
|
58
58
|
"keywords": [
|
|
59
59
|
"rag",
|