@mastra/rag 2.6.7 → 2.6.8-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.
@@ -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.6.7"
6
+ version: "2.6.8-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.6.7",
2
+ "version": "2.6.8-alpha.0",
3
3
  "package": "@mastra/rag",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -83,7 +83,7 @@ Returns an array of `RankedNode` objects, where each node contains:
83
83
 
84
84
  **content** (`string`): Text content of the document chunk
85
85
 
86
- **metadata** (`Record<string, any>`): Additional metadata associated with the chunk
86
+ **metadata** (`Record<string, any>`): Additional metadata associated with the chunk, when present
87
87
 
88
88
  **score** (`number`): Combined relevance score from graph traversal
89
89
 
@@ -20,9 +20,9 @@ const chunker = createDocumentChunkerTool({
20
20
  doc: document,
21
21
  params: {
22
22
  strategy: 'recursive',
23
- size: 512,
23
+ maxSize: 512,
24
24
  overlap: 50,
25
- separator: '\n',
25
+ separators: ['\n'],
26
26
  },
27
27
  })
28
28
 
@@ -39,11 +39,11 @@ const { chunks } = await chunker.execute()
39
39
 
40
40
  **strategy** (`'recursive'`): The chunking strategy to use (Default: `'recursive'`)
41
41
 
42
- **size** (`number`): Target size of each chunk in tokens/characters (Default: `512`)
42
+ **maxSize** (`number`): Maximum size of each chunk in tokens/characters (Default: `512`)
43
43
 
44
44
  **overlap** (`number`): Number of overlapping tokens/characters between chunks (Default: `50`)
45
45
 
46
- **separator** (`string`): Character(s) to use as chunk separator (Default: `'\n'`)
46
+ **separators** (`string[]`): Separators to split on, in order of priority (recursive strategy) (Default: `['\n']`)
47
47
 
48
48
  ## Returns
49
49
 
@@ -64,9 +64,9 @@ const chunker = createDocumentChunkerTool({
64
64
  doc: technicalDoc,
65
65
  params: {
66
66
  strategy: 'recursive',
67
- size: 1024, // Larger chunks
67
+ maxSize: 1024, // Larger chunks
68
68
  overlap: 100, // More overlap
69
- separator: '\n\n', // Split on double newlines
69
+ separators: ['\n\n'], // Split on double newlines
70
70
  },
71
71
  })
72
72
 
@@ -82,8 +82,8 @@ chunks.forEach((chunk, index) => {
82
82
 
83
83
  The chunker is created as a Mastra tool with the following properties:
84
84
 
85
- - **Tool ID**: `Document Chunker {strategy} {size}`
86
- - **Description**: `Chunks document using {strategy} strategy with size {size} and {overlap} overlap`
85
+ - **Tool ID**: `Document Chunker {strategy} {maxSize}`
86
+ - **Description**: `Chunks document using {strategy} strategy with maxSize {maxSize} and {overlap} overlap`
87
87
  - **Input Schema**: Empty object (no additional inputs required)
88
88
  - **Output Schema**: Object containing the chunks array
89
89
 
@@ -21,13 +21,13 @@ const queryTool = createVectorQueryTool({
21
21
 
22
22
  ## Parameters
23
23
 
24
- > **Note:** **Parameter Requirements:** Most fields can be set at creation as defaults. Some fields can be overridden at runtime via the request context or input. If a required field is missing from both creation and runtime, an error will be thrown. Note that `model`, `id`, and `description` can only be set at creation time.
24
+ > **Note:** **Parameter Requirements:** Most fields can be set at creation as defaults. Some fields can be overridden at runtime via the request context or input. If a required field is missing from both creation and runtime, an error will be thrown. Note that `id` and `description` can only be set at creation time.
25
25
 
26
- **id** (`string`): Custom ID for the tool. By default: 'VectorQuery {vectorStoreName} {indexName} Tool'. (Set at creation only.)
26
+ **id** (`string`): Custom ID for the tool. By default: 'VectorQuery {vectorStoreName} {indexName} Tool', where {vectorStoreName} is 'DirectVectorStore' when a vectorStore instance is passed without a vectorStoreName. (Set at creation only.)
27
27
 
28
28
  **description** (`string`): Custom description for the tool. By default: 'Access the knowledge base to find information needed to answer user questions' (Set at creation only.)
29
29
 
30
- **model** (`EmbeddingModel`): Embedding model to use for vector search. (Set at creation only.)
30
+ **model** (`EmbeddingModel`): Embedding model to use for vector search. (Can be set at creation or overridden at runtime via the request context.)
31
31
 
32
32
  **vectorStoreName** (`string`): Name of the vector store to query. (Can be set at creation or overridden at runtime.)
33
33
 
@@ -47,7 +47,7 @@ const queryTool = createVectorQueryTool({
47
47
 
48
48
  **reranker.options.weights** (`WeightConfig`): Weights for scoring components (semantic: 0.4, vector: 0.4, position: 0.2)
49
49
 
50
- **reranker.options.topK** (`number`): Number of top results to return
50
+ **reranker.options.topK** (`number`): Number of top results to return after reranking. Falls back to the query's topK (from the request context, the tool input, or 10) when unset or 0.
51
51
 
52
52
  **databaseConfig** (`DatabaseConfig`): Database-specific configuration options for optimizing queries. (Can be set at creation or overridden at runtime.)
53
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/rag",
3
- "version": "2.6.7",
3
+ "version": "2.6.8-alpha.0",
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.11",
52
52
  "zod": "^4.6.4",
53
- "@internal/lint": "0.0.142",
54
- "@internal/ai-sdk-v4": "0.0.89",
55
- "@internal/types-builder": "0.0.117",
56
- "@mastra/core": "1.76.0"
53
+ "@internal/lint": "0.0.144",
54
+ "@internal/ai-sdk-v4": "0.0.91",
55
+ "@internal/types-builder": "0.0.119",
56
+ "@mastra/core": "1.78.1-alpha.0"
57
57
  },
58
58
  "keywords": [
59
59
  "rag",