@mastra/rag 2.7.2 → 2.7.3-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.7.2"
6
+ version: "2.7.3-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,6 +1,92 @@
1
1
  {
2
- "version": "2.7.2",
2
+ "version": "2.7.3-alpha.0",
3
3
  "package": "@mastra/rag",
4
- "exports": {},
4
+ "exports": {
5
+ "CohereRelevanceScorer": {
6
+ "types": "dist/rerank/relevance/cohere/index.d.ts",
7
+ "implementation": "dist/index.js",
8
+ "line": 6088
9
+ },
10
+ "GraphRAG": {
11
+ "types": "dist/graph-rag/index.d.ts",
12
+ "implementation": "dist/index.js",
13
+ "line": 6277
14
+ },
15
+ "Language": {
16
+ "types": "dist/document/types.d.ts",
17
+ "implementation": "dist/index.js",
18
+ "line": 3842
19
+ },
20
+ "MDocument": {
21
+ "types": "dist/document/document.d.ts",
22
+ "implementation": "dist/index.js",
23
+ "line": 5821
24
+ },
25
+ "MastraAgentRelevanceScorer": {
26
+ "types": "dist/rerank/relevance/mastra-agent/index.d.ts",
27
+ "implementation": "dist/index.js",
28
+ "line": 6123
29
+ },
30
+ "ZeroEntropyRelevanceScorer": {
31
+ "types": "dist/rerank/relevance/zeroentropy/index.d.ts",
32
+ "implementation": "dist/index.js",
33
+ "line": 6152
34
+ },
35
+ "createBedrockKBTool": {
36
+ "types": "dist/tools/bedrock-knowledge-base.d.ts",
37
+ "implementation": "dist/index.js",
38
+ "line": 7114
39
+ },
40
+ "createDocumentChunkerTool": {
41
+ "types": "dist/tools/document-chunker.d.ts",
42
+ "implementation": "dist/index.js",
43
+ "line": 6498
44
+ },
45
+ "createGraphRAGTool": {
46
+ "types": "dist/tools/graph-rag.d.ts",
47
+ "implementation": "dist/index.js",
48
+ "line": 6820
49
+ },
50
+ "createVectorQueryTool": {
51
+ "types": "dist/tools/vector-query.d.ts",
52
+ "implementation": "dist/index.js",
53
+ "line": 6974
54
+ },
55
+ "defaultGraphRagDescription": {
56
+ "types": "dist/utils/default-settings.d.ts",
57
+ "implementation": "dist/index.js",
58
+ "line": 6645
59
+ },
60
+ "defaultVectorQueryDescription": {
61
+ "types": "dist/utils/default-settings.d.ts",
62
+ "implementation": "dist/index.js",
63
+ "line": 6644
64
+ },
65
+ "filterDescription": {
66
+ "types": "dist/utils/default-settings.d.ts",
67
+ "implementation": "dist/index.js",
68
+ "line": 6664
69
+ },
70
+ "queryTextDescription": {
71
+ "types": "dist/utils/default-settings.d.ts",
72
+ "implementation": "dist/index.js",
73
+ "line": 6646
74
+ },
75
+ "rerank": {
76
+ "types": "dist/rerank/index.d.ts",
77
+ "implementation": "dist/index.js",
78
+ "line": 6264
79
+ },
80
+ "rerankWithScorer": {
81
+ "types": "dist/rerank/index.d.ts",
82
+ "implementation": "dist/index.js",
83
+ "line": 6256
84
+ },
85
+ "topKDescription": {
86
+ "types": "dist/utils/default-settings.d.ts",
87
+ "implementation": "dist/index.js",
88
+ "line": 6654
89
+ }
90
+ },
5
91
  "modules": {}
6
92
  }
@@ -88,14 +88,14 @@ The tool returns an object with:
88
88
  ```typescript
89
89
  {
90
90
  id: string; // Unique chunk/document identifier
91
- metadata: any; // All metadata fields (document ID, etc.)
92
- vector: number[]; // Embedding vector (if available)
91
+ metadata?: any; // All metadata fields (document ID, etc.)
92
+ vector: number[]; // Embedding vector, or [] when unavailable
93
93
  score: number; // Similarity score for this retrieval
94
94
  document: string; // Full chunk/document text (if available)
95
95
  }
96
96
  ```
97
97
 
98
- `document` is only populated by vector stores whose `query()` returns document content, such as Chroma, Elasticsearch, LanceDB, and MongoDB. For other stores, such as PgVector, it's an empty string. Read the chunk text from `sources[i].metadata.text` (or whichever metadata key you stored it under).
98
+ `document` is only populated by vector stores whose `query()` returns document content, such as Chroma, Elasticsearch, LanceDB, and MongoDB. For other stores, such as PgVector, it's an empty string. Read the chunk text from `sources[i].metadata?.text` (or whichever metadata key you stored it under). `metadata` is `undefined` when the store returns no metadata for a result.
99
99
 
100
100
  ## Default tool description
101
101
 
@@ -1 +1 @@
1
- {"version":3,"file":"character.d.ts","sourceRoot":"","sources":["../../../src/document/transformers/character.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAE/F,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAqEzC,qBAAa,oBAAqB,SAAQ,eAAe;IACvD,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAEpC,YAAY,EAAE,SAAkB,EAAE,gBAAwB,EAAE,GAAG,WAAW,EAAE,GAAE,qBAA0B,EAIvG;IAED,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,EAAE,CAmB9C;IAED,OAAO,CAAC,YAAY;CAyDrB;AAED,qBAAa,6BAA8B,SAAQ,eAAe;IAChE,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;IAC/B,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAEpC,YAAY,EAAE,UAAU,EAAE,gBAAwB,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,GAAE,qBAA0B,EAIzG;IAED,OAAO,CAAC,UAAU;IA8DlB,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,EAAE,CAE9C;IAED,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,GAAE,gBAAqB,G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,CAua5D;CACF"}
package/dist/index.cjs CHANGED
@@ -4008,7 +4008,7 @@ var TextTransformer = class {
4008
4008
  };
4009
4009
  // src/document/transformers/character.ts
4010
4010
  function splitTextWithRegex(text, separator, separatorPosition) {
4011
- if (!separator) return text.split("");
4011
+ if (!separator) return Array.from(text);
4012
4012
  if (!text) return [];
4013
4013
  const result = [];
4014
4014
  let lastIndex = 0;