@zibby/mem0ai 2.4.7

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.
@@ -0,0 +1,1026 @@
1
+ import { z } from 'zod';
2
+ import { QdrantClient } from '@qdrant/js-client-rest';
3
+ import { VectorStore as VectorStore$1 } from '@langchain/core/vectorstores';
4
+
5
+ interface MultiModalMessages {
6
+ type: "image_url";
7
+ image_url: {
8
+ url: string;
9
+ };
10
+ }
11
+ interface Message {
12
+ role: string;
13
+ content: string | MultiModalMessages;
14
+ }
15
+ interface EmbeddingConfig {
16
+ apiKey?: string;
17
+ model?: string | any;
18
+ baseURL?: string;
19
+ url?: string;
20
+ embeddingDims?: number;
21
+ modelProperties?: Record<string, any>;
22
+ }
23
+ interface VectorStoreConfig {
24
+ collectionName?: string;
25
+ dimension?: number;
26
+ dbPath?: string;
27
+ client?: any;
28
+ instance?: any;
29
+ [key: string]: any;
30
+ }
31
+ interface HistoryStoreConfig {
32
+ provider: string;
33
+ config: {
34
+ historyDbPath?: string;
35
+ supabaseUrl?: string;
36
+ supabaseKey?: string;
37
+ tableName?: string;
38
+ };
39
+ }
40
+ interface LLMConfig {
41
+ provider?: string;
42
+ baseURL?: string;
43
+ url?: string;
44
+ config?: Record<string, any>;
45
+ apiKey?: string;
46
+ model?: string | any;
47
+ modelProperties?: Record<string, any>;
48
+ }
49
+ interface Neo4jConfig {
50
+ url: string;
51
+ username: string;
52
+ password: string;
53
+ }
54
+ interface GraphStoreConfig {
55
+ provider: string;
56
+ config: Neo4jConfig;
57
+ llm?: LLMConfig;
58
+ customPrompt?: string;
59
+ }
60
+ interface MemoryConfig {
61
+ version?: string;
62
+ embedder: {
63
+ provider: string;
64
+ config: EmbeddingConfig;
65
+ };
66
+ vectorStore: {
67
+ provider: string;
68
+ config: VectorStoreConfig;
69
+ };
70
+ llm: {
71
+ provider: string;
72
+ config: LLMConfig;
73
+ };
74
+ historyStore?: HistoryStoreConfig;
75
+ disableHistory?: boolean;
76
+ historyDbPath?: string;
77
+ customPrompt?: string;
78
+ graphStore?: GraphStoreConfig;
79
+ enableGraph?: boolean;
80
+ }
81
+ interface MemoryItem {
82
+ id: string;
83
+ memory: string;
84
+ hash?: string;
85
+ createdAt?: string;
86
+ updatedAt?: string;
87
+ score?: number;
88
+ metadata?: Record<string, any>;
89
+ }
90
+ interface SearchFilters {
91
+ userId?: string;
92
+ agentId?: string;
93
+ runId?: string;
94
+ [key: string]: any;
95
+ }
96
+ interface SearchResult {
97
+ results: MemoryItem[];
98
+ relations?: any[];
99
+ }
100
+ interface VectorStoreResult {
101
+ id: string;
102
+ payload: Record<string, any>;
103
+ score?: number;
104
+ }
105
+ declare const MemoryConfigSchema: z.ZodObject<{
106
+ version: z.ZodOptional<z.ZodString>;
107
+ embedder: z.ZodObject<{
108
+ provider: z.ZodString;
109
+ config: z.ZodObject<{
110
+ modelProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
111
+ apiKey: z.ZodOptional<z.ZodString>;
112
+ model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodAny]>>;
113
+ baseURL: z.ZodOptional<z.ZodString>;
114
+ embeddingDims: z.ZodOptional<z.ZodNumber>;
115
+ url: z.ZodOptional<z.ZodString>;
116
+ }, "strip", z.ZodTypeAny, {
117
+ modelProperties?: Record<string, any> | undefined;
118
+ apiKey?: string | undefined;
119
+ model?: any;
120
+ baseURL?: string | undefined;
121
+ embeddingDims?: number | undefined;
122
+ url?: string | undefined;
123
+ }, {
124
+ modelProperties?: Record<string, any> | undefined;
125
+ apiKey?: string | undefined;
126
+ model?: any;
127
+ baseURL?: string | undefined;
128
+ embeddingDims?: number | undefined;
129
+ url?: string | undefined;
130
+ }>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ provider: string;
133
+ config: {
134
+ modelProperties?: Record<string, any> | undefined;
135
+ apiKey?: string | undefined;
136
+ model?: any;
137
+ baseURL?: string | undefined;
138
+ embeddingDims?: number | undefined;
139
+ url?: string | undefined;
140
+ };
141
+ }, {
142
+ provider: string;
143
+ config: {
144
+ modelProperties?: Record<string, any> | undefined;
145
+ apiKey?: string | undefined;
146
+ model?: any;
147
+ baseURL?: string | undefined;
148
+ embeddingDims?: number | undefined;
149
+ url?: string | undefined;
150
+ };
151
+ }>;
152
+ vectorStore: z.ZodObject<{
153
+ provider: z.ZodString;
154
+ config: z.ZodObject<{
155
+ collectionName: z.ZodOptional<z.ZodString>;
156
+ dimension: z.ZodOptional<z.ZodNumber>;
157
+ dbPath: z.ZodOptional<z.ZodString>;
158
+ client: z.ZodOptional<z.ZodAny>;
159
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
160
+ collectionName: z.ZodOptional<z.ZodString>;
161
+ dimension: z.ZodOptional<z.ZodNumber>;
162
+ dbPath: z.ZodOptional<z.ZodString>;
163
+ client: z.ZodOptional<z.ZodAny>;
164
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
165
+ collectionName: z.ZodOptional<z.ZodString>;
166
+ dimension: z.ZodOptional<z.ZodNumber>;
167
+ dbPath: z.ZodOptional<z.ZodString>;
168
+ client: z.ZodOptional<z.ZodAny>;
169
+ }, z.ZodTypeAny, "passthrough">>;
170
+ }, "strip", z.ZodTypeAny, {
171
+ provider: string;
172
+ config: {
173
+ collectionName?: string | undefined;
174
+ dimension?: number | undefined;
175
+ dbPath?: string | undefined;
176
+ client?: any;
177
+ } & {
178
+ [k: string]: unknown;
179
+ };
180
+ }, {
181
+ provider: string;
182
+ config: {
183
+ collectionName?: string | undefined;
184
+ dimension?: number | undefined;
185
+ dbPath?: string | undefined;
186
+ client?: any;
187
+ } & {
188
+ [k: string]: unknown;
189
+ };
190
+ }>;
191
+ llm: z.ZodObject<{
192
+ provider: z.ZodString;
193
+ config: z.ZodObject<{
194
+ apiKey: z.ZodOptional<z.ZodString>;
195
+ model: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodAny]>>;
196
+ modelProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
197
+ baseURL: z.ZodOptional<z.ZodString>;
198
+ url: z.ZodOptional<z.ZodString>;
199
+ }, "strip", z.ZodTypeAny, {
200
+ modelProperties?: Record<string, any> | undefined;
201
+ apiKey?: string | undefined;
202
+ model?: any;
203
+ baseURL?: string | undefined;
204
+ url?: string | undefined;
205
+ }, {
206
+ modelProperties?: Record<string, any> | undefined;
207
+ apiKey?: string | undefined;
208
+ model?: any;
209
+ baseURL?: string | undefined;
210
+ url?: string | undefined;
211
+ }>;
212
+ }, "strip", z.ZodTypeAny, {
213
+ provider: string;
214
+ config: {
215
+ modelProperties?: Record<string, any> | undefined;
216
+ apiKey?: string | undefined;
217
+ model?: any;
218
+ baseURL?: string | undefined;
219
+ url?: string | undefined;
220
+ };
221
+ }, {
222
+ provider: string;
223
+ config: {
224
+ modelProperties?: Record<string, any> | undefined;
225
+ apiKey?: string | undefined;
226
+ model?: any;
227
+ baseURL?: string | undefined;
228
+ url?: string | undefined;
229
+ };
230
+ }>;
231
+ historyDbPath: z.ZodOptional<z.ZodString>;
232
+ customPrompt: z.ZodOptional<z.ZodString>;
233
+ enableGraph: z.ZodOptional<z.ZodBoolean>;
234
+ graphStore: z.ZodOptional<z.ZodObject<{
235
+ provider: z.ZodString;
236
+ config: z.ZodObject<{
237
+ url: z.ZodString;
238
+ username: z.ZodString;
239
+ password: z.ZodString;
240
+ }, "strip", z.ZodTypeAny, {
241
+ url: string;
242
+ username: string;
243
+ password: string;
244
+ }, {
245
+ url: string;
246
+ username: string;
247
+ password: string;
248
+ }>;
249
+ llm: z.ZodOptional<z.ZodObject<{
250
+ provider: z.ZodString;
251
+ config: z.ZodRecord<z.ZodString, z.ZodAny>;
252
+ }, "strip", z.ZodTypeAny, {
253
+ provider: string;
254
+ config: Record<string, any>;
255
+ }, {
256
+ provider: string;
257
+ config: Record<string, any>;
258
+ }>>;
259
+ customPrompt: z.ZodOptional<z.ZodString>;
260
+ }, "strip", z.ZodTypeAny, {
261
+ provider: string;
262
+ config: {
263
+ url: string;
264
+ username: string;
265
+ password: string;
266
+ };
267
+ llm?: {
268
+ provider: string;
269
+ config: Record<string, any>;
270
+ } | undefined;
271
+ customPrompt?: string | undefined;
272
+ }, {
273
+ provider: string;
274
+ config: {
275
+ url: string;
276
+ username: string;
277
+ password: string;
278
+ };
279
+ llm?: {
280
+ provider: string;
281
+ config: Record<string, any>;
282
+ } | undefined;
283
+ customPrompt?: string | undefined;
284
+ }>>;
285
+ historyStore: z.ZodOptional<z.ZodObject<{
286
+ provider: z.ZodString;
287
+ config: z.ZodRecord<z.ZodString, z.ZodAny>;
288
+ }, "strip", z.ZodTypeAny, {
289
+ provider: string;
290
+ config: Record<string, any>;
291
+ }, {
292
+ provider: string;
293
+ config: Record<string, any>;
294
+ }>>;
295
+ disableHistory: z.ZodOptional<z.ZodBoolean>;
296
+ }, "strip", z.ZodTypeAny, {
297
+ embedder: {
298
+ provider: string;
299
+ config: {
300
+ modelProperties?: Record<string, any> | undefined;
301
+ apiKey?: string | undefined;
302
+ model?: any;
303
+ baseURL?: string | undefined;
304
+ embeddingDims?: number | undefined;
305
+ url?: string | undefined;
306
+ };
307
+ };
308
+ vectorStore: {
309
+ provider: string;
310
+ config: {
311
+ collectionName?: string | undefined;
312
+ dimension?: number | undefined;
313
+ dbPath?: string | undefined;
314
+ client?: any;
315
+ } & {
316
+ [k: string]: unknown;
317
+ };
318
+ };
319
+ llm: {
320
+ provider: string;
321
+ config: {
322
+ modelProperties?: Record<string, any> | undefined;
323
+ apiKey?: string | undefined;
324
+ model?: any;
325
+ baseURL?: string | undefined;
326
+ url?: string | undefined;
327
+ };
328
+ };
329
+ version?: string | undefined;
330
+ historyDbPath?: string | undefined;
331
+ customPrompt?: string | undefined;
332
+ enableGraph?: boolean | undefined;
333
+ graphStore?: {
334
+ provider: string;
335
+ config: {
336
+ url: string;
337
+ username: string;
338
+ password: string;
339
+ };
340
+ llm?: {
341
+ provider: string;
342
+ config: Record<string, any>;
343
+ } | undefined;
344
+ customPrompt?: string | undefined;
345
+ } | undefined;
346
+ historyStore?: {
347
+ provider: string;
348
+ config: Record<string, any>;
349
+ } | undefined;
350
+ disableHistory?: boolean | undefined;
351
+ }, {
352
+ embedder: {
353
+ provider: string;
354
+ config: {
355
+ modelProperties?: Record<string, any> | undefined;
356
+ apiKey?: string | undefined;
357
+ model?: any;
358
+ baseURL?: string | undefined;
359
+ embeddingDims?: number | undefined;
360
+ url?: string | undefined;
361
+ };
362
+ };
363
+ vectorStore: {
364
+ provider: string;
365
+ config: {
366
+ collectionName?: string | undefined;
367
+ dimension?: number | undefined;
368
+ dbPath?: string | undefined;
369
+ client?: any;
370
+ } & {
371
+ [k: string]: unknown;
372
+ };
373
+ };
374
+ llm: {
375
+ provider: string;
376
+ config: {
377
+ modelProperties?: Record<string, any> | undefined;
378
+ apiKey?: string | undefined;
379
+ model?: any;
380
+ baseURL?: string | undefined;
381
+ url?: string | undefined;
382
+ };
383
+ };
384
+ version?: string | undefined;
385
+ historyDbPath?: string | undefined;
386
+ customPrompt?: string | undefined;
387
+ enableGraph?: boolean | undefined;
388
+ graphStore?: {
389
+ provider: string;
390
+ config: {
391
+ url: string;
392
+ username: string;
393
+ password: string;
394
+ };
395
+ llm?: {
396
+ provider: string;
397
+ config: Record<string, any>;
398
+ } | undefined;
399
+ customPrompt?: string | undefined;
400
+ } | undefined;
401
+ historyStore?: {
402
+ provider: string;
403
+ config: Record<string, any>;
404
+ } | undefined;
405
+ disableHistory?: boolean | undefined;
406
+ }>;
407
+
408
+ interface Entity {
409
+ userId?: string;
410
+ agentId?: string;
411
+ runId?: string;
412
+ }
413
+ interface AddMemoryOptions extends Entity {
414
+ metadata?: Record<string, any>;
415
+ filters?: SearchFilters;
416
+ infer?: boolean;
417
+ }
418
+ interface SearchMemoryOptions extends Entity {
419
+ limit?: number;
420
+ filters?: SearchFilters;
421
+ }
422
+ interface GetAllMemoryOptions extends Entity {
423
+ limit?: number;
424
+ }
425
+ interface DeleteAllMemoryOptions extends Entity {
426
+ }
427
+
428
+ declare class Memory {
429
+ private config;
430
+ private customPrompt;
431
+ private embedder;
432
+ private vectorStore;
433
+ private llm;
434
+ private db;
435
+ private collectionName;
436
+ private apiVersion;
437
+ private graphMemory?;
438
+ private enableGraph;
439
+ telemetryId: string;
440
+ private _initPromise;
441
+ private _initError?;
442
+ constructor(config?: Partial<MemoryConfig>);
443
+ /**
444
+ * If no explicit dimension was provided, runs a probe embedding to
445
+ * detect it. Then creates and initializes the vector store.
446
+ */
447
+ private _autoInitialize;
448
+ /**
449
+ * Ensures that auto-initialization (dimension detection + vector store
450
+ * creation) has completed before any public method proceeds.
451
+ * If a previous init attempt failed, retries automatically.
452
+ */
453
+ private _ensureInitialized;
454
+ private _initializeTelemetry;
455
+ private _getTelemetryId;
456
+ private _captureEvent;
457
+ static fromConfig(configDict: Record<string, any>): Memory;
458
+ add(messages: string | Message[], config: AddMemoryOptions): Promise<SearchResult>;
459
+ private addToVectorStore;
460
+ get(memoryId: string): Promise<MemoryItem | null>;
461
+ search(query: string, config: SearchMemoryOptions): Promise<SearchResult>;
462
+ update(memoryId: string, data: string): Promise<{
463
+ message: string;
464
+ }>;
465
+ delete(memoryId: string): Promise<{
466
+ message: string;
467
+ }>;
468
+ deleteAll(config: DeleteAllMemoryOptions): Promise<{
469
+ message: string;
470
+ }>;
471
+ history(memoryId: string): Promise<any[]>;
472
+ reset(): Promise<void>;
473
+ getAll(config: GetAllMemoryOptions): Promise<SearchResult>;
474
+ private createMemory;
475
+ private updateMemory;
476
+ private deleteMemory;
477
+ }
478
+
479
+ interface Embedder {
480
+ embed(text: string): Promise<number[]>;
481
+ embedBatch(texts: string[]): Promise<number[][]>;
482
+ }
483
+
484
+ declare class OpenAIEmbedder implements Embedder {
485
+ private openai;
486
+ private model;
487
+ private embeddingDims;
488
+ constructor(config: EmbeddingConfig);
489
+ embed(text: string): Promise<number[]>;
490
+ embedBatch(texts: string[]): Promise<number[][]>;
491
+ }
492
+
493
+ declare class OllamaEmbedder implements Embedder {
494
+ private ollama;
495
+ private model;
496
+ private embeddingDims?;
497
+ private initialized;
498
+ constructor(config: EmbeddingConfig);
499
+ embed(text: string): Promise<number[]>;
500
+ embedBatch(texts: string[]): Promise<number[][]>;
501
+ private static normalizeModelName;
502
+ private ensureModelExists;
503
+ }
504
+
505
+ declare class LMStudioEmbedder implements Embedder {
506
+ private openai;
507
+ private model;
508
+ constructor(config: EmbeddingConfig);
509
+ embed(text: string): Promise<number[]>;
510
+ embedBatch(texts: string[]): Promise<number[][]>;
511
+ }
512
+
513
+ declare class GoogleEmbedder implements Embedder {
514
+ private google;
515
+ private model;
516
+ private embeddingDims;
517
+ constructor(config: EmbeddingConfig);
518
+ embed(text: string): Promise<number[]>;
519
+ embedBatch(texts: string[]): Promise<number[][]>;
520
+ }
521
+
522
+ declare class AzureOpenAIEmbedder implements Embedder {
523
+ private client;
524
+ private model;
525
+ private embeddingDims;
526
+ constructor(config: EmbeddingConfig);
527
+ embed(text: string): Promise<number[]>;
528
+ embedBatch(texts: string[]): Promise<number[][]>;
529
+ }
530
+
531
+ declare class LangchainEmbedder implements Embedder {
532
+ private embedderInstance;
533
+ private batchSize?;
534
+ constructor(config: EmbeddingConfig);
535
+ embed(text: string): Promise<number[]>;
536
+ embedBatch(texts: string[]): Promise<number[][]>;
537
+ }
538
+
539
+ interface LLMResponse {
540
+ content: string;
541
+ role: string;
542
+ toolCalls?: Array<{
543
+ name: string;
544
+ arguments: string;
545
+ }>;
546
+ }
547
+ interface LLM {
548
+ generateResponse(messages: Array<{
549
+ role: string;
550
+ content: string;
551
+ }>, response_format?: {
552
+ type: string;
553
+ }, tools?: any[]): Promise<any>;
554
+ generateChat(messages: Message[]): Promise<LLMResponse>;
555
+ }
556
+
557
+ declare class OpenAILLM implements LLM {
558
+ private openai;
559
+ private model;
560
+ constructor(config: LLMConfig);
561
+ generateResponse(messages: Message[], responseFormat?: {
562
+ type: string;
563
+ }, tools?: any[]): Promise<string | LLMResponse>;
564
+ generateChat(messages: Message[]): Promise<LLMResponse>;
565
+ }
566
+
567
+ declare class GoogleLLM implements LLM {
568
+ private google;
569
+ private model;
570
+ constructor(config: LLMConfig);
571
+ generateResponse(messages: Message[], responseFormat?: {
572
+ type: string;
573
+ }, tools?: any[]): Promise<string | LLMResponse>;
574
+ generateChat(messages: Message[]): Promise<LLMResponse>;
575
+ }
576
+
577
+ declare class OpenAIStructuredLLM implements LLM {
578
+ private openai;
579
+ private model;
580
+ constructor(config: LLMConfig);
581
+ generateResponse(messages: Message[], responseFormat?: {
582
+ type: string;
583
+ } | null, tools?: any[]): Promise<string | LLMResponse>;
584
+ generateChat(messages: Message[]): Promise<LLMResponse>;
585
+ }
586
+
587
+ declare class AnthropicLLM implements LLM {
588
+ private client;
589
+ private model;
590
+ constructor(config: LLMConfig);
591
+ generateResponse(messages: Message[], responseFormat?: {
592
+ type: string;
593
+ }): Promise<string>;
594
+ generateChat(messages: Message[]): Promise<LLMResponse>;
595
+ }
596
+
597
+ declare class GroqLLM implements LLM {
598
+ private client;
599
+ private model;
600
+ constructor(config: LLMConfig);
601
+ generateResponse(messages: Message[], responseFormat?: {
602
+ type: string;
603
+ }): Promise<string>;
604
+ generateChat(messages: Message[]): Promise<LLMResponse>;
605
+ }
606
+
607
+ declare class OllamaLLM implements LLM {
608
+ private ollama;
609
+ private model;
610
+ private initialized;
611
+ constructor(config: LLMConfig);
612
+ generateResponse(messages: Message[], responseFormat?: {
613
+ type: string;
614
+ }, tools?: any[]): Promise<string | LLMResponse>;
615
+ generateChat(messages: Message[]): Promise<LLMResponse>;
616
+ private ensureModelExists;
617
+ }
618
+
619
+ declare class LMStudioLLM extends OpenAILLM {
620
+ constructor(config: LLMConfig);
621
+ generateResponse(messages: Message[], responseFormat?: {
622
+ type: string;
623
+ }, tools?: any[]): Promise<string | LLMResponse>;
624
+ generateChat(messages: Message[]): Promise<LLMResponse>;
625
+ }
626
+
627
+ declare class MistralLLM implements LLM {
628
+ private client;
629
+ private model;
630
+ constructor(config: LLMConfig);
631
+ private contentToString;
632
+ generateResponse(messages: Message[], responseFormat?: {
633
+ type: string;
634
+ }, tools?: any[]): Promise<string | LLMResponse>;
635
+ generateChat(messages: Message[]): Promise<LLMResponse>;
636
+ }
637
+
638
+ declare class LangchainLLM implements LLM {
639
+ private llmInstance;
640
+ private modelName;
641
+ constructor(config: LLMConfig);
642
+ generateResponse(messages: Message[], response_format?: {
643
+ type: string;
644
+ }, tools?: any[]): Promise<string | LLMResponse>;
645
+ generateChat(messages: Message[]): Promise<LLMResponse>;
646
+ }
647
+
648
+ interface VectorStore {
649
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
650
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
651
+ get(vectorId: string): Promise<VectorStoreResult | null>;
652
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
653
+ delete(vectorId: string): Promise<void>;
654
+ deleteCol(): Promise<void>;
655
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
656
+ getUserId(): Promise<string>;
657
+ setUserId(userId: string): Promise<void>;
658
+ initialize(): Promise<void>;
659
+ }
660
+
661
+ declare class MemoryVectorStore implements VectorStore {
662
+ private db;
663
+ private dimension;
664
+ private dbPath;
665
+ constructor(config: VectorStoreConfig);
666
+ private init;
667
+ private cosineSimilarity;
668
+ private filterVector;
669
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
670
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
671
+ get(vectorId: string): Promise<VectorStoreResult | null>;
672
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
673
+ delete(vectorId: string): Promise<void>;
674
+ deleteCol(): Promise<void>;
675
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
676
+ getUserId(): Promise<string>;
677
+ setUserId(userId: string): Promise<void>;
678
+ initialize(): Promise<void>;
679
+ }
680
+
681
+ interface QdrantConfig extends VectorStoreConfig {
682
+ /**
683
+ * Pre-configured QdrantClient instance. If using Qdrant Cloud, you must pass
684
+ * `port` explicitly when constructing the client to avoid "Illegal host" errors
685
+ * caused by a known upstream bug (qdrant/qdrant-js#59).
686
+ *
687
+ * @example
688
+ * ```typescript
689
+ * const client = new QdrantClient({
690
+ * url: "https://xxx.cloud.qdrant.io:6333",
691
+ * port: 6333,
692
+ * apiKey: "xxx",
693
+ * });
694
+ * ```
695
+ */
696
+ client?: QdrantClient;
697
+ host?: string;
698
+ port?: number;
699
+ path?: string;
700
+ url?: string;
701
+ apiKey?: string;
702
+ onDisk?: boolean;
703
+ collectionName: string;
704
+ embeddingModelDims: number;
705
+ dimension?: number;
706
+ }
707
+ declare class Qdrant implements VectorStore {
708
+ private client;
709
+ private readonly collectionName;
710
+ private dimension;
711
+ private _initPromise?;
712
+ constructor(config: QdrantConfig);
713
+ private createFilter;
714
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
715
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
716
+ get(vectorId: string): Promise<VectorStoreResult | null>;
717
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
718
+ delete(vectorId: string): Promise<void>;
719
+ deleteCol(): Promise<void>;
720
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
721
+ private generateUUID;
722
+ getUserId(): Promise<string>;
723
+ setUserId(userId: string): Promise<void>;
724
+ private ensureCollection;
725
+ initialize(): Promise<void>;
726
+ private _doInitialize;
727
+ }
728
+
729
+ interface RedisConfig extends VectorStoreConfig {
730
+ redisUrl: string;
731
+ collectionName: string;
732
+ embeddingModelDims: number;
733
+ username?: string;
734
+ password?: string;
735
+ }
736
+ declare class RedisDB implements VectorStore {
737
+ private client;
738
+ private readonly indexName;
739
+ private readonly indexPrefix;
740
+ private readonly schema;
741
+ private _initPromise?;
742
+ constructor(config: RedisConfig);
743
+ private createIndex;
744
+ initialize(): Promise<void>;
745
+ private _doInitialize;
746
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
747
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
748
+ get(vectorId: string): Promise<VectorStoreResult | null>;
749
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
750
+ delete(vectorId: string): Promise<void>;
751
+ deleteCol(): Promise<void>;
752
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
753
+ close(): Promise<void>;
754
+ getUserId(): Promise<string>;
755
+ setUserId(userId: string): Promise<void>;
756
+ }
757
+
758
+ interface SupabaseConfig extends VectorStoreConfig {
759
+ supabaseUrl: string;
760
+ supabaseKey: string;
761
+ tableName: string;
762
+ embeddingColumnName?: string;
763
+ metadataColumnName?: string;
764
+ }
765
+ declare class SupabaseDB implements VectorStore {
766
+ private client;
767
+ private readonly tableName;
768
+ private readonly embeddingColumnName;
769
+ private readonly metadataColumnName;
770
+ private _initPromise?;
771
+ constructor(config: SupabaseConfig);
772
+ initialize(): Promise<void>;
773
+ private _doInitialize;
774
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
775
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
776
+ get(vectorId: string): Promise<VectorStoreResult | null>;
777
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
778
+ delete(vectorId: string): Promise<void>;
779
+ deleteCol(): Promise<void>;
780
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
781
+ getUserId(): Promise<string>;
782
+ setUserId(userId: string): Promise<void>;
783
+ }
784
+
785
+ interface LangchainStoreConfig extends VectorStoreConfig {
786
+ client: VectorStore$1;
787
+ }
788
+ declare class LangchainVectorStore implements VectorStore {
789
+ private lcStore;
790
+ private dimension?;
791
+ private storeUserId;
792
+ constructor(config: LangchainStoreConfig);
793
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
794
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
795
+ get(vectorId: string): Promise<VectorStoreResult | null>;
796
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
797
+ delete(vectorId: string): Promise<void>;
798
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
799
+ deleteCol(): Promise<void>;
800
+ getUserId(): Promise<string>;
801
+ setUserId(userId: string): Promise<void>;
802
+ initialize(): Promise<void>;
803
+ }
804
+
805
+ interface VectorizeConfig extends VectorStoreConfig {
806
+ apiKey?: string;
807
+ indexName: string;
808
+ accountId: string;
809
+ }
810
+ declare class VectorizeDB implements VectorStore {
811
+ private client;
812
+ private dimensions;
813
+ private indexName;
814
+ private accountId;
815
+ private _initPromise?;
816
+ constructor(config: VectorizeConfig);
817
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
818
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
819
+ get(vectorId: string): Promise<VectorStoreResult | null>;
820
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
821
+ delete(vectorId: string): Promise<void>;
822
+ deleteCol(): Promise<void>;
823
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
824
+ private generateUUID;
825
+ getUserId(): Promise<string>;
826
+ setUserId(userId: string): Promise<void>;
827
+ initialize(): Promise<void>;
828
+ private _doInitialize;
829
+ }
830
+
831
+ /**
832
+ * Configuration interface for Azure AI Search vector store
833
+ */
834
+ interface AzureAISearchConfig extends VectorStoreConfig {
835
+ /**
836
+ * Azure AI Search service name (e.g., "my-search-service")
837
+ */
838
+ serviceName: string;
839
+ /**
840
+ * Index/collection name to use
841
+ */
842
+ collectionName: string;
843
+ /**
844
+ * API key for authentication (if not provided, uses DefaultAzureCredential)
845
+ */
846
+ apiKey?: string;
847
+ /**
848
+ * Vector embedding dimensions
849
+ */
850
+ embeddingModelDims: number;
851
+ /**
852
+ * Compression type: 'none', 'scalar', or 'binary'
853
+ * @default 'none'
854
+ */
855
+ compressionType?: "none" | "scalar" | "binary";
856
+ /**
857
+ * Use half precision (float16) instead of full precision (float32)
858
+ * @default false
859
+ */
860
+ useFloat16?: boolean;
861
+ /**
862
+ * Enable hybrid search (combines vector + text search)
863
+ * @default false
864
+ */
865
+ hybridSearch?: boolean;
866
+ /**
867
+ * Vector filter mode: 'preFilter' or 'postFilter'
868
+ * @default 'preFilter'
869
+ */
870
+ vectorFilterMode?: string;
871
+ }
872
+ /**
873
+ * Azure AI Search vector store implementation
874
+ * Supports vector search with hybrid search, compression, and filtering
875
+ */
876
+ declare class AzureAISearch implements VectorStore {
877
+ private searchClient;
878
+ private indexClient;
879
+ private readonly serviceName;
880
+ private readonly indexName;
881
+ private readonly embeddingModelDims;
882
+ private readonly compressionType;
883
+ private readonly useFloat16;
884
+ private readonly hybridSearch;
885
+ private readonly vectorFilterMode;
886
+ private readonly apiKey;
887
+ private _initPromise?;
888
+ constructor(config: AzureAISearchConfig);
889
+ /**
890
+ * Initialize the Azure AI Search index if it doesn't exist
891
+ */
892
+ initialize(): Promise<void>;
893
+ private _doInitialize;
894
+ /**
895
+ * Create a new index in Azure AI Search
896
+ */
897
+ private createCol;
898
+ /**
899
+ * Generate a document for insertion
900
+ */
901
+ private generateDocument;
902
+ /**
903
+ * Insert vectors into the index
904
+ */
905
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
906
+ /**
907
+ * Sanitize filter keys to remove non-alphanumeric characters
908
+ */
909
+ private sanitizeKey;
910
+ /**
911
+ * Build OData filter expression from SearchFilters
912
+ */
913
+ private buildFilterExpression;
914
+ /**
915
+ * Extract JSON from payload string
916
+ * Handles cases where payload might have extra text
917
+ */
918
+ private extractJson;
919
+ /**
920
+ * Search for similar vectors
921
+ */
922
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
923
+ /**
924
+ * Delete a vector by ID
925
+ */
926
+ delete(vectorId: string): Promise<void>;
927
+ /**
928
+ * Update a vector and its payload
929
+ */
930
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
931
+ /**
932
+ * Retrieve a vector by ID
933
+ */
934
+ get(vectorId: string): Promise<VectorStoreResult | null>;
935
+ /**
936
+ * List all collections (indexes)
937
+ */
938
+ private listCols;
939
+ /**
940
+ * Delete the index
941
+ */
942
+ deleteCol(): Promise<void>;
943
+ /**
944
+ * Get information about the index
945
+ */
946
+ private colInfo;
947
+ /**
948
+ * List all vectors in the index
949
+ */
950
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
951
+ /**
952
+ * Generate a random user ID
953
+ */
954
+ private generateUUID;
955
+ /**
956
+ * Get user ID from memory_migrations collection
957
+ * Required by VectorStore interface
958
+ */
959
+ getUserId(): Promise<string>;
960
+ /**
961
+ * Set user ID in memory_migrations collection
962
+ * Required by VectorStore interface
963
+ */
964
+ setUserId(userId: string): Promise<void>;
965
+ /**
966
+ * Reset the index by deleting and recreating it
967
+ */
968
+ reset(): Promise<void>;
969
+ }
970
+
971
+ interface PGVectorConfig extends VectorStoreConfig {
972
+ dbname?: string;
973
+ user: string;
974
+ password: string;
975
+ host: string;
976
+ port: number;
977
+ embeddingModelDims: number;
978
+ diskann?: boolean;
979
+ hnsw?: boolean;
980
+ }
981
+ declare class PGVector implements VectorStore {
982
+ private client;
983
+ private collectionName;
984
+ private useDiskann;
985
+ private useHnsw;
986
+ private readonly dbName;
987
+ private config;
988
+ constructor(config: PGVectorConfig);
989
+ initialize(): Promise<void>;
990
+ private checkDatabaseExists;
991
+ private createDatabase;
992
+ private createCol;
993
+ insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
994
+ search(query: number[], limit?: number, filters?: SearchFilters): Promise<VectorStoreResult[]>;
995
+ get(vectorId: string): Promise<VectorStoreResult | null>;
996
+ update(vectorId: string, vector: number[], payload: Record<string, any>): Promise<void>;
997
+ delete(vectorId: string): Promise<void>;
998
+ deleteCol(): Promise<void>;
999
+ private listCols;
1000
+ list(filters?: SearchFilters, limit?: number): Promise<[VectorStoreResult[], number]>;
1001
+ close(): Promise<void>;
1002
+ getUserId(): Promise<string>;
1003
+ setUserId(userId: string): Promise<void>;
1004
+ }
1005
+
1006
+ interface HistoryManager {
1007
+ addHistory(memoryId: string, previousValue: string | null, newValue: string | null, action: string, createdAt?: string, updatedAt?: string, isDeleted?: number): Promise<void>;
1008
+ getHistory(memoryId: string): Promise<any[]>;
1009
+ reset(): Promise<void>;
1010
+ close(): void;
1011
+ }
1012
+
1013
+ declare class EmbedderFactory {
1014
+ static create(provider: string, config: EmbeddingConfig): Embedder;
1015
+ }
1016
+ declare class LLMFactory {
1017
+ static create(provider: string, config: LLMConfig): LLM;
1018
+ }
1019
+ declare class VectorStoreFactory {
1020
+ static create(provider: string, config: VectorStoreConfig): VectorStore;
1021
+ }
1022
+ declare class HistoryManagerFactory {
1023
+ static create(provider: string, config: HistoryStoreConfig): HistoryManager;
1024
+ }
1025
+
1026
+ export { type AddMemoryOptions, AnthropicLLM, AzureAISearch, AzureOpenAIEmbedder, type DeleteAllMemoryOptions, type Embedder, EmbedderFactory, type EmbeddingConfig, type Entity, type GetAllMemoryOptions, GoogleEmbedder, GoogleLLM, type GraphStoreConfig, GroqLLM, HistoryManagerFactory, type HistoryStoreConfig, type LLM, type LLMConfig, LLMFactory, type LLMResponse, LMStudioEmbedder, LMStudioLLM, LangchainEmbedder, LangchainLLM, LangchainVectorStore, Memory, type MemoryConfig, MemoryConfigSchema, type MemoryItem, MemoryVectorStore, type Message, MistralLLM, type MultiModalMessages, type Neo4jConfig, OllamaEmbedder, OllamaLLM, OpenAIEmbedder, OpenAILLM, OpenAIStructuredLLM, PGVector, Qdrant, RedisDB, type SearchFilters, type SearchMemoryOptions, type SearchResult, SupabaseDB, type VectorStore, type VectorStoreConfig, VectorStoreFactory, type VectorStoreResult, VectorizeDB };