@memorylayerai/vercel-ai 0.2.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.
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/dist/index.cjs +313 -0
- package/dist/index.d.cts +554 -0
- package/dist/index.d.ts +554 -0
- package/dist/index.js +280 -0
- package/package.json +48 -0
- package/src/graph.ts +250 -0
- package/src/index.ts +20 -0
- package/src/provider.ts +154 -0
- package/src/tools.ts +133 -0
- package/tests/graph.test.ts +316 -0
- package/tsconfig.json +27 -0
- package/vitest.config.ts +13 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as ai from 'ai';
|
|
3
|
+
import { MemoryLayerClient as MemoryLayerClient$1 } from '@memorylayerai/sdk';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for the MemoryLayer client
|
|
7
|
+
*/
|
|
8
|
+
interface ClientConfig {
|
|
9
|
+
/** API key for authentication (can also be set via MEMORYLAYER_API_KEY env var) */
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Base URL for the API (default: https://api.memorylayer.com) */
|
|
12
|
+
baseURL?: string;
|
|
13
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
14
|
+
timeout?: number;
|
|
15
|
+
/** Maximum number of retry attempts (default: 3) */
|
|
16
|
+
maxRetries?: number;
|
|
17
|
+
/** Initial retry delay in milliseconds (default: 1000) */
|
|
18
|
+
retryDelay?: number;
|
|
19
|
+
/** Custom headers to include in all requests */
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
/** Logger for debugging */
|
|
22
|
+
logger?: {
|
|
23
|
+
debug(message: string, ...args: any[]): void;
|
|
24
|
+
info(message: string, ...args: any[]): void;
|
|
25
|
+
warn(message: string, ...args: any[]): void;
|
|
26
|
+
error(message: string, ...args: any[]): void;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Main MemoryLayer SDK client
|
|
31
|
+
*/
|
|
32
|
+
declare class MemoryLayerClient {
|
|
33
|
+
private httpClient;
|
|
34
|
+
private _memories?;
|
|
35
|
+
private _search?;
|
|
36
|
+
private _ingest?;
|
|
37
|
+
private _router?;
|
|
38
|
+
private _graph?;
|
|
39
|
+
constructor(config?: ClientConfig);
|
|
40
|
+
/**
|
|
41
|
+
* Access memory operations
|
|
42
|
+
*/
|
|
43
|
+
get memories(): any;
|
|
44
|
+
/**
|
|
45
|
+
* Access search operations
|
|
46
|
+
*/
|
|
47
|
+
get search(): any;
|
|
48
|
+
/**
|
|
49
|
+
* Access ingestion operations
|
|
50
|
+
*/
|
|
51
|
+
get ingest(): any;
|
|
52
|
+
/**
|
|
53
|
+
* Access router operations
|
|
54
|
+
*/
|
|
55
|
+
get router(): any;
|
|
56
|
+
/**
|
|
57
|
+
* Access graph visualization operations
|
|
58
|
+
*/
|
|
59
|
+
get graph(): any;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Vercel AI SDK provider adapter for MemoryLayer
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for the MemoryLayer provider
|
|
68
|
+
*/
|
|
69
|
+
interface MemoryLayerProviderConfig {
|
|
70
|
+
/** MemoryLayer client instance */
|
|
71
|
+
client: MemoryLayerClient;
|
|
72
|
+
/** Project ID for memory context */
|
|
73
|
+
projectId: string;
|
|
74
|
+
/** Default model to use */
|
|
75
|
+
defaultModel?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a Vercel AI SDK provider for MemoryLayer
|
|
79
|
+
*
|
|
80
|
+
* @param config - Provider configuration
|
|
81
|
+
* @returns Vercel AI SDK compatible provider
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* import { createMemoryLayerProvider } from '@memorylayer/vercel-ai';
|
|
86
|
+
* import { MemoryLayerClient } from '@memorylayer/sdk';
|
|
87
|
+
* import { generateText } from 'ai';
|
|
88
|
+
*
|
|
89
|
+
* const client = new MemoryLayerClient({
|
|
90
|
+
* apiKey: process.env.MEMORYLAYER_API_KEY!,
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* const provider = createMemoryLayerProvider({
|
|
94
|
+
* client,
|
|
95
|
+
* projectId: 'proj_abc123',
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* const { text } = await generateText({
|
|
99
|
+
* model: provider,
|
|
100
|
+
* prompt: 'What are my preferences?',
|
|
101
|
+
* });
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
declare function createMemoryLayerProvider(config: MemoryLayerProviderConfig): any;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Vercel AI SDK tool helpers for MemoryLayer
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Configuration for memory tools
|
|
112
|
+
*/
|
|
113
|
+
interface MemoryToolConfig {
|
|
114
|
+
/** MemoryLayer client instance */
|
|
115
|
+
client: MemoryLayerClient;
|
|
116
|
+
/** Project ID for memory operations */
|
|
117
|
+
projectId: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Create a Vercel AI SDK tool for adding memories
|
|
121
|
+
*
|
|
122
|
+
* @param config - Tool configuration
|
|
123
|
+
* @returns Vercel AI SDK tool definition
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* import { memoryTool } from '@memorylayer/vercel-ai';
|
|
128
|
+
* import { MemoryLayerClient } from '@memorylayer/sdk';
|
|
129
|
+
* import { generateText } from 'ai';
|
|
130
|
+
*
|
|
131
|
+
* const client = new MemoryLayerClient({
|
|
132
|
+
* apiKey: process.env.MEMORYLAYER_API_KEY!,
|
|
133
|
+
* });
|
|
134
|
+
*
|
|
135
|
+
* const { text } = await generateText({
|
|
136
|
+
* model: someModel,
|
|
137
|
+
* prompt: 'Remember that I prefer dark mode',
|
|
138
|
+
* tools: {
|
|
139
|
+
* addMemory: memoryTool({ client, projectId: 'proj_abc123' }),
|
|
140
|
+
* },
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
declare function memoryTool(config: MemoryToolConfig): {
|
|
145
|
+
description: string;
|
|
146
|
+
parameters: z.ZodObject<{
|
|
147
|
+
content: z.ZodString;
|
|
148
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
content: string;
|
|
151
|
+
metadata?: Record<string, any> | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
content: string;
|
|
154
|
+
metadata?: Record<string, any> | undefined;
|
|
155
|
+
}>;
|
|
156
|
+
execute: ({ content, metadata }: {
|
|
157
|
+
content: string;
|
|
158
|
+
metadata?: Record<string, any>;
|
|
159
|
+
}) => Promise<{
|
|
160
|
+
success: boolean;
|
|
161
|
+
memoryId: any;
|
|
162
|
+
message: string;
|
|
163
|
+
error?: undefined;
|
|
164
|
+
} | {
|
|
165
|
+
success: boolean;
|
|
166
|
+
error: string;
|
|
167
|
+
memoryId?: undefined;
|
|
168
|
+
message?: undefined;
|
|
169
|
+
}>;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Create a Vercel AI SDK tool for searching memories
|
|
173
|
+
*
|
|
174
|
+
* @param config - Tool configuration
|
|
175
|
+
* @returns Vercel AI SDK tool definition
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* import { searchTool } from '@memorylayer/vercel-ai';
|
|
180
|
+
* import { MemoryLayerClient } from '@memorylayer/sdk';
|
|
181
|
+
* import { generateText } from 'ai';
|
|
182
|
+
*
|
|
183
|
+
* const client = new MemoryLayerClient({
|
|
184
|
+
* apiKey: process.env.MEMORYLAYER_API_KEY!,
|
|
185
|
+
* });
|
|
186
|
+
*
|
|
187
|
+
* const { text } = await generateText({
|
|
188
|
+
* model: someModel,
|
|
189
|
+
* prompt: 'What are my preferences?',
|
|
190
|
+
* tools: {
|
|
191
|
+
* searchMemory: searchTool({ client, projectId: 'proj_abc123' }),
|
|
192
|
+
* },
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
declare function searchTool(config: MemoryToolConfig): {
|
|
197
|
+
description: string;
|
|
198
|
+
parameters: z.ZodObject<{
|
|
199
|
+
query: z.ZodString;
|
|
200
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
query: string;
|
|
204
|
+
limit?: number | undefined;
|
|
205
|
+
threshold?: number | undefined;
|
|
206
|
+
}, {
|
|
207
|
+
query: string;
|
|
208
|
+
limit?: number | undefined;
|
|
209
|
+
threshold?: number | undefined;
|
|
210
|
+
}>;
|
|
211
|
+
execute: ({ query, limit, threshold }: {
|
|
212
|
+
query: string;
|
|
213
|
+
limit?: number;
|
|
214
|
+
threshold?: number;
|
|
215
|
+
}) => Promise<{
|
|
216
|
+
success: boolean;
|
|
217
|
+
results: any;
|
|
218
|
+
total: any;
|
|
219
|
+
error?: undefined;
|
|
220
|
+
} | {
|
|
221
|
+
success: boolean;
|
|
222
|
+
error: string;
|
|
223
|
+
results?: undefined;
|
|
224
|
+
total?: undefined;
|
|
225
|
+
}>;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Configuration for graph tools
|
|
230
|
+
*/
|
|
231
|
+
interface GraphToolConfig {
|
|
232
|
+
/** MemoryLayer client instance */
|
|
233
|
+
client: MemoryLayerClient$1;
|
|
234
|
+
/** Space/project ID for graph context */
|
|
235
|
+
spaceId: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Create a tool for fetching graph data
|
|
239
|
+
*
|
|
240
|
+
* This tool allows AI models to fetch and visualize memory graph data.
|
|
241
|
+
*
|
|
242
|
+
* @param config - Graph tool configuration
|
|
243
|
+
* @returns Vercel AI SDK compatible tool
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```typescript
|
|
247
|
+
* import { graphTool } from '@memorylayer/vercel-ai';
|
|
248
|
+
* import { MemoryLayerClient } from '@memorylayer/sdk';
|
|
249
|
+
* import { generateText } from 'ai';
|
|
250
|
+
*
|
|
251
|
+
* const client = new MemoryLayerClient({
|
|
252
|
+
* apiKey: process.env.MEMORYLAYER_API_KEY!,
|
|
253
|
+
* });
|
|
254
|
+
*
|
|
255
|
+
* const { text } = await generateText({
|
|
256
|
+
* model: openai('gpt-4'),
|
|
257
|
+
* prompt: 'Show me the memory graph',
|
|
258
|
+
* tools: {
|
|
259
|
+
* getGraph: graphTool({ client, spaceId: 'proj_abc123' }),
|
|
260
|
+
* },
|
|
261
|
+
* });
|
|
262
|
+
* ```
|
|
263
|
+
*
|
|
264
|
+
* Requirements: 6.1
|
|
265
|
+
*/
|
|
266
|
+
declare function graphTool(config: GraphToolConfig): ai.CoreTool<z.ZodObject<{
|
|
267
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
268
|
+
nodeTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["memory", "document", "entity"]>, "many">>;
|
|
269
|
+
relationshipTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["extends", "updates", "derives", "similarity"]>, "many">>;
|
|
270
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
271
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
272
|
+
}, "strip", z.ZodTypeAny, {
|
|
273
|
+
limit?: number | undefined;
|
|
274
|
+
nodeTypes?: ("memory" | "document" | "entity")[] | undefined;
|
|
275
|
+
relationshipTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
276
|
+
startDate?: string | undefined;
|
|
277
|
+
endDate?: string | undefined;
|
|
278
|
+
}, {
|
|
279
|
+
limit?: number | undefined;
|
|
280
|
+
nodeTypes?: ("memory" | "document" | "entity")[] | undefined;
|
|
281
|
+
relationshipTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
282
|
+
startDate?: string | undefined;
|
|
283
|
+
endDate?: string | undefined;
|
|
284
|
+
}>, {
|
|
285
|
+
nodes: any;
|
|
286
|
+
edges: any;
|
|
287
|
+
metadata: any;
|
|
288
|
+
}> & {
|
|
289
|
+
execute: (args: {
|
|
290
|
+
limit?: number | undefined;
|
|
291
|
+
nodeTypes?: ("memory" | "document" | "entity")[] | undefined;
|
|
292
|
+
relationshipTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
293
|
+
startDate?: string | undefined;
|
|
294
|
+
endDate?: string | undefined;
|
|
295
|
+
}, options: {
|
|
296
|
+
abortSignal?: AbortSignal;
|
|
297
|
+
}) => PromiseLike<{
|
|
298
|
+
nodes: any;
|
|
299
|
+
edges: any;
|
|
300
|
+
metadata: any;
|
|
301
|
+
}>;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Create a tool for fetching node details
|
|
305
|
+
*
|
|
306
|
+
* This tool allows AI models to get detailed information about a specific node.
|
|
307
|
+
*
|
|
308
|
+
* @param config - Graph tool configuration
|
|
309
|
+
* @returns Vercel AI SDK compatible tool
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```typescript
|
|
313
|
+
* import { nodeDetailsTool } from '@memorylayer/vercel-ai';
|
|
314
|
+
* import { MemoryLayerClient } from '@memorylayer/sdk';
|
|
315
|
+
* import { generateText } from 'ai';
|
|
316
|
+
*
|
|
317
|
+
* const client = new MemoryLayerClient({
|
|
318
|
+
* apiKey: process.env.MEMORYLAYER_API_KEY!,
|
|
319
|
+
* });
|
|
320
|
+
*
|
|
321
|
+
* const { text } = await generateText({
|
|
322
|
+
* model: openai('gpt-4'),
|
|
323
|
+
* prompt: 'Tell me about memory node-123',
|
|
324
|
+
* tools: {
|
|
325
|
+
* getNodeDetails: nodeDetailsTool({ client, spaceId: 'proj_abc123' }),
|
|
326
|
+
* },
|
|
327
|
+
* });
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
330
|
+
* Requirements: 6.2
|
|
331
|
+
*/
|
|
332
|
+
declare function nodeDetailsTool(config: GraphToolConfig): ai.CoreTool<z.ZodObject<{
|
|
333
|
+
nodeId: z.ZodString;
|
|
334
|
+
}, "strip", z.ZodTypeAny, {
|
|
335
|
+
nodeId: string;
|
|
336
|
+
}, {
|
|
337
|
+
nodeId: string;
|
|
338
|
+
}>, {
|
|
339
|
+
node: {
|
|
340
|
+
id: any;
|
|
341
|
+
type: any;
|
|
342
|
+
label: any;
|
|
343
|
+
content: any;
|
|
344
|
+
status: any;
|
|
345
|
+
createdAt: any;
|
|
346
|
+
expiresAt: any;
|
|
347
|
+
metadata: any;
|
|
348
|
+
};
|
|
349
|
+
connectedNodes: any;
|
|
350
|
+
edges: any;
|
|
351
|
+
}> & {
|
|
352
|
+
execute: (args: {
|
|
353
|
+
nodeId: string;
|
|
354
|
+
}, options: {
|
|
355
|
+
abortSignal?: AbortSignal;
|
|
356
|
+
}) => PromiseLike<{
|
|
357
|
+
node: {
|
|
358
|
+
id: any;
|
|
359
|
+
type: any;
|
|
360
|
+
label: any;
|
|
361
|
+
content: any;
|
|
362
|
+
status: any;
|
|
363
|
+
createdAt: any;
|
|
364
|
+
expiresAt: any;
|
|
365
|
+
metadata: any;
|
|
366
|
+
};
|
|
367
|
+
connectedNodes: any;
|
|
368
|
+
edges: any;
|
|
369
|
+
}>;
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* Create a tool for fetching node edges
|
|
373
|
+
*
|
|
374
|
+
* This tool allows AI models to get edges connected to a specific node.
|
|
375
|
+
*
|
|
376
|
+
* @param config - Graph tool configuration
|
|
377
|
+
* @returns Vercel AI SDK compatible tool
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```typescript
|
|
381
|
+
* import { nodeEdgesTool } from '@memorylayer/vercel-ai';
|
|
382
|
+
* import { MemoryLayerClient } from '@memorylayer/sdk';
|
|
383
|
+
* import { generateText } from 'ai';
|
|
384
|
+
*
|
|
385
|
+
* const client = new MemoryLayerClient({
|
|
386
|
+
* apiKey: process.env.MEMORYLAYER_API_KEY!,
|
|
387
|
+
* });
|
|
388
|
+
*
|
|
389
|
+
* const { text } = await generateText({
|
|
390
|
+
* model: openai('gpt-4'),
|
|
391
|
+
* prompt: 'What is connected to memory node-123?',
|
|
392
|
+
* tools: {
|
|
393
|
+
* getNodeEdges: nodeEdgesTool({ client, spaceId: 'proj_abc123' }),
|
|
394
|
+
* },
|
|
395
|
+
* });
|
|
396
|
+
* ```
|
|
397
|
+
*
|
|
398
|
+
* Requirements: 6.3
|
|
399
|
+
*/
|
|
400
|
+
declare function nodeEdgesTool(config: GraphToolConfig): ai.CoreTool<z.ZodObject<{
|
|
401
|
+
nodeId: z.ZodString;
|
|
402
|
+
edgeTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["extends", "updates", "derives", "similarity"]>, "many">>;
|
|
403
|
+
}, "strip", z.ZodTypeAny, {
|
|
404
|
+
nodeId: string;
|
|
405
|
+
edgeTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
406
|
+
}, {
|
|
407
|
+
nodeId: string;
|
|
408
|
+
edgeTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
409
|
+
}>, {
|
|
410
|
+
edges: any;
|
|
411
|
+
connectedNodes: any;
|
|
412
|
+
}> & {
|
|
413
|
+
execute: (args: {
|
|
414
|
+
nodeId: string;
|
|
415
|
+
edgeTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
416
|
+
}, options: {
|
|
417
|
+
abortSignal?: AbortSignal;
|
|
418
|
+
}) => PromiseLike<{
|
|
419
|
+
edges: any;
|
|
420
|
+
connectedNodes: any;
|
|
421
|
+
}>;
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Create all graph tools at once
|
|
425
|
+
*
|
|
426
|
+
* Convenience function to create all graph-related tools.
|
|
427
|
+
*
|
|
428
|
+
* @param config - Graph tool configuration
|
|
429
|
+
* @returns Object with all graph tools
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```typescript
|
|
433
|
+
* import { createGraphTools } from '@memorylayer/vercel-ai';
|
|
434
|
+
* import { MemoryLayerClient } from '@memorylayer/sdk';
|
|
435
|
+
* import { generateText } from 'ai';
|
|
436
|
+
*
|
|
437
|
+
* const client = new MemoryLayerClient({
|
|
438
|
+
* apiKey: process.env.MEMORYLAYER_API_KEY!,
|
|
439
|
+
* });
|
|
440
|
+
*
|
|
441
|
+
* const graphTools = createGraphTools({ client, spaceId: 'proj_abc123' });
|
|
442
|
+
*
|
|
443
|
+
* const { text } = await generateText({
|
|
444
|
+
* model: openai('gpt-4'),
|
|
445
|
+
* prompt: 'Analyze my memory graph',
|
|
446
|
+
* tools: graphTools,
|
|
447
|
+
* });
|
|
448
|
+
* ```
|
|
449
|
+
*
|
|
450
|
+
* Requirements: 6.1, 6.2, 6.3
|
|
451
|
+
*/
|
|
452
|
+
declare function createGraphTools(config: GraphToolConfig): {
|
|
453
|
+
getGraph: ai.CoreTool<z.ZodObject<{
|
|
454
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
455
|
+
nodeTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["memory", "document", "entity"]>, "many">>;
|
|
456
|
+
relationshipTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["extends", "updates", "derives", "similarity"]>, "many">>;
|
|
457
|
+
startDate: z.ZodOptional<z.ZodString>;
|
|
458
|
+
endDate: z.ZodOptional<z.ZodString>;
|
|
459
|
+
}, "strip", z.ZodTypeAny, {
|
|
460
|
+
limit?: number | undefined;
|
|
461
|
+
nodeTypes?: ("memory" | "document" | "entity")[] | undefined;
|
|
462
|
+
relationshipTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
463
|
+
startDate?: string | undefined;
|
|
464
|
+
endDate?: string | undefined;
|
|
465
|
+
}, {
|
|
466
|
+
limit?: number | undefined;
|
|
467
|
+
nodeTypes?: ("memory" | "document" | "entity")[] | undefined;
|
|
468
|
+
relationshipTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
469
|
+
startDate?: string | undefined;
|
|
470
|
+
endDate?: string | undefined;
|
|
471
|
+
}>, {
|
|
472
|
+
nodes: any;
|
|
473
|
+
edges: any;
|
|
474
|
+
metadata: any;
|
|
475
|
+
}> & {
|
|
476
|
+
execute: (args: {
|
|
477
|
+
limit?: number | undefined;
|
|
478
|
+
nodeTypes?: ("memory" | "document" | "entity")[] | undefined;
|
|
479
|
+
relationshipTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
480
|
+
startDate?: string | undefined;
|
|
481
|
+
endDate?: string | undefined;
|
|
482
|
+
}, options: {
|
|
483
|
+
abortSignal?: AbortSignal;
|
|
484
|
+
}) => PromiseLike<{
|
|
485
|
+
nodes: any;
|
|
486
|
+
edges: any;
|
|
487
|
+
metadata: any;
|
|
488
|
+
}>;
|
|
489
|
+
};
|
|
490
|
+
getNodeDetails: ai.CoreTool<z.ZodObject<{
|
|
491
|
+
nodeId: z.ZodString;
|
|
492
|
+
}, "strip", z.ZodTypeAny, {
|
|
493
|
+
nodeId: string;
|
|
494
|
+
}, {
|
|
495
|
+
nodeId: string;
|
|
496
|
+
}>, {
|
|
497
|
+
node: {
|
|
498
|
+
id: any;
|
|
499
|
+
type: any;
|
|
500
|
+
label: any;
|
|
501
|
+
content: any;
|
|
502
|
+
status: any;
|
|
503
|
+
createdAt: any;
|
|
504
|
+
expiresAt: any;
|
|
505
|
+
metadata: any;
|
|
506
|
+
};
|
|
507
|
+
connectedNodes: any;
|
|
508
|
+
edges: any;
|
|
509
|
+
}> & {
|
|
510
|
+
execute: (args: {
|
|
511
|
+
nodeId: string;
|
|
512
|
+
}, options: {
|
|
513
|
+
abortSignal?: AbortSignal;
|
|
514
|
+
}) => PromiseLike<{
|
|
515
|
+
node: {
|
|
516
|
+
id: any;
|
|
517
|
+
type: any;
|
|
518
|
+
label: any;
|
|
519
|
+
content: any;
|
|
520
|
+
status: any;
|
|
521
|
+
createdAt: any;
|
|
522
|
+
expiresAt: any;
|
|
523
|
+
metadata: any;
|
|
524
|
+
};
|
|
525
|
+
connectedNodes: any;
|
|
526
|
+
edges: any;
|
|
527
|
+
}>;
|
|
528
|
+
};
|
|
529
|
+
getNodeEdges: ai.CoreTool<z.ZodObject<{
|
|
530
|
+
nodeId: z.ZodString;
|
|
531
|
+
edgeTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["extends", "updates", "derives", "similarity"]>, "many">>;
|
|
532
|
+
}, "strip", z.ZodTypeAny, {
|
|
533
|
+
nodeId: string;
|
|
534
|
+
edgeTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
535
|
+
}, {
|
|
536
|
+
nodeId: string;
|
|
537
|
+
edgeTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
538
|
+
}>, {
|
|
539
|
+
edges: any;
|
|
540
|
+
connectedNodes: any;
|
|
541
|
+
}> & {
|
|
542
|
+
execute: (args: {
|
|
543
|
+
nodeId: string;
|
|
544
|
+
edgeTypes?: ("updates" | "extends" | "derives" | "similarity")[] | undefined;
|
|
545
|
+
}, options: {
|
|
546
|
+
abortSignal?: AbortSignal;
|
|
547
|
+
}) => PromiseLike<{
|
|
548
|
+
edges: any;
|
|
549
|
+
connectedNodes: any;
|
|
550
|
+
}>;
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
export { type GraphToolConfig, type MemoryLayerProviderConfig, type MemoryToolConfig, createGraphTools, createMemoryLayerProvider, graphTool, memoryTool, nodeDetailsTool, nodeEdgesTool, searchTool };
|