mem0ai 2.0.1 → 2.1.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.
@@ -15,11 +15,21 @@ interface VectorStoreConfig {
15
15
  [key: string]: any;
16
16
  }
17
17
  interface LLMConfig {
18
- apiKey: string;
18
+ provider?: string;
19
+ config?: Record<string, any>;
20
+ apiKey?: string;
19
21
  model?: string;
20
22
  }
23
+ interface Neo4jConfig {
24
+ url: string;
25
+ username: string;
26
+ password: string;
27
+ }
21
28
  interface GraphStoreConfig {
22
- config?: any;
29
+ provider: string;
30
+ config: Neo4jConfig;
31
+ llm?: LLMConfig;
32
+ customPrompt?: string;
23
33
  }
24
34
  interface MemoryConfig {
25
35
  version?: string;
@@ -38,6 +48,7 @@ interface MemoryConfig {
38
48
  historyDbPath?: string;
39
49
  customPrompt?: string;
40
50
  graphStore?: GraphStoreConfig;
51
+ enableGraph?: boolean;
41
52
  }
42
53
  interface MemoryItem {
43
54
  id: string;
@@ -146,12 +157,57 @@ declare const MemoryConfigSchema: z.ZodObject<{
146
157
  }>;
147
158
  historyDbPath: z.ZodOptional<z.ZodString>;
148
159
  customPrompt: z.ZodOptional<z.ZodString>;
160
+ enableGraph: z.ZodOptional<z.ZodBoolean>;
149
161
  graphStore: z.ZodOptional<z.ZodObject<{
150
- config: z.ZodOptional<z.ZodAny>;
162
+ provider: z.ZodString;
163
+ config: z.ZodObject<{
164
+ url: z.ZodString;
165
+ username: z.ZodString;
166
+ password: z.ZodString;
167
+ }, "strip", z.ZodTypeAny, {
168
+ url: string;
169
+ username: string;
170
+ password: string;
171
+ }, {
172
+ url: string;
173
+ username: string;
174
+ password: string;
175
+ }>;
176
+ llm: z.ZodOptional<z.ZodObject<{
177
+ provider: z.ZodString;
178
+ config: z.ZodRecord<z.ZodString, z.ZodAny>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ provider: string;
181
+ config: Record<string, any>;
182
+ }, {
183
+ provider: string;
184
+ config: Record<string, any>;
185
+ }>>;
186
+ customPrompt: z.ZodOptional<z.ZodString>;
151
187
  }, "strip", z.ZodTypeAny, {
152
- config?: any;
188
+ provider: string;
189
+ config: {
190
+ url: string;
191
+ username: string;
192
+ password: string;
193
+ };
194
+ llm?: {
195
+ provider: string;
196
+ config: Record<string, any>;
197
+ } | undefined;
198
+ customPrompt?: string | undefined;
153
199
  }, {
154
- config?: any;
200
+ provider: string;
201
+ config: {
202
+ url: string;
203
+ username: string;
204
+ password: string;
205
+ };
206
+ llm?: {
207
+ provider: string;
208
+ config: Record<string, any>;
209
+ } | undefined;
210
+ customPrompt?: string | undefined;
155
211
  }>>;
156
212
  }, "strip", z.ZodTypeAny, {
157
213
  embedder: {
@@ -180,8 +236,19 @@ declare const MemoryConfigSchema: z.ZodObject<{
180
236
  version?: string | undefined;
181
237
  historyDbPath?: string | undefined;
182
238
  customPrompt?: string | undefined;
239
+ enableGraph?: boolean | undefined;
183
240
  graphStore?: {
184
- config?: any;
241
+ provider: string;
242
+ config: {
243
+ url: string;
244
+ username: string;
245
+ password: string;
246
+ };
247
+ llm?: {
248
+ provider: string;
249
+ config: Record<string, any>;
250
+ } | undefined;
251
+ customPrompt?: string | undefined;
185
252
  } | undefined;
186
253
  }, {
187
254
  embedder: {
@@ -210,8 +277,19 @@ declare const MemoryConfigSchema: z.ZodObject<{
210
277
  version?: string | undefined;
211
278
  historyDbPath?: string | undefined;
212
279
  customPrompt?: string | undefined;
280
+ enableGraph?: boolean | undefined;
213
281
  graphStore?: {
214
- config?: any;
282
+ provider: string;
283
+ config: {
284
+ url: string;
285
+ username: string;
286
+ password: string;
287
+ };
288
+ llm?: {
289
+ provider: string;
290
+ config: Record<string, any>;
291
+ } | undefined;
292
+ customPrompt?: string | undefined;
215
293
  } | undefined;
216
294
  }>;
217
295
 
@@ -226,7 +304,6 @@ interface AddMemoryOptions extends Entity {
226
304
  prompt?: string;
227
305
  }
228
306
  interface SearchMemoryOptions extends Entity {
229
- query: string;
230
307
  limit?: number;
231
308
  filters?: SearchFilters;
232
309
  }
@@ -245,6 +322,8 @@ declare class Memory {
245
322
  private db;
246
323
  private collectionName;
247
324
  private apiVersion;
325
+ private graphMemory?;
326
+ private enableGraph;
248
327
  constructor(config?: Partial<MemoryConfig>);
249
328
  static fromConfig(configDict: Record<string, any>): Memory;
250
329
  add(messages: string | Message[], config: AddMemoryOptions): Promise<SearchResult>;
@@ -284,11 +363,18 @@ declare class OpenAIEmbedder implements Embedder {
284
363
  interface LLMResponse {
285
364
  content: string;
286
365
  role: string;
366
+ toolCalls?: Array<{
367
+ name: string;
368
+ arguments: string;
369
+ }>;
287
370
  }
288
371
  interface LLM {
289
- generateResponse(messages: Message[], responseFormat?: {
372
+ generateResponse(messages: Array<{
373
+ role: string;
374
+ content: string;
375
+ }>, response_format: {
290
376
  type: string;
291
- }): Promise<string>;
377
+ }, tools?: any[]): Promise<any>;
292
378
  generateChat(messages: Message[]): Promise<LLMResponse>;
293
379
  }
294
380
 
@@ -298,17 +384,17 @@ declare class OpenAILLM implements LLM {
298
384
  constructor(config: LLMConfig);
299
385
  generateResponse(messages: Message[], responseFormat?: {
300
386
  type: string;
301
- }): Promise<string>;
387
+ }, tools?: any[]): Promise<string | LLMResponse>;
302
388
  generateChat(messages: Message[]): Promise<LLMResponse>;
303
389
  }
304
390
 
305
391
  declare class OpenAIStructuredLLM implements LLM {
306
- private client;
392
+ private openai;
307
393
  private model;
308
394
  constructor(config: LLMConfig);
309
395
  generateResponse(messages: Message[], responseFormat?: {
310
396
  type: string;
311
- }): Promise<string>;
397
+ } | null, tools?: any[]): Promise<string | LLMResponse>;
312
398
  generateChat(messages: Message[]): Promise<LLMResponse>;
313
399
  }
314
400
 
@@ -343,9 +429,14 @@ interface VectorStore {
343
429
  }
344
430
 
345
431
  declare class MemoryVectorStore implements VectorStore {
346
- private vectors;
432
+ private db;
347
433
  private dimension;
434
+ private dbPath;
348
435
  constructor(config: VectorStoreConfig);
436
+ private init;
437
+ private run;
438
+ private all;
439
+ private getOne;
349
440
  private cosineSimilarity;
350
441
  private filterVector;
351
442
  insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
@@ -418,4 +509,4 @@ declare class VectorStoreFactory {
418
509
  static create(provider: string, config: VectorStoreConfig): VectorStore;
419
510
  }
420
511
 
421
- export { type AddMemoryOptions, AnthropicLLM, type DeleteAllMemoryOptions, type Embedder, EmbedderFactory, type EmbeddingConfig, type Entity, type GetAllMemoryOptions, type GraphStoreConfig, GroqLLM, type LLM, type LLMConfig, LLMFactory, type LLMResponse, Memory, type MemoryConfig, MemoryConfigSchema, type MemoryItem, MemoryVectorStore, type Message, OpenAIEmbedder, OpenAILLM, OpenAIStructuredLLM, Qdrant, RedisDB, type SearchFilters, type SearchMemoryOptions, type SearchResult, type VectorStore, type VectorStoreConfig, VectorStoreFactory, type VectorStoreResult };
512
+ export { type AddMemoryOptions, AnthropicLLM, type DeleteAllMemoryOptions, type Embedder, EmbedderFactory, type EmbeddingConfig, type Entity, type GetAllMemoryOptions, type GraphStoreConfig, GroqLLM, type LLM, type LLMConfig, LLMFactory, type LLMResponse, Memory, type MemoryConfig, MemoryConfigSchema, type MemoryItem, MemoryVectorStore, type Message, type Neo4jConfig, OpenAIEmbedder, OpenAILLM, OpenAIStructuredLLM, Qdrant, RedisDB, type SearchFilters, type SearchMemoryOptions, type SearchResult, type VectorStore, type VectorStoreConfig, VectorStoreFactory, type VectorStoreResult };
@@ -15,11 +15,21 @@ interface VectorStoreConfig {
15
15
  [key: string]: any;
16
16
  }
17
17
  interface LLMConfig {
18
- apiKey: string;
18
+ provider?: string;
19
+ config?: Record<string, any>;
20
+ apiKey?: string;
19
21
  model?: string;
20
22
  }
23
+ interface Neo4jConfig {
24
+ url: string;
25
+ username: string;
26
+ password: string;
27
+ }
21
28
  interface GraphStoreConfig {
22
- config?: any;
29
+ provider: string;
30
+ config: Neo4jConfig;
31
+ llm?: LLMConfig;
32
+ customPrompt?: string;
23
33
  }
24
34
  interface MemoryConfig {
25
35
  version?: string;
@@ -38,6 +48,7 @@ interface MemoryConfig {
38
48
  historyDbPath?: string;
39
49
  customPrompt?: string;
40
50
  graphStore?: GraphStoreConfig;
51
+ enableGraph?: boolean;
41
52
  }
42
53
  interface MemoryItem {
43
54
  id: string;
@@ -146,12 +157,57 @@ declare const MemoryConfigSchema: z.ZodObject<{
146
157
  }>;
147
158
  historyDbPath: z.ZodOptional<z.ZodString>;
148
159
  customPrompt: z.ZodOptional<z.ZodString>;
160
+ enableGraph: z.ZodOptional<z.ZodBoolean>;
149
161
  graphStore: z.ZodOptional<z.ZodObject<{
150
- config: z.ZodOptional<z.ZodAny>;
162
+ provider: z.ZodString;
163
+ config: z.ZodObject<{
164
+ url: z.ZodString;
165
+ username: z.ZodString;
166
+ password: z.ZodString;
167
+ }, "strip", z.ZodTypeAny, {
168
+ url: string;
169
+ username: string;
170
+ password: string;
171
+ }, {
172
+ url: string;
173
+ username: string;
174
+ password: string;
175
+ }>;
176
+ llm: z.ZodOptional<z.ZodObject<{
177
+ provider: z.ZodString;
178
+ config: z.ZodRecord<z.ZodString, z.ZodAny>;
179
+ }, "strip", z.ZodTypeAny, {
180
+ provider: string;
181
+ config: Record<string, any>;
182
+ }, {
183
+ provider: string;
184
+ config: Record<string, any>;
185
+ }>>;
186
+ customPrompt: z.ZodOptional<z.ZodString>;
151
187
  }, "strip", z.ZodTypeAny, {
152
- config?: any;
188
+ provider: string;
189
+ config: {
190
+ url: string;
191
+ username: string;
192
+ password: string;
193
+ };
194
+ llm?: {
195
+ provider: string;
196
+ config: Record<string, any>;
197
+ } | undefined;
198
+ customPrompt?: string | undefined;
153
199
  }, {
154
- config?: any;
200
+ provider: string;
201
+ config: {
202
+ url: string;
203
+ username: string;
204
+ password: string;
205
+ };
206
+ llm?: {
207
+ provider: string;
208
+ config: Record<string, any>;
209
+ } | undefined;
210
+ customPrompt?: string | undefined;
155
211
  }>>;
156
212
  }, "strip", z.ZodTypeAny, {
157
213
  embedder: {
@@ -180,8 +236,19 @@ declare const MemoryConfigSchema: z.ZodObject<{
180
236
  version?: string | undefined;
181
237
  historyDbPath?: string | undefined;
182
238
  customPrompt?: string | undefined;
239
+ enableGraph?: boolean | undefined;
183
240
  graphStore?: {
184
- config?: any;
241
+ provider: string;
242
+ config: {
243
+ url: string;
244
+ username: string;
245
+ password: string;
246
+ };
247
+ llm?: {
248
+ provider: string;
249
+ config: Record<string, any>;
250
+ } | undefined;
251
+ customPrompt?: string | undefined;
185
252
  } | undefined;
186
253
  }, {
187
254
  embedder: {
@@ -210,8 +277,19 @@ declare const MemoryConfigSchema: z.ZodObject<{
210
277
  version?: string | undefined;
211
278
  historyDbPath?: string | undefined;
212
279
  customPrompt?: string | undefined;
280
+ enableGraph?: boolean | undefined;
213
281
  graphStore?: {
214
- config?: any;
282
+ provider: string;
283
+ config: {
284
+ url: string;
285
+ username: string;
286
+ password: string;
287
+ };
288
+ llm?: {
289
+ provider: string;
290
+ config: Record<string, any>;
291
+ } | undefined;
292
+ customPrompt?: string | undefined;
215
293
  } | undefined;
216
294
  }>;
217
295
 
@@ -226,7 +304,6 @@ interface AddMemoryOptions extends Entity {
226
304
  prompt?: string;
227
305
  }
228
306
  interface SearchMemoryOptions extends Entity {
229
- query: string;
230
307
  limit?: number;
231
308
  filters?: SearchFilters;
232
309
  }
@@ -245,6 +322,8 @@ declare class Memory {
245
322
  private db;
246
323
  private collectionName;
247
324
  private apiVersion;
325
+ private graphMemory?;
326
+ private enableGraph;
248
327
  constructor(config?: Partial<MemoryConfig>);
249
328
  static fromConfig(configDict: Record<string, any>): Memory;
250
329
  add(messages: string | Message[], config: AddMemoryOptions): Promise<SearchResult>;
@@ -284,11 +363,18 @@ declare class OpenAIEmbedder implements Embedder {
284
363
  interface LLMResponse {
285
364
  content: string;
286
365
  role: string;
366
+ toolCalls?: Array<{
367
+ name: string;
368
+ arguments: string;
369
+ }>;
287
370
  }
288
371
  interface LLM {
289
- generateResponse(messages: Message[], responseFormat?: {
372
+ generateResponse(messages: Array<{
373
+ role: string;
374
+ content: string;
375
+ }>, response_format: {
290
376
  type: string;
291
- }): Promise<string>;
377
+ }, tools?: any[]): Promise<any>;
292
378
  generateChat(messages: Message[]): Promise<LLMResponse>;
293
379
  }
294
380
 
@@ -298,17 +384,17 @@ declare class OpenAILLM implements LLM {
298
384
  constructor(config: LLMConfig);
299
385
  generateResponse(messages: Message[], responseFormat?: {
300
386
  type: string;
301
- }): Promise<string>;
387
+ }, tools?: any[]): Promise<string | LLMResponse>;
302
388
  generateChat(messages: Message[]): Promise<LLMResponse>;
303
389
  }
304
390
 
305
391
  declare class OpenAIStructuredLLM implements LLM {
306
- private client;
392
+ private openai;
307
393
  private model;
308
394
  constructor(config: LLMConfig);
309
395
  generateResponse(messages: Message[], responseFormat?: {
310
396
  type: string;
311
- }): Promise<string>;
397
+ } | null, tools?: any[]): Promise<string | LLMResponse>;
312
398
  generateChat(messages: Message[]): Promise<LLMResponse>;
313
399
  }
314
400
 
@@ -343,9 +429,14 @@ interface VectorStore {
343
429
  }
344
430
 
345
431
  declare class MemoryVectorStore implements VectorStore {
346
- private vectors;
432
+ private db;
347
433
  private dimension;
434
+ private dbPath;
348
435
  constructor(config: VectorStoreConfig);
436
+ private init;
437
+ private run;
438
+ private all;
439
+ private getOne;
349
440
  private cosineSimilarity;
350
441
  private filterVector;
351
442
  insert(vectors: number[][], ids: string[], payloads: Record<string, any>[]): Promise<void>;
@@ -418,4 +509,4 @@ declare class VectorStoreFactory {
418
509
  static create(provider: string, config: VectorStoreConfig): VectorStore;
419
510
  }
420
511
 
421
- export { type AddMemoryOptions, AnthropicLLM, type DeleteAllMemoryOptions, type Embedder, EmbedderFactory, type EmbeddingConfig, type Entity, type GetAllMemoryOptions, type GraphStoreConfig, GroqLLM, type LLM, type LLMConfig, LLMFactory, type LLMResponse, Memory, type MemoryConfig, MemoryConfigSchema, type MemoryItem, MemoryVectorStore, type Message, OpenAIEmbedder, OpenAILLM, OpenAIStructuredLLM, Qdrant, RedisDB, type SearchFilters, type SearchMemoryOptions, type SearchResult, type VectorStore, type VectorStoreConfig, VectorStoreFactory, type VectorStoreResult };
512
+ export { type AddMemoryOptions, AnthropicLLM, type DeleteAllMemoryOptions, type Embedder, EmbedderFactory, type EmbeddingConfig, type Entity, type GetAllMemoryOptions, type GraphStoreConfig, GroqLLM, type LLM, type LLMConfig, LLMFactory, type LLMResponse, Memory, type MemoryConfig, MemoryConfigSchema, type MemoryItem, MemoryVectorStore, type Message, type Neo4jConfig, OpenAIEmbedder, OpenAILLM, OpenAIStructuredLLM, Qdrant, RedisDB, type SearchFilters, type SearchMemoryOptions, type SearchResult, type VectorStore, type VectorStoreConfig, VectorStoreFactory, type VectorStoreResult };