mem0ai 1.0.16 → 1.0.17

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.ts +71 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mem0ai",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "The Memory Layer For Your AI Apps",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.d.ts CHANGED
@@ -7,14 +7,76 @@ declare module 'mem0ai' {
7
7
  filters?: Record<string, any>;
8
8
  }
9
9
 
10
+ enum API_VERSION {
11
+ V1 = 'v1',
12
+ V2 = 'v2',
13
+ }
14
+
15
+ export interface Messages {
16
+ role: string;
17
+ content: string;
18
+ }
19
+
20
+ export interface MemoryHistory {
21
+ id: string;
22
+ memory_id: string;
23
+ input: Array<Messages>;
24
+ old_memory: string | null;
25
+ new_memory: string | null;
26
+ user_id: string;
27
+ categories: Array<string>;
28
+ event: Event | string;
29
+ created_at: Date;
30
+ updated_at: Date;
31
+ }
32
+
10
33
  export interface SearchOptions extends MemoryOptions {
11
- api_version?: 'v1' | 'v2';
34
+ api_version?: API_VERSION | string;
12
35
  limit?: number;
13
36
  }
14
37
 
38
+ enum Event{
39
+ ADD = 'ADD',
40
+ UPDATE = 'UPDATE',
41
+ DELETE = 'DELETE',
42
+ NOOP = 'NOOP',
43
+ }
44
+
45
+ export interface MemoryData {
46
+ memory: string;
47
+ }
48
+
15
49
  export interface Memory {
16
50
  id: string;
17
- messages: Array<{ role: string; content: string }>;
51
+ messages?: Array<Messages>;
52
+ event?: Event | string;
53
+ data?: MemoryData | null;
54
+ memory?: string;
55
+ user_id?: string;
56
+ hash?: string;
57
+ categories?: Array<string>;
58
+ created_at?: Date;
59
+ updated_at?: Date;
60
+ memory_type?: string;
61
+ score?: number;
62
+ metadata?: any | null;
63
+ }
64
+
65
+ export interface User {
66
+ id: string;
67
+ name: string;
68
+ created_at: Date;
69
+ updated_at: Date;
70
+ total_memories: number;
71
+ owner: string;
72
+ type: string;
73
+ }
74
+
75
+ export interface AllUsers {
76
+ count: number;
77
+ results: Array<User>;
78
+ next: any;
79
+ previous: any;
18
80
  }
19
81
 
20
82
  export class MemoryClient {
@@ -28,21 +90,21 @@ declare module 'mem0ai' {
28
90
  add(
29
91
  messages: string | Array<{ role: string; content: string }>,
30
92
  options?: MemoryOptions
31
- ): Promise<Memory[]>;
93
+ ): Promise<Array<Memory>>;
32
94
 
33
95
  get(memoryId: string): Promise<Memory>;
34
96
 
35
- getAll(options?: MemoryOptions & { api_version?: 'v1' | 'v2' }): Promise<{ results: Memory[] }>;
97
+ getAll(options?: MemoryOptions & { api_version?: 'v1' | 'v2' }): Promise<Array<Memory>>;
36
98
 
37
- search(query: string, options?: SearchOptions): Promise<{ results: Memory[] }>;
99
+ search(query: string, options?: SearchOptions): Promise<Array<Memory>>;
38
100
 
39
- delete(memoryId: string): Promise<any>;
101
+ delete(memoryId: string): Promise<{ message: string }>;
40
102
 
41
- deleteAll(options?: MemoryOptions): Promise<any>;
103
+ deleteAll(options?: MemoryOptions): Promise<{ message: string }>;
42
104
 
43
- history(memoryId: string): Promise<any>;
105
+ history(memoryId: string): Promise<Array<MemoryHistory>>;
44
106
 
45
- users(): Promise<any>;
107
+ users(): Promise<AllUsers>;
46
108
 
47
109
  deleteUsers(): Promise<{ message: string }>;
48
110