@ztorchan/mem0ai 2.4.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/README.md +64 -0
- package/dist/index.d.mts +281 -0
- package/dist/index.d.ts +281 -0
- package/dist/index.js +724 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +687 -0
- package/dist/index.mjs.map +1 -0
- package/dist/oss/index.d.mts +952 -0
- package/dist/oss/index.d.ts +952 -0
- package/dist/oss/index.js +5563 -0
- package/dist/oss/index.js.map +1 -0
- package/dist/oss/index.mjs +5509 -0
- package/dist/oss/index.mjs.map +1 -0
- package/package.json +133 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Mem0 - The Memory Layer for Your AI Apps
|
|
2
|
+
|
|
3
|
+
Mem0 is a self-improving memory layer for LLM applications, enabling personalized AI experiences that save costs and delight users. We offer both cloud and open-source solutions to cater to different needs.
|
|
4
|
+
|
|
5
|
+
See the complete [OSS Docs](https://docs.mem0.ai/open-source/node-quickstart).
|
|
6
|
+
See the complete [Platform API Reference](https://docs.mem0.ai/api-reference).
|
|
7
|
+
|
|
8
|
+
## 1. Installation
|
|
9
|
+
|
|
10
|
+
For the open-source version, you can install the Mem0 package using npm:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm i mem0ai
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 2. API Key Setup
|
|
17
|
+
|
|
18
|
+
For the cloud offering, sign in to [Mem0 Platform](https://app.mem0.ai/dashboard/api-keys) to obtain your API Key.
|
|
19
|
+
|
|
20
|
+
## 3. Client Features
|
|
21
|
+
|
|
22
|
+
### Cloud Offering
|
|
23
|
+
|
|
24
|
+
The cloud version provides a comprehensive set of features, including:
|
|
25
|
+
|
|
26
|
+
- **Memory Operations**: Perform CRUD operations on memories.
|
|
27
|
+
- **Search Capabilities**: Search for relevant memories using advanced filters.
|
|
28
|
+
- **Memory History**: Track changes to memories over time.
|
|
29
|
+
- **Error Handling**: Robust error handling for API-related issues.
|
|
30
|
+
- **Async/Await Support**: All methods return promises for easy integration.
|
|
31
|
+
|
|
32
|
+
### Open-Source Offering
|
|
33
|
+
|
|
34
|
+
The open-source version includes the following top features:
|
|
35
|
+
|
|
36
|
+
- **Memory Management**: Add, update, delete, and retrieve memories.
|
|
37
|
+
- **Vector Store Integration**: Supports various vector store providers for efficient memory retrieval.
|
|
38
|
+
- **LLM Support**: Integrates with multiple LLM providers for generating responses.
|
|
39
|
+
- **Customizable Configuration**: Easily configure memory settings and providers.
|
|
40
|
+
- **SQLite Storage**: Use SQLite for memory history management.
|
|
41
|
+
|
|
42
|
+
## 4. Memory Operations
|
|
43
|
+
|
|
44
|
+
Mem0 provides a simple and customizable interface for performing memory operations. You can create long-term and short-term memories, search for relevant memories, and manage memory history.
|
|
45
|
+
|
|
46
|
+
## 5. Error Handling
|
|
47
|
+
|
|
48
|
+
The MemoryClient throws errors for any API-related issues. You can catch and handle these errors effectively.
|
|
49
|
+
|
|
50
|
+
## 6. Using with async/await
|
|
51
|
+
|
|
52
|
+
All methods of the MemoryClient return promises, allowing for seamless integration with async/await syntax.
|
|
53
|
+
|
|
54
|
+
## 7. Testing the Client
|
|
55
|
+
|
|
56
|
+
To test the MemoryClient in a Node.js environment, you can create a simple script to verify the functionality of memory operations.
|
|
57
|
+
|
|
58
|
+
## Getting Help
|
|
59
|
+
|
|
60
|
+
If you have any questions or need assistance, please reach out to us:
|
|
61
|
+
|
|
62
|
+
- Email: founders@mem0.ai
|
|
63
|
+
- [Join our discord community](https://mem0.ai/discord)
|
|
64
|
+
- GitHub Issues: [Report bugs or request features](https://github.com/mem0ai/mem0/issues)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
interface Common {
|
|
2
|
+
project_id?: string | null;
|
|
3
|
+
org_id?: string | null;
|
|
4
|
+
}
|
|
5
|
+
interface MemoryOptions {
|
|
6
|
+
api_version?: API_VERSION | string;
|
|
7
|
+
version?: API_VERSION | string;
|
|
8
|
+
user_id?: string;
|
|
9
|
+
agent_id?: string;
|
|
10
|
+
app_id?: string;
|
|
11
|
+
run_id?: string;
|
|
12
|
+
metadata?: Record<string, any>;
|
|
13
|
+
filters?: Record<string, any>;
|
|
14
|
+
org_name?: string | null;
|
|
15
|
+
project_name?: string | null;
|
|
16
|
+
org_id?: string | number | null;
|
|
17
|
+
project_id?: string | number | null;
|
|
18
|
+
infer?: boolean;
|
|
19
|
+
page?: number;
|
|
20
|
+
page_size?: number;
|
|
21
|
+
includes?: string;
|
|
22
|
+
excludes?: string;
|
|
23
|
+
enable_graph?: boolean;
|
|
24
|
+
start_date?: string;
|
|
25
|
+
end_date?: string;
|
|
26
|
+
custom_categories?: custom_categories[];
|
|
27
|
+
custom_instructions?: string;
|
|
28
|
+
timestamp?: number;
|
|
29
|
+
output_format?: string | OutputFormat;
|
|
30
|
+
async_mode?: boolean;
|
|
31
|
+
filter_memories?: boolean;
|
|
32
|
+
immutable?: boolean;
|
|
33
|
+
structured_data_schema?: Record<string, any>;
|
|
34
|
+
}
|
|
35
|
+
interface ProjectOptions {
|
|
36
|
+
fields?: string[];
|
|
37
|
+
}
|
|
38
|
+
declare enum OutputFormat {
|
|
39
|
+
V1 = "v1.0",
|
|
40
|
+
V1_1 = "v1.1"
|
|
41
|
+
}
|
|
42
|
+
declare enum API_VERSION {
|
|
43
|
+
V1 = "v1",
|
|
44
|
+
V2 = "v2"
|
|
45
|
+
}
|
|
46
|
+
declare enum Feedback {
|
|
47
|
+
POSITIVE = "POSITIVE",
|
|
48
|
+
NEGATIVE = "NEGATIVE",
|
|
49
|
+
VERY_NEGATIVE = "VERY_NEGATIVE"
|
|
50
|
+
}
|
|
51
|
+
interface MultiModalMessages {
|
|
52
|
+
type: "image_url";
|
|
53
|
+
image_url: {
|
|
54
|
+
url: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
interface Messages {
|
|
58
|
+
role: "user" | "assistant";
|
|
59
|
+
content: string | MultiModalMessages;
|
|
60
|
+
}
|
|
61
|
+
interface Message extends Messages {
|
|
62
|
+
}
|
|
63
|
+
interface MemoryHistory {
|
|
64
|
+
id: string;
|
|
65
|
+
memory_id: string;
|
|
66
|
+
input: Array<Messages>;
|
|
67
|
+
old_memory: string | null;
|
|
68
|
+
new_memory: string | null;
|
|
69
|
+
user_id: string;
|
|
70
|
+
categories: Array<string>;
|
|
71
|
+
event: Event | string;
|
|
72
|
+
created_at: Date;
|
|
73
|
+
updated_at: Date;
|
|
74
|
+
}
|
|
75
|
+
interface SearchOptions extends MemoryOptions {
|
|
76
|
+
api_version?: API_VERSION | string;
|
|
77
|
+
limit?: number;
|
|
78
|
+
enable_graph?: boolean;
|
|
79
|
+
threshold?: number;
|
|
80
|
+
top_k?: number;
|
|
81
|
+
only_metadata_based_search?: boolean;
|
|
82
|
+
keyword_search?: boolean;
|
|
83
|
+
fields?: string[];
|
|
84
|
+
categories?: string[];
|
|
85
|
+
rerank?: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare enum Event {
|
|
88
|
+
ADD = "ADD",
|
|
89
|
+
UPDATE = "UPDATE",
|
|
90
|
+
DELETE = "DELETE",
|
|
91
|
+
NOOP = "NOOP"
|
|
92
|
+
}
|
|
93
|
+
interface MemoryData {
|
|
94
|
+
memory: string;
|
|
95
|
+
}
|
|
96
|
+
interface Memory {
|
|
97
|
+
id: string;
|
|
98
|
+
messages?: Array<Messages>;
|
|
99
|
+
event?: Event | string;
|
|
100
|
+
data?: MemoryData | null;
|
|
101
|
+
memory?: string;
|
|
102
|
+
user_id?: string;
|
|
103
|
+
hash?: string;
|
|
104
|
+
categories?: Array<string>;
|
|
105
|
+
created_at?: Date;
|
|
106
|
+
updated_at?: Date;
|
|
107
|
+
memory_type?: string;
|
|
108
|
+
score?: number;
|
|
109
|
+
metadata?: any | null;
|
|
110
|
+
owner?: string | null;
|
|
111
|
+
agent_id?: string | null;
|
|
112
|
+
app_id?: string | null;
|
|
113
|
+
run_id?: string | null;
|
|
114
|
+
}
|
|
115
|
+
interface MemoryUpdateBody {
|
|
116
|
+
memoryId: string;
|
|
117
|
+
text: string;
|
|
118
|
+
}
|
|
119
|
+
interface User {
|
|
120
|
+
id: string;
|
|
121
|
+
name: string;
|
|
122
|
+
created_at: Date;
|
|
123
|
+
updated_at: Date;
|
|
124
|
+
total_memories: number;
|
|
125
|
+
owner: string;
|
|
126
|
+
type: string;
|
|
127
|
+
}
|
|
128
|
+
interface AllUsers {
|
|
129
|
+
count: number;
|
|
130
|
+
results: Array<User>;
|
|
131
|
+
next: any;
|
|
132
|
+
previous: any;
|
|
133
|
+
}
|
|
134
|
+
interface ProjectResponse {
|
|
135
|
+
custom_instructions?: string;
|
|
136
|
+
custom_categories?: string[];
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
}
|
|
139
|
+
interface custom_categories {
|
|
140
|
+
[key: string]: any;
|
|
141
|
+
}
|
|
142
|
+
interface PromptUpdatePayload {
|
|
143
|
+
custom_instructions?: string;
|
|
144
|
+
custom_categories?: custom_categories[];
|
|
145
|
+
retrieval_criteria?: any[];
|
|
146
|
+
enable_graph?: boolean;
|
|
147
|
+
version?: string;
|
|
148
|
+
inclusion_prompt?: string;
|
|
149
|
+
exclusion_prompt?: string;
|
|
150
|
+
memory_depth?: string | null;
|
|
151
|
+
usecase_setting?: string | number;
|
|
152
|
+
[key: string]: any;
|
|
153
|
+
}
|
|
154
|
+
declare enum WebhookEvent {
|
|
155
|
+
MEMORY_ADDED = "memory_add",
|
|
156
|
+
MEMORY_UPDATED = "memory_update",
|
|
157
|
+
MEMORY_DELETED = "memory_delete"
|
|
158
|
+
}
|
|
159
|
+
interface Webhook {
|
|
160
|
+
webhook_id?: string;
|
|
161
|
+
name: string;
|
|
162
|
+
url: string;
|
|
163
|
+
project?: string;
|
|
164
|
+
created_at?: Date;
|
|
165
|
+
updated_at?: Date;
|
|
166
|
+
is_active?: boolean;
|
|
167
|
+
event_types?: WebhookEvent[];
|
|
168
|
+
}
|
|
169
|
+
interface WebhookPayload {
|
|
170
|
+
eventTypes: WebhookEvent[];
|
|
171
|
+
projectId: string;
|
|
172
|
+
webhookId: string;
|
|
173
|
+
name: string;
|
|
174
|
+
url: string;
|
|
175
|
+
}
|
|
176
|
+
interface FeedbackPayload {
|
|
177
|
+
memory_id: string;
|
|
178
|
+
feedback?: Feedback | null;
|
|
179
|
+
feedback_reason?: string | null;
|
|
180
|
+
}
|
|
181
|
+
interface CreateMemoryExportPayload extends Common {
|
|
182
|
+
schema: Record<string, any>;
|
|
183
|
+
filters: Record<string, any>;
|
|
184
|
+
export_instructions?: string;
|
|
185
|
+
}
|
|
186
|
+
interface GetMemoryExportPayload extends Common {
|
|
187
|
+
filters?: Record<string, any>;
|
|
188
|
+
memory_export_id?: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface ClientOptions {
|
|
192
|
+
apiKey: string;
|
|
193
|
+
host?: string;
|
|
194
|
+
organizationName?: string;
|
|
195
|
+
projectName?: string;
|
|
196
|
+
organizationId?: string;
|
|
197
|
+
projectId?: string;
|
|
198
|
+
}
|
|
199
|
+
declare class MemoryClient {
|
|
200
|
+
apiKey: string;
|
|
201
|
+
host: string;
|
|
202
|
+
organizationName: string | null;
|
|
203
|
+
projectName: string | null;
|
|
204
|
+
organizationId: string | number | null;
|
|
205
|
+
projectId: string | number | null;
|
|
206
|
+
headers: Record<string, string>;
|
|
207
|
+
client: any;
|
|
208
|
+
telemetryId: string;
|
|
209
|
+
_validateApiKey(): any;
|
|
210
|
+
_validateOrgProject(): void;
|
|
211
|
+
constructor(options: ClientOptions);
|
|
212
|
+
private _initializeClient;
|
|
213
|
+
private _captureEvent;
|
|
214
|
+
_fetchWithErrorHandling(url: string, options: any): Promise<any>;
|
|
215
|
+
_preparePayload(messages: Array<Message>, options: MemoryOptions): object;
|
|
216
|
+
_prepareParams(options: MemoryOptions): object;
|
|
217
|
+
ping(): Promise<void>;
|
|
218
|
+
add(messages: Array<Message>, options?: MemoryOptions & Record<string, any>): Promise<Array<Memory>>;
|
|
219
|
+
update(memoryId: string, { text, metadata, timestamp, }: {
|
|
220
|
+
text?: string;
|
|
221
|
+
metadata?: Record<string, any>;
|
|
222
|
+
timestamp?: number | string;
|
|
223
|
+
}): Promise<Array<Memory>>;
|
|
224
|
+
get(memoryId: string): Promise<Memory>;
|
|
225
|
+
getAll(options?: SearchOptions): Promise<Array<Memory>>;
|
|
226
|
+
search(query: string, options?: SearchOptions & Record<string, any>): Promise<Array<Memory>>;
|
|
227
|
+
delete(memoryId: string): Promise<{
|
|
228
|
+
message: string;
|
|
229
|
+
}>;
|
|
230
|
+
deleteAll(options?: MemoryOptions): Promise<{
|
|
231
|
+
message: string;
|
|
232
|
+
}>;
|
|
233
|
+
history(memoryId: string): Promise<Array<MemoryHistory>>;
|
|
234
|
+
users(): Promise<AllUsers>;
|
|
235
|
+
/**
|
|
236
|
+
* @deprecated The method should not be used, use `deleteUsers` instead. This will be removed in version 2.2.0.
|
|
237
|
+
*/
|
|
238
|
+
deleteUser(data: {
|
|
239
|
+
entity_id: number;
|
|
240
|
+
entity_type: string;
|
|
241
|
+
}): Promise<{
|
|
242
|
+
message: string;
|
|
243
|
+
}>;
|
|
244
|
+
deleteUsers(params?: {
|
|
245
|
+
user_id?: string;
|
|
246
|
+
agent_id?: string;
|
|
247
|
+
app_id?: string;
|
|
248
|
+
run_id?: string;
|
|
249
|
+
}): Promise<{
|
|
250
|
+
message: string;
|
|
251
|
+
}>;
|
|
252
|
+
batchUpdate(memories: Array<MemoryUpdateBody>): Promise<string>;
|
|
253
|
+
batchDelete(memories: Array<string>): Promise<string>;
|
|
254
|
+
getProject(options: ProjectOptions): Promise<ProjectResponse>;
|
|
255
|
+
updateProject(prompts: PromptUpdatePayload): Promise<Record<string, any>>;
|
|
256
|
+
getWebhooks(data?: {
|
|
257
|
+
projectId?: string;
|
|
258
|
+
}): Promise<Array<Webhook>>;
|
|
259
|
+
createWebhook(webhook: WebhookPayload): Promise<Webhook>;
|
|
260
|
+
updateWebhook(webhook: WebhookPayload): Promise<{
|
|
261
|
+
message: string;
|
|
262
|
+
}>;
|
|
263
|
+
deleteWebhook(data: {
|
|
264
|
+
webhookId: string;
|
|
265
|
+
}): Promise<{
|
|
266
|
+
message: string;
|
|
267
|
+
}>;
|
|
268
|
+
feedback(data: FeedbackPayload): Promise<{
|
|
269
|
+
message: string;
|
|
270
|
+
}>;
|
|
271
|
+
createMemoryExport(data: CreateMemoryExportPayload): Promise<{
|
|
272
|
+
message: string;
|
|
273
|
+
id: string;
|
|
274
|
+
}>;
|
|
275
|
+
getMemoryExport(data: GetMemoryExportPayload): Promise<{
|
|
276
|
+
message: string;
|
|
277
|
+
id: string;
|
|
278
|
+
}>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export { type AllUsers, Feedback, type FeedbackPayload, type Memory, MemoryClient, type MemoryHistory, type MemoryOptions, type MemoryUpdateBody, type Message, type Messages, type ProjectOptions, type ProjectResponse, type PromptUpdatePayload, type SearchOptions, type User, type Webhook, type WebhookPayload, MemoryClient as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
interface Common {
|
|
2
|
+
project_id?: string | null;
|
|
3
|
+
org_id?: string | null;
|
|
4
|
+
}
|
|
5
|
+
interface MemoryOptions {
|
|
6
|
+
api_version?: API_VERSION | string;
|
|
7
|
+
version?: API_VERSION | string;
|
|
8
|
+
user_id?: string;
|
|
9
|
+
agent_id?: string;
|
|
10
|
+
app_id?: string;
|
|
11
|
+
run_id?: string;
|
|
12
|
+
metadata?: Record<string, any>;
|
|
13
|
+
filters?: Record<string, any>;
|
|
14
|
+
org_name?: string | null;
|
|
15
|
+
project_name?: string | null;
|
|
16
|
+
org_id?: string | number | null;
|
|
17
|
+
project_id?: string | number | null;
|
|
18
|
+
infer?: boolean;
|
|
19
|
+
page?: number;
|
|
20
|
+
page_size?: number;
|
|
21
|
+
includes?: string;
|
|
22
|
+
excludes?: string;
|
|
23
|
+
enable_graph?: boolean;
|
|
24
|
+
start_date?: string;
|
|
25
|
+
end_date?: string;
|
|
26
|
+
custom_categories?: custom_categories[];
|
|
27
|
+
custom_instructions?: string;
|
|
28
|
+
timestamp?: number;
|
|
29
|
+
output_format?: string | OutputFormat;
|
|
30
|
+
async_mode?: boolean;
|
|
31
|
+
filter_memories?: boolean;
|
|
32
|
+
immutable?: boolean;
|
|
33
|
+
structured_data_schema?: Record<string, any>;
|
|
34
|
+
}
|
|
35
|
+
interface ProjectOptions {
|
|
36
|
+
fields?: string[];
|
|
37
|
+
}
|
|
38
|
+
declare enum OutputFormat {
|
|
39
|
+
V1 = "v1.0",
|
|
40
|
+
V1_1 = "v1.1"
|
|
41
|
+
}
|
|
42
|
+
declare enum API_VERSION {
|
|
43
|
+
V1 = "v1",
|
|
44
|
+
V2 = "v2"
|
|
45
|
+
}
|
|
46
|
+
declare enum Feedback {
|
|
47
|
+
POSITIVE = "POSITIVE",
|
|
48
|
+
NEGATIVE = "NEGATIVE",
|
|
49
|
+
VERY_NEGATIVE = "VERY_NEGATIVE"
|
|
50
|
+
}
|
|
51
|
+
interface MultiModalMessages {
|
|
52
|
+
type: "image_url";
|
|
53
|
+
image_url: {
|
|
54
|
+
url: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
interface Messages {
|
|
58
|
+
role: "user" | "assistant";
|
|
59
|
+
content: string | MultiModalMessages;
|
|
60
|
+
}
|
|
61
|
+
interface Message extends Messages {
|
|
62
|
+
}
|
|
63
|
+
interface MemoryHistory {
|
|
64
|
+
id: string;
|
|
65
|
+
memory_id: string;
|
|
66
|
+
input: Array<Messages>;
|
|
67
|
+
old_memory: string | null;
|
|
68
|
+
new_memory: string | null;
|
|
69
|
+
user_id: string;
|
|
70
|
+
categories: Array<string>;
|
|
71
|
+
event: Event | string;
|
|
72
|
+
created_at: Date;
|
|
73
|
+
updated_at: Date;
|
|
74
|
+
}
|
|
75
|
+
interface SearchOptions extends MemoryOptions {
|
|
76
|
+
api_version?: API_VERSION | string;
|
|
77
|
+
limit?: number;
|
|
78
|
+
enable_graph?: boolean;
|
|
79
|
+
threshold?: number;
|
|
80
|
+
top_k?: number;
|
|
81
|
+
only_metadata_based_search?: boolean;
|
|
82
|
+
keyword_search?: boolean;
|
|
83
|
+
fields?: string[];
|
|
84
|
+
categories?: string[];
|
|
85
|
+
rerank?: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare enum Event {
|
|
88
|
+
ADD = "ADD",
|
|
89
|
+
UPDATE = "UPDATE",
|
|
90
|
+
DELETE = "DELETE",
|
|
91
|
+
NOOP = "NOOP"
|
|
92
|
+
}
|
|
93
|
+
interface MemoryData {
|
|
94
|
+
memory: string;
|
|
95
|
+
}
|
|
96
|
+
interface Memory {
|
|
97
|
+
id: string;
|
|
98
|
+
messages?: Array<Messages>;
|
|
99
|
+
event?: Event | string;
|
|
100
|
+
data?: MemoryData | null;
|
|
101
|
+
memory?: string;
|
|
102
|
+
user_id?: string;
|
|
103
|
+
hash?: string;
|
|
104
|
+
categories?: Array<string>;
|
|
105
|
+
created_at?: Date;
|
|
106
|
+
updated_at?: Date;
|
|
107
|
+
memory_type?: string;
|
|
108
|
+
score?: number;
|
|
109
|
+
metadata?: any | null;
|
|
110
|
+
owner?: string | null;
|
|
111
|
+
agent_id?: string | null;
|
|
112
|
+
app_id?: string | null;
|
|
113
|
+
run_id?: string | null;
|
|
114
|
+
}
|
|
115
|
+
interface MemoryUpdateBody {
|
|
116
|
+
memoryId: string;
|
|
117
|
+
text: string;
|
|
118
|
+
}
|
|
119
|
+
interface User {
|
|
120
|
+
id: string;
|
|
121
|
+
name: string;
|
|
122
|
+
created_at: Date;
|
|
123
|
+
updated_at: Date;
|
|
124
|
+
total_memories: number;
|
|
125
|
+
owner: string;
|
|
126
|
+
type: string;
|
|
127
|
+
}
|
|
128
|
+
interface AllUsers {
|
|
129
|
+
count: number;
|
|
130
|
+
results: Array<User>;
|
|
131
|
+
next: any;
|
|
132
|
+
previous: any;
|
|
133
|
+
}
|
|
134
|
+
interface ProjectResponse {
|
|
135
|
+
custom_instructions?: string;
|
|
136
|
+
custom_categories?: string[];
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
}
|
|
139
|
+
interface custom_categories {
|
|
140
|
+
[key: string]: any;
|
|
141
|
+
}
|
|
142
|
+
interface PromptUpdatePayload {
|
|
143
|
+
custom_instructions?: string;
|
|
144
|
+
custom_categories?: custom_categories[];
|
|
145
|
+
retrieval_criteria?: any[];
|
|
146
|
+
enable_graph?: boolean;
|
|
147
|
+
version?: string;
|
|
148
|
+
inclusion_prompt?: string;
|
|
149
|
+
exclusion_prompt?: string;
|
|
150
|
+
memory_depth?: string | null;
|
|
151
|
+
usecase_setting?: string | number;
|
|
152
|
+
[key: string]: any;
|
|
153
|
+
}
|
|
154
|
+
declare enum WebhookEvent {
|
|
155
|
+
MEMORY_ADDED = "memory_add",
|
|
156
|
+
MEMORY_UPDATED = "memory_update",
|
|
157
|
+
MEMORY_DELETED = "memory_delete"
|
|
158
|
+
}
|
|
159
|
+
interface Webhook {
|
|
160
|
+
webhook_id?: string;
|
|
161
|
+
name: string;
|
|
162
|
+
url: string;
|
|
163
|
+
project?: string;
|
|
164
|
+
created_at?: Date;
|
|
165
|
+
updated_at?: Date;
|
|
166
|
+
is_active?: boolean;
|
|
167
|
+
event_types?: WebhookEvent[];
|
|
168
|
+
}
|
|
169
|
+
interface WebhookPayload {
|
|
170
|
+
eventTypes: WebhookEvent[];
|
|
171
|
+
projectId: string;
|
|
172
|
+
webhookId: string;
|
|
173
|
+
name: string;
|
|
174
|
+
url: string;
|
|
175
|
+
}
|
|
176
|
+
interface FeedbackPayload {
|
|
177
|
+
memory_id: string;
|
|
178
|
+
feedback?: Feedback | null;
|
|
179
|
+
feedback_reason?: string | null;
|
|
180
|
+
}
|
|
181
|
+
interface CreateMemoryExportPayload extends Common {
|
|
182
|
+
schema: Record<string, any>;
|
|
183
|
+
filters: Record<string, any>;
|
|
184
|
+
export_instructions?: string;
|
|
185
|
+
}
|
|
186
|
+
interface GetMemoryExportPayload extends Common {
|
|
187
|
+
filters?: Record<string, any>;
|
|
188
|
+
memory_export_id?: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface ClientOptions {
|
|
192
|
+
apiKey: string;
|
|
193
|
+
host?: string;
|
|
194
|
+
organizationName?: string;
|
|
195
|
+
projectName?: string;
|
|
196
|
+
organizationId?: string;
|
|
197
|
+
projectId?: string;
|
|
198
|
+
}
|
|
199
|
+
declare class MemoryClient {
|
|
200
|
+
apiKey: string;
|
|
201
|
+
host: string;
|
|
202
|
+
organizationName: string | null;
|
|
203
|
+
projectName: string | null;
|
|
204
|
+
organizationId: string | number | null;
|
|
205
|
+
projectId: string | number | null;
|
|
206
|
+
headers: Record<string, string>;
|
|
207
|
+
client: any;
|
|
208
|
+
telemetryId: string;
|
|
209
|
+
_validateApiKey(): any;
|
|
210
|
+
_validateOrgProject(): void;
|
|
211
|
+
constructor(options: ClientOptions);
|
|
212
|
+
private _initializeClient;
|
|
213
|
+
private _captureEvent;
|
|
214
|
+
_fetchWithErrorHandling(url: string, options: any): Promise<any>;
|
|
215
|
+
_preparePayload(messages: Array<Message>, options: MemoryOptions): object;
|
|
216
|
+
_prepareParams(options: MemoryOptions): object;
|
|
217
|
+
ping(): Promise<void>;
|
|
218
|
+
add(messages: Array<Message>, options?: MemoryOptions & Record<string, any>): Promise<Array<Memory>>;
|
|
219
|
+
update(memoryId: string, { text, metadata, timestamp, }: {
|
|
220
|
+
text?: string;
|
|
221
|
+
metadata?: Record<string, any>;
|
|
222
|
+
timestamp?: number | string;
|
|
223
|
+
}): Promise<Array<Memory>>;
|
|
224
|
+
get(memoryId: string): Promise<Memory>;
|
|
225
|
+
getAll(options?: SearchOptions): Promise<Array<Memory>>;
|
|
226
|
+
search(query: string, options?: SearchOptions & Record<string, any>): Promise<Array<Memory>>;
|
|
227
|
+
delete(memoryId: string): Promise<{
|
|
228
|
+
message: string;
|
|
229
|
+
}>;
|
|
230
|
+
deleteAll(options?: MemoryOptions): Promise<{
|
|
231
|
+
message: string;
|
|
232
|
+
}>;
|
|
233
|
+
history(memoryId: string): Promise<Array<MemoryHistory>>;
|
|
234
|
+
users(): Promise<AllUsers>;
|
|
235
|
+
/**
|
|
236
|
+
* @deprecated The method should not be used, use `deleteUsers` instead. This will be removed in version 2.2.0.
|
|
237
|
+
*/
|
|
238
|
+
deleteUser(data: {
|
|
239
|
+
entity_id: number;
|
|
240
|
+
entity_type: string;
|
|
241
|
+
}): Promise<{
|
|
242
|
+
message: string;
|
|
243
|
+
}>;
|
|
244
|
+
deleteUsers(params?: {
|
|
245
|
+
user_id?: string;
|
|
246
|
+
agent_id?: string;
|
|
247
|
+
app_id?: string;
|
|
248
|
+
run_id?: string;
|
|
249
|
+
}): Promise<{
|
|
250
|
+
message: string;
|
|
251
|
+
}>;
|
|
252
|
+
batchUpdate(memories: Array<MemoryUpdateBody>): Promise<string>;
|
|
253
|
+
batchDelete(memories: Array<string>): Promise<string>;
|
|
254
|
+
getProject(options: ProjectOptions): Promise<ProjectResponse>;
|
|
255
|
+
updateProject(prompts: PromptUpdatePayload): Promise<Record<string, any>>;
|
|
256
|
+
getWebhooks(data?: {
|
|
257
|
+
projectId?: string;
|
|
258
|
+
}): Promise<Array<Webhook>>;
|
|
259
|
+
createWebhook(webhook: WebhookPayload): Promise<Webhook>;
|
|
260
|
+
updateWebhook(webhook: WebhookPayload): Promise<{
|
|
261
|
+
message: string;
|
|
262
|
+
}>;
|
|
263
|
+
deleteWebhook(data: {
|
|
264
|
+
webhookId: string;
|
|
265
|
+
}): Promise<{
|
|
266
|
+
message: string;
|
|
267
|
+
}>;
|
|
268
|
+
feedback(data: FeedbackPayload): Promise<{
|
|
269
|
+
message: string;
|
|
270
|
+
}>;
|
|
271
|
+
createMemoryExport(data: CreateMemoryExportPayload): Promise<{
|
|
272
|
+
message: string;
|
|
273
|
+
id: string;
|
|
274
|
+
}>;
|
|
275
|
+
getMemoryExport(data: GetMemoryExportPayload): Promise<{
|
|
276
|
+
message: string;
|
|
277
|
+
id: string;
|
|
278
|
+
}>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export { type AllUsers, Feedback, type FeedbackPayload, type Memory, MemoryClient, type MemoryHistory, type MemoryOptions, type MemoryUpdateBody, type Message, type Messages, type ProjectOptions, type ProjectResponse, type PromptUpdatePayload, type SearchOptions, type User, type Webhook, type WebhookPayload, MemoryClient as default };
|