@mastra/rag 0.1.23 → 0.2.0-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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +36 -0
- package/dist/_tsup-dts-rollup.d.cts +263 -5
- package/dist/_tsup-dts-rollup.d.ts +263 -5
- package/dist/index.cjs +92 -13
- package/dist/index.js +92 -13
- package/package.json +8 -5
- package/src/graph-rag/index.ts +1 -1
- package/src/rerank/index.ts +4 -3
- package/src/tools/graph-rag.ts +23 -3
- package/src/tools/vector-query.ts +28 -4
- package/src/utils/convert-sources.ts +43 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/rag@0.
|
|
2
|
+
> @mastra/rag@0.2.0-alpha.1 build /home/runner/work/mastra/mastra/packages/rag
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 13960ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/rag/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/rag/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 14823ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m238.92 KB[39m
|
|
21
|
+
[32mESM[39m ⚡️ Build success in 4442ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m240.69 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 4451ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @mastra/rag
|
|
2
2
|
|
|
3
|
+
## 0.2.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 83da932: Move @mastra/core to peerdeps
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 4424836: [MASTRA-2591] Rag Tool Return Types
|
|
12
|
+
- 8cdd799: [MASTRA-3078] added sources to return for vector query tool
|
|
13
|
+
- 4f62987: update rerank weight sum to use big.js
|
|
14
|
+
- Updated dependencies [b3a3d63]
|
|
15
|
+
- Updated dependencies [344f453]
|
|
16
|
+
- Updated dependencies [0a3ae6d]
|
|
17
|
+
- Updated dependencies [95911be]
|
|
18
|
+
- Updated dependencies [5eb5a99]
|
|
19
|
+
- Updated dependencies [7e632c5]
|
|
20
|
+
- Updated dependencies [1e9fbfa]
|
|
21
|
+
- Updated dependencies [b2ae5aa]
|
|
22
|
+
- Updated dependencies [a7292b0]
|
|
23
|
+
- Updated dependencies [0dcb9f0]
|
|
24
|
+
- @mastra/core@0.10.0-alpha.1
|
|
25
|
+
|
|
26
|
+
## 0.1.24-alpha.0
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [f53a6ac]
|
|
31
|
+
- Updated dependencies [eabdcd9]
|
|
32
|
+
- Updated dependencies [90be034]
|
|
33
|
+
- Updated dependencies [99f050a]
|
|
34
|
+
- Updated dependencies [d0ee3c6]
|
|
35
|
+
- Updated dependencies [23f258c]
|
|
36
|
+
- Updated dependencies [2672a05]
|
|
37
|
+
- @mastra/core@0.9.5-alpha.0
|
|
38
|
+
|
|
3
39
|
## 0.1.23
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
|
@@ -3,9 +3,13 @@ import type { EmbeddingModel } from 'ai';
|
|
|
3
3
|
import type { MastraLanguageModel } from '@mastra/core/agent';
|
|
4
4
|
import type { MastraVector } from '@mastra/core/vector';
|
|
5
5
|
import type { QueryResult } from '@mastra/core/vector';
|
|
6
|
+
import type { QueryResult as QueryResult_2 } from '@mastra/core';
|
|
6
7
|
import type { TiktokenEncoding } from 'js-tiktoken';
|
|
7
8
|
import type { TiktokenModel } from 'js-tiktoken';
|
|
9
|
+
import { Tool } from '@mastra/core/tools';
|
|
10
|
+
import { ToolExecutionContext } from '@mastra/core';
|
|
8
11
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
12
|
+
import { z } from 'zod';
|
|
9
13
|
|
|
10
14
|
/** @deprecated Import from @mastra/astra instead */
|
|
11
15
|
declare const ASTRA_PROMPT = "When querying Astra, you can ONLY use the operators listed below. Any other operators will be rejected.\nImportant: Don't explain how to construct the filter - use the specified operators and fields to search the content and return relevant results.\nIf a user tries to give an explicit operator that is not supported, reject the filter entirely and let them know that the operator is not supported.\n\nBasic Comparison Operators:\n- $eq: Exact match (default when using field: value)\n Example: { \"category\": \"electronics\" }\n- $ne: Not equal\n Example: { \"category\": { \"$ne\": \"electronics\" } }\n- $gt: Greater than\n Example: { \"price\": { \"$gt\": 100 } }\n- $gte: Greater than or equal\n Example: { \"price\": { \"$gte\": 100 } }\n- $lt: Less than\n Example: { \"price\": { \"$lt\": 100 } }\n- $lte: Less than or equal\n Example: { \"price\": { \"$lte\": 100 } }\n\nArray Operators:\n- $in: Match any value in array\n Example: { \"category\": { \"$in\": [\"electronics\", \"books\"] } }\n- $nin: Does not match any value in array\n Example: { \"category\": { \"$nin\": [\"electronics\", \"books\"] } }\n- $all: Match all values in array\n Example: { \"tags\": { \"$all\": [\"premium\", \"sale\"] } }\n\nLogical Operators:\n- $and: Logical AND (can be implicit or explicit)\n Implicit Example: { \"price\": { \"$gt\": 100 }, \"category\": \"electronics\" }\n Explicit Example: { \"$and\": [{ \"price\": { \"$gt\": 100 } }, { \"category\": \"electronics\" }] }\n- $or: Logical OR\n Example: { \"$or\": [{ \"price\": { \"$lt\": 50 } }, { \"category\": \"books\" }] }\n- $not: Logical NOT\n Example: { \"$not\": { \"category\": \"electronics\" } }\n\nElement Operators:\n- $exists: Check if field exists\n Example: { \"rating\": { \"$exists\": true } }\n\nSpecial Operators:\n- $size: Array length check\n Example: { \"tags\": { \"$size\": 2 } }\n\nRestrictions:\n- Regex patterns are not supported\n- Only $and, $or, and $not logical operators are supported\n- Nested fields are supported using dot notation\n- Multiple conditions on the same field are supported with both implicit and explicit $and\n- Empty arrays in $in/$nin will return no results\n- A non-empty array is required for $all operator\n- Only logical operators ($and, $or, $not) can be used at the top level\n- All other operators must be used within a field condition\n Valid: { \"field\": { \"$gt\": 100 } }\n Valid: { \"$and\": [...] }\n Invalid: { \"$gt\": 100 }\n- Logical operators must contain field conditions, not direct operators\n Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n Invalid: { \"$and\": [{ \"$gt\": 100 }] }\n- $not operator:\n - Must be an object\n - Cannot be empty\n - Can be used at field level or top level\n - Valid: { \"$not\": { \"field\": \"value\" } }\n - Valid: { \"field\": { \"$not\": { \"$eq\": \"value\" } } }\n- Other logical operators ($and, $or):\n - Can only be used at top level or nested within other logical operators\n - Can not be used on a field level, or be nested inside a field\n - Can not be used inside an operator\n - Valid: { \"$and\": [{ \"field\": { \"$gt\": 100 } }] }\n - Valid: { \"$or\": [{ \"$and\": [{ \"field\": { \"$gt\": 100 } }] }] }\n - Invalid: { \"field\": { \"$and\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$or\": [{ \"$gt\": 100 }] } }\n - Invalid: { \"field\": { \"$gt\": { \"$and\": [{...}] } } }\n\nExample Complex Query:\n{\n \"$and\": [\n { \"category\": { \"$in\": [\"electronics\", \"computers\"] } },\n { \"price\": { \"$gte\": 100, \"$lte\": 1000 } },\n { \"tags\": { \"$all\": [\"premium\"] } },\n { \"rating\": { \"$exists\": true, \"$gt\": 4 } },\n { \"$or\": [\n { \"stock\": { \"$gt\": 0 } },\n { \"preorder\": true }\n ]}\n ]\n}";
|
|
@@ -143,6 +147,19 @@ declare type ChunkStrategy = 'recursive' | 'character' | 'token' | 'markdown' |
|
|
|
143
147
|
export { ChunkStrategy }
|
|
144
148
|
export { ChunkStrategy as ChunkStrategy_alias_1 }
|
|
145
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Convert an array of source inputs (QueryResult, RankedNode, or RerankResult) to an array of sources.
|
|
152
|
+
* @param results Array of source inputs to convert.
|
|
153
|
+
* @returns Array of sources.
|
|
154
|
+
*/
|
|
155
|
+
export declare const convertToSources: (results: SourceInput[]) => {
|
|
156
|
+
id: string;
|
|
157
|
+
vector: number[];
|
|
158
|
+
score: number;
|
|
159
|
+
metadata: Record<string, any> | undefined;
|
|
160
|
+
document: string;
|
|
161
|
+
}[];
|
|
162
|
+
|
|
146
163
|
declare const createDocumentChunkerTool: ({ doc, params, }: {
|
|
147
164
|
doc: MDocument;
|
|
148
165
|
params?: ChunkParams;
|
|
@@ -151,11 +168,12 @@ export { createDocumentChunkerTool }
|
|
|
151
168
|
export { createDocumentChunkerTool as createDocumentChunkerTool_alias_1 }
|
|
152
169
|
export { createDocumentChunkerTool as createDocumentChunkerTool_alias_2 }
|
|
153
170
|
|
|
154
|
-
declare const createGraphRAGTool: ({ vectorStoreName, indexName, model, enableFilter, graphOptions, id, description, }: {
|
|
171
|
+
declare const createGraphRAGTool: ({ vectorStoreName, indexName, model, enableFilter, includeSources, graphOptions, id, description, }: {
|
|
155
172
|
vectorStoreName: string;
|
|
156
173
|
indexName: string;
|
|
157
174
|
model: EmbeddingModel<string>;
|
|
158
175
|
enableFilter?: boolean;
|
|
176
|
+
includeSources?: boolean;
|
|
159
177
|
graphOptions?: {
|
|
160
178
|
dimension?: number;
|
|
161
179
|
randomWalkSteps?: number;
|
|
@@ -164,20 +182,258 @@ declare const createGraphRAGTool: ({ vectorStoreName, indexName, model, enableFi
|
|
|
164
182
|
};
|
|
165
183
|
id?: string;
|
|
166
184
|
description?: string;
|
|
167
|
-
}) =>
|
|
185
|
+
}) => Tool<z.ZodObject<{
|
|
186
|
+
queryText: z.ZodString;
|
|
187
|
+
topK: z.ZodNumber;
|
|
188
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
189
|
+
queryText: z.ZodString;
|
|
190
|
+
topK: z.ZodNumber;
|
|
191
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
192
|
+
queryText: z.ZodString;
|
|
193
|
+
topK: z.ZodNumber;
|
|
194
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
195
|
+
relevantContext: z.ZodAny;
|
|
196
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
197
|
+
id: z.ZodString;
|
|
198
|
+
metadata: z.ZodAny;
|
|
199
|
+
vector: z.ZodArray<z.ZodNumber, "many">;
|
|
200
|
+
score: z.ZodNumber;
|
|
201
|
+
document: z.ZodString;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
id: string;
|
|
204
|
+
vector: number[];
|
|
205
|
+
score: number;
|
|
206
|
+
document: string;
|
|
207
|
+
metadata?: any;
|
|
208
|
+
}, {
|
|
209
|
+
id: string;
|
|
210
|
+
vector: number[];
|
|
211
|
+
score: number;
|
|
212
|
+
document: string;
|
|
213
|
+
metadata?: any;
|
|
214
|
+
}>, "many">;
|
|
215
|
+
}, "strip", z.ZodTypeAny, {
|
|
216
|
+
sources: {
|
|
217
|
+
id: string;
|
|
218
|
+
vector: number[];
|
|
219
|
+
score: number;
|
|
220
|
+
document: string;
|
|
221
|
+
metadata?: any;
|
|
222
|
+
}[];
|
|
223
|
+
relevantContext?: any;
|
|
224
|
+
}, {
|
|
225
|
+
sources: {
|
|
226
|
+
id: string;
|
|
227
|
+
vector: number[];
|
|
228
|
+
score: number;
|
|
229
|
+
document: string;
|
|
230
|
+
metadata?: any;
|
|
231
|
+
}[];
|
|
232
|
+
relevantContext?: any;
|
|
233
|
+
}>, ToolExecutionContext<z.ZodObject<{
|
|
234
|
+
queryText: z.ZodString;
|
|
235
|
+
topK: z.ZodNumber;
|
|
236
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
237
|
+
queryText: z.ZodString;
|
|
238
|
+
topK: z.ZodNumber;
|
|
239
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
240
|
+
queryText: z.ZodString;
|
|
241
|
+
topK: z.ZodNumber;
|
|
242
|
+
}, z.ZodTypeAny, "passthrough">>>> & {
|
|
243
|
+
inputSchema: z.ZodObject<{
|
|
244
|
+
queryText: z.ZodString;
|
|
245
|
+
topK: z.ZodNumber;
|
|
246
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
247
|
+
queryText: z.ZodString;
|
|
248
|
+
topK: z.ZodNumber;
|
|
249
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
250
|
+
queryText: z.ZodString;
|
|
251
|
+
topK: z.ZodNumber;
|
|
252
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
253
|
+
outputSchema: z.ZodObject<{
|
|
254
|
+
relevantContext: z.ZodAny;
|
|
255
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
256
|
+
id: z.ZodString;
|
|
257
|
+
metadata: z.ZodAny;
|
|
258
|
+
vector: z.ZodArray<z.ZodNumber, "many">;
|
|
259
|
+
score: z.ZodNumber;
|
|
260
|
+
document: z.ZodString;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
id: string;
|
|
263
|
+
vector: number[];
|
|
264
|
+
score: number;
|
|
265
|
+
document: string;
|
|
266
|
+
metadata?: any;
|
|
267
|
+
}, {
|
|
268
|
+
id: string;
|
|
269
|
+
vector: number[];
|
|
270
|
+
score: number;
|
|
271
|
+
document: string;
|
|
272
|
+
metadata?: any;
|
|
273
|
+
}>, "many">;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
sources: {
|
|
276
|
+
id: string;
|
|
277
|
+
vector: number[];
|
|
278
|
+
score: number;
|
|
279
|
+
document: string;
|
|
280
|
+
metadata?: any;
|
|
281
|
+
}[];
|
|
282
|
+
relevantContext?: any;
|
|
283
|
+
}, {
|
|
284
|
+
sources: {
|
|
285
|
+
id: string;
|
|
286
|
+
vector: number[];
|
|
287
|
+
score: number;
|
|
288
|
+
document: string;
|
|
289
|
+
metadata?: any;
|
|
290
|
+
}[];
|
|
291
|
+
relevantContext?: any;
|
|
292
|
+
}>;
|
|
293
|
+
execute: (context: ToolExecutionContext<z.ZodObject<{
|
|
294
|
+
queryText: z.ZodString;
|
|
295
|
+
topK: z.ZodNumber;
|
|
296
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
297
|
+
queryText: z.ZodString;
|
|
298
|
+
topK: z.ZodNumber;
|
|
299
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
300
|
+
queryText: z.ZodString;
|
|
301
|
+
topK: z.ZodNumber;
|
|
302
|
+
}, z.ZodTypeAny, "passthrough">>>) => Promise<any>;
|
|
303
|
+
};
|
|
168
304
|
export { createGraphRAGTool }
|
|
169
305
|
export { createGraphRAGTool as createGraphRAGTool_alias_1 }
|
|
170
306
|
export { createGraphRAGTool as createGraphRAGTool_alias_2 }
|
|
171
307
|
|
|
172
|
-
declare const createVectorQueryTool: ({ vectorStoreName, indexName, model, enableFilter, reranker, id, description, }: {
|
|
308
|
+
declare const createVectorQueryTool: ({ vectorStoreName, indexName, model, enableFilter, includeVectors, includeSources, reranker, id, description, }: {
|
|
173
309
|
vectorStoreName: string;
|
|
174
310
|
indexName: string;
|
|
175
311
|
model: EmbeddingModel<string>;
|
|
176
312
|
enableFilter?: boolean;
|
|
313
|
+
includeVectors?: boolean;
|
|
314
|
+
includeSources?: boolean;
|
|
177
315
|
reranker?: RerankConfig;
|
|
178
316
|
id?: string;
|
|
179
317
|
description?: string;
|
|
180
|
-
}) =>
|
|
318
|
+
}) => Tool<z.ZodObject<{
|
|
319
|
+
queryText: z.ZodString;
|
|
320
|
+
topK: z.ZodNumber;
|
|
321
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
322
|
+
queryText: z.ZodString;
|
|
323
|
+
topK: z.ZodNumber;
|
|
324
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
325
|
+
queryText: z.ZodString;
|
|
326
|
+
topK: z.ZodNumber;
|
|
327
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
328
|
+
relevantContext: z.ZodAny;
|
|
329
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
330
|
+
id: z.ZodString;
|
|
331
|
+
metadata: z.ZodAny;
|
|
332
|
+
vector: z.ZodArray<z.ZodNumber, "many">;
|
|
333
|
+
score: z.ZodNumber;
|
|
334
|
+
document: z.ZodString;
|
|
335
|
+
}, "strip", z.ZodTypeAny, {
|
|
336
|
+
id: string;
|
|
337
|
+
vector: number[];
|
|
338
|
+
score: number;
|
|
339
|
+
document: string;
|
|
340
|
+
metadata?: any;
|
|
341
|
+
}, {
|
|
342
|
+
id: string;
|
|
343
|
+
vector: number[];
|
|
344
|
+
score: number;
|
|
345
|
+
document: string;
|
|
346
|
+
metadata?: any;
|
|
347
|
+
}>, "many">;
|
|
348
|
+
}, "strip", z.ZodTypeAny, {
|
|
349
|
+
sources: {
|
|
350
|
+
id: string;
|
|
351
|
+
vector: number[];
|
|
352
|
+
score: number;
|
|
353
|
+
document: string;
|
|
354
|
+
metadata?: any;
|
|
355
|
+
}[];
|
|
356
|
+
relevantContext?: any;
|
|
357
|
+
}, {
|
|
358
|
+
sources: {
|
|
359
|
+
id: string;
|
|
360
|
+
vector: number[];
|
|
361
|
+
score: number;
|
|
362
|
+
document: string;
|
|
363
|
+
metadata?: any;
|
|
364
|
+
}[];
|
|
365
|
+
relevantContext?: any;
|
|
366
|
+
}>, ToolExecutionContext<z.ZodObject<{
|
|
367
|
+
queryText: z.ZodString;
|
|
368
|
+
topK: z.ZodNumber;
|
|
369
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
370
|
+
queryText: z.ZodString;
|
|
371
|
+
topK: z.ZodNumber;
|
|
372
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
373
|
+
queryText: z.ZodString;
|
|
374
|
+
topK: z.ZodNumber;
|
|
375
|
+
}, z.ZodTypeAny, "passthrough">>>> & {
|
|
376
|
+
inputSchema: z.ZodObject<{
|
|
377
|
+
queryText: z.ZodString;
|
|
378
|
+
topK: z.ZodNumber;
|
|
379
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
380
|
+
queryText: z.ZodString;
|
|
381
|
+
topK: z.ZodNumber;
|
|
382
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
383
|
+
queryText: z.ZodString;
|
|
384
|
+
topK: z.ZodNumber;
|
|
385
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
386
|
+
outputSchema: z.ZodObject<{
|
|
387
|
+
relevantContext: z.ZodAny;
|
|
388
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
389
|
+
id: z.ZodString;
|
|
390
|
+
metadata: z.ZodAny;
|
|
391
|
+
vector: z.ZodArray<z.ZodNumber, "many">;
|
|
392
|
+
score: z.ZodNumber;
|
|
393
|
+
document: z.ZodString;
|
|
394
|
+
}, "strip", z.ZodTypeAny, {
|
|
395
|
+
id: string;
|
|
396
|
+
vector: number[];
|
|
397
|
+
score: number;
|
|
398
|
+
document: string;
|
|
399
|
+
metadata?: any;
|
|
400
|
+
}, {
|
|
401
|
+
id: string;
|
|
402
|
+
vector: number[];
|
|
403
|
+
score: number;
|
|
404
|
+
document: string;
|
|
405
|
+
metadata?: any;
|
|
406
|
+
}>, "many">;
|
|
407
|
+
}, "strip", z.ZodTypeAny, {
|
|
408
|
+
sources: {
|
|
409
|
+
id: string;
|
|
410
|
+
vector: number[];
|
|
411
|
+
score: number;
|
|
412
|
+
document: string;
|
|
413
|
+
metadata?: any;
|
|
414
|
+
}[];
|
|
415
|
+
relevantContext?: any;
|
|
416
|
+
}, {
|
|
417
|
+
sources: {
|
|
418
|
+
id: string;
|
|
419
|
+
vector: number[];
|
|
420
|
+
score: number;
|
|
421
|
+
document: string;
|
|
422
|
+
metadata?: any;
|
|
423
|
+
}[];
|
|
424
|
+
relevantContext?: any;
|
|
425
|
+
}>;
|
|
426
|
+
execute: (context: ToolExecutionContext<z.ZodObject<{
|
|
427
|
+
queryText: z.ZodString;
|
|
428
|
+
topK: z.ZodNumber;
|
|
429
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
430
|
+
queryText: z.ZodString;
|
|
431
|
+
topK: z.ZodNumber;
|
|
432
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
433
|
+
queryText: z.ZodString;
|
|
434
|
+
topK: z.ZodNumber;
|
|
435
|
+
}, z.ZodTypeAny, "passthrough">>>) => Promise<any>;
|
|
436
|
+
};
|
|
181
437
|
export { createVectorQueryTool }
|
|
182
438
|
export { createVectorQueryTool as createVectorQueryTool_alias_1 }
|
|
183
439
|
export { createVectorQueryTool as createVectorQueryTool_alias_2 }
|
|
@@ -622,7 +878,7 @@ declare class QuestionsAnsweredExtractor extends BaseExtractor {
|
|
|
622
878
|
export { QuestionsAnsweredExtractor }
|
|
623
879
|
export { QuestionsAnsweredExtractor as QuestionsAnsweredExtractor_alias_1 }
|
|
624
880
|
|
|
625
|
-
declare interface RankedNode extends GraphNode {
|
|
881
|
+
export declare interface RankedNode extends GraphNode {
|
|
626
882
|
score: number;
|
|
627
883
|
}
|
|
628
884
|
|
|
@@ -796,6 +1052,8 @@ declare interface ScoringDetails {
|
|
|
796
1052
|
};
|
|
797
1053
|
}
|
|
798
1054
|
|
|
1055
|
+
declare type SourceInput = QueryResult_2 | RankedNode | RerankResult;
|
|
1056
|
+
|
|
799
1057
|
export declare function splitTextOnTokens({ text, tokenizer }: {
|
|
800
1058
|
text: string;
|
|
801
1059
|
tokenizer: Tokenizer;
|