@mastra/rag 2.7.3-alpha.0 → 2.7.3-alpha.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/dist/docs/SKILL.md +1 -2
- package/dist/docs/assets/SOURCE_MAP.json +13 -13
- package/dist/docs/references/reference-rag-graph-rag.md +1 -1
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/rerank/index.d.ts.map +1 -1
- package/dist/utils/tool-helpers.d.ts +3 -3
- package/dist/utils/tool-helpers.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/docs/references/reference-migrations-upgrade-to-v1-rag.md +0 -46
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-rag
|
|
|
3
3
|
description: Documentation for @mastra/rag. Use when working with @mastra/rag APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/rag"
|
|
6
|
-
version: "2.7.3-alpha.
|
|
6
|
+
version: "2.7.3-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -20,7 +20,6 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
20
20
|
|
|
21
21
|
### Reference
|
|
22
22
|
|
|
23
|
-
- [RAG](references/reference-migrations-upgrade-to-v1-rag.md) - Migrate RAG code to Mastra v1 with renamed chunking parameters and narrowed option types, including updates to related document-processing APIs.
|
|
24
23
|
- [Reference: .chunk()](references/reference-rag-chunk.md) - The .chunk() function splits documents into smaller segments using strategies and options.
|
|
25
24
|
- [Chunking and embedding documents](references/reference-rag-chunking-and-embedding.md) - Chunk documents with MDocument, generate embeddings through the AI SDK, and prepare text and metadata for vector storage and RAG retrieval.
|
|
26
25
|
- [Reference: DatabaseConfig](references/reference-rag-database-config.md) - The DatabaseConfig type allows you to specify database-specific configurations when using vector query tools.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.7.3-alpha.
|
|
2
|
+
"version": "2.7.3-alpha.1",
|
|
3
3
|
"package": "@mastra/rag",
|
|
4
4
|
"exports": {
|
|
5
5
|
"CohereRelevanceScorer": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"GraphRAG": {
|
|
11
11
|
"types": "dist/graph-rag/index.d.ts",
|
|
12
12
|
"implementation": "dist/index.js",
|
|
13
|
-
"line":
|
|
13
|
+
"line": 6285
|
|
14
14
|
},
|
|
15
15
|
"Language": {
|
|
16
16
|
"types": "dist/document/types.d.ts",
|
|
@@ -35,57 +35,57 @@
|
|
|
35
35
|
"createBedrockKBTool": {
|
|
36
36
|
"types": "dist/tools/bedrock-knowledge-base.d.ts",
|
|
37
37
|
"implementation": "dist/index.js",
|
|
38
|
-
"line":
|
|
38
|
+
"line": 7115
|
|
39
39
|
},
|
|
40
40
|
"createDocumentChunkerTool": {
|
|
41
41
|
"types": "dist/tools/document-chunker.d.ts",
|
|
42
42
|
"implementation": "dist/index.js",
|
|
43
|
-
"line":
|
|
43
|
+
"line": 6506
|
|
44
44
|
},
|
|
45
45
|
"createGraphRAGTool": {
|
|
46
46
|
"types": "dist/tools/graph-rag.d.ts",
|
|
47
47
|
"implementation": "dist/index.js",
|
|
48
|
-
"line":
|
|
48
|
+
"line": 6821
|
|
49
49
|
},
|
|
50
50
|
"createVectorQueryTool": {
|
|
51
51
|
"types": "dist/tools/vector-query.d.ts",
|
|
52
52
|
"implementation": "dist/index.js",
|
|
53
|
-
"line":
|
|
53
|
+
"line": 6975
|
|
54
54
|
},
|
|
55
55
|
"defaultGraphRagDescription": {
|
|
56
56
|
"types": "dist/utils/default-settings.d.ts",
|
|
57
57
|
"implementation": "dist/index.js",
|
|
58
|
-
"line":
|
|
58
|
+
"line": 6653
|
|
59
59
|
},
|
|
60
60
|
"defaultVectorQueryDescription": {
|
|
61
61
|
"types": "dist/utils/default-settings.d.ts",
|
|
62
62
|
"implementation": "dist/index.js",
|
|
63
|
-
"line":
|
|
63
|
+
"line": 6652
|
|
64
64
|
},
|
|
65
65
|
"filterDescription": {
|
|
66
66
|
"types": "dist/utils/default-settings.d.ts",
|
|
67
67
|
"implementation": "dist/index.js",
|
|
68
|
-
"line":
|
|
68
|
+
"line": 6672
|
|
69
69
|
},
|
|
70
70
|
"queryTextDescription": {
|
|
71
71
|
"types": "dist/utils/default-settings.d.ts",
|
|
72
72
|
"implementation": "dist/index.js",
|
|
73
|
-
"line":
|
|
73
|
+
"line": 6654
|
|
74
74
|
},
|
|
75
75
|
"rerank": {
|
|
76
76
|
"types": "dist/rerank/index.d.ts",
|
|
77
77
|
"implementation": "dist/index.js",
|
|
78
|
-
"line":
|
|
78
|
+
"line": 6272
|
|
79
79
|
},
|
|
80
80
|
"rerankWithScorer": {
|
|
81
81
|
"types": "dist/rerank/index.d.ts",
|
|
82
82
|
"implementation": "dist/index.js",
|
|
83
|
-
"line":
|
|
83
|
+
"line": 6264
|
|
84
84
|
},
|
|
85
85
|
"topKDescription": {
|
|
86
86
|
"types": "dist/utils/default-settings.d.ts",
|
|
87
87
|
"implementation": "dist/index.js",
|
|
88
|
-
"line":
|
|
88
|
+
"line": 6662
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"modules": {}
|
|
@@ -103,7 +103,7 @@ serialize(): GraphRAGSnapshot
|
|
|
103
103
|
|
|
104
104
|
Returns a `GraphRAGSnapshot` object containing:
|
|
105
105
|
|
|
106
|
-
**version** (`
|
|
106
|
+
**version** (`1`): Snapshot format version. Always 1 in the current format, so deserialize rejects snapshots with any other version
|
|
107
107
|
|
|
108
108
|
**dimension** (`number`): Dimension of the embedding vectors the graph was built with
|
|
109
109
|
|
package/dist/index.cjs
CHANGED
|
@@ -6219,6 +6219,14 @@ async function executeRerank({ results, query, scorer, options }) {
|
|
|
6219
6219
|
});
|
|
6220
6220
|
throw err;
|
|
6221
6221
|
}
|
|
6222
|
+
if (!Number.isInteger(topK) || topK < 0) {
|
|
6223
|
+
const err = /* @__PURE__ */ new Error(`topK must be a nonnegative integer. Got ${topK}`);
|
|
6224
|
+
rerankSpan?.error({
|
|
6225
|
+
error: err,
|
|
6226
|
+
endSpan: true
|
|
6227
|
+
});
|
|
6228
|
+
throw err;
|
|
6229
|
+
}
|
|
6222
6230
|
const resultLength = results.length;
|
|
6223
6231
|
const queryAnalysis = queryEmbedding ? analyzeQueryEmbedding(queryEmbedding) : null;
|
|
6224
6232
|
let scoredResults;
|
|
@@ -6752,15 +6760,8 @@ async function resolveVectorStore(options, context, logger) {
|
|
|
6752
6760
|
if (mastra) return mastra.getVector(vectorStoreName);
|
|
6753
6761
|
}
|
|
6754
6762
|
function coerceTopK(topK, defaultValue = 10) {
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
return defaultValue;
|
|
6758
|
-
}
|
|
6759
|
-
if (typeof topK === "string") {
|
|
6760
|
-
const parsed = Number(topK);
|
|
6761
|
-
if (Number.isFinite(parsed) && parsed > 0) return parsed;
|
|
6762
|
-
return defaultValue;
|
|
6763
|
-
}
|
|
6763
|
+
const parsed = typeof topK === "string" ? Number(topK) : topK;
|
|
6764
|
+
if (typeof parsed === "number" && Number.isFinite(parsed) && Math.floor(parsed) >= 1) return Math.floor(parsed);
|
|
6764
6765
|
return defaultValue;
|
|
6765
6766
|
}
|
|
6766
6767
|
function parseFilterValue(filter, logger) {
|