mem0ai 1.0.13 → 1.0.14

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 CHANGED
@@ -1,5 +1,4 @@
1
- # Mem0 - The Memory layer for your AI apps
2
-
1
+ # Mem0 - The Memory Layer for Your AI Apps
3
2
 
4
3
  Mem0 is a self-improving memory layer for LLM applications, enabling personalized AI experiences that save costs and delight users.
5
4
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mem0ai",
3
- "version": "1.0.13",
4
- "description": "The Memory layer for your AI apps",
3
+ "version": "1.0.14",
4
+ "description": "The Memory Layer For Your AI Apps",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -18,9 +18,6 @@
18
18
  ],
19
19
  "author": "Deshraj Yadav",
20
20
  "license": "Apache-2.0",
21
- "dependencies": {
22
- "posthog-js": "^1.167.0"
23
- },
24
21
  "files": [
25
22
  "src/",
26
23
  "package.json",
package/src/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { telemetry, captureClientEvent } from './telemetry.js';
2
1
  import crypto from 'crypto';
3
2
 
4
3
  class APIError extends Error {
@@ -23,7 +22,6 @@ class MemoryClient {
23
22
  this.host = host;
24
23
  this.organizationName = organizationName;
25
24
  this.projectName = projectName;
26
- this.telemetryId = crypto.createHash('md5').update(this.apiKey).digest('hex');
27
25
 
28
26
  this.headers = {
29
27
  'Authorization': `Token ${this.apiKey}`,
@@ -31,14 +29,6 @@ class MemoryClient {
31
29
  };
32
30
 
33
31
  this._validateApiKey();
34
-
35
- captureClientEvent('init', this, {
36
- host: this.host,
37
- organization_name: this.organizationName,
38
- project_name: this.projectName,
39
- });
40
-
41
- this._wrapMethods();
42
32
  }
43
33
 
44
34
  _validateApiKey() {
@@ -71,7 +61,6 @@ class MemoryClient {
71
61
  headers: this.headers,
72
62
  body: JSON.stringify(payload)
73
63
  });
74
- captureClientEvent('add', this, { messages_count: messages.length });
75
64
  return response;
76
65
  }
77
66
 
@@ -112,7 +101,6 @@ class MemoryClient {
112
101
  headers: this.headers,
113
102
  body: JSON.stringify(payload)
114
103
  });
115
- captureClientEvent('search', this, { query_length: query.length });
116
104
  return response;
117
105
  }
118
106
 
@@ -185,35 +173,6 @@ class MemoryClient {
185
173
  return Object.fromEntries(Object.entries(options).filter(([_, v]) => v != null));
186
174
  }
187
175
 
188
- _wrapMethods() {
189
- // Apply error handler and telemetry to methods
190
- this.add = this._wrapMethod('add', this.add.bind(this));
191
- this.get = this._wrapMethod('get', this.get.bind(this));
192
- this.getAll = this._wrapMethod('get_all', this.getAll.bind(this));
193
- this.search = this._wrapMethod('search', this.search.bind(this));
194
- this.delete = this._wrapMethod('delete', this.delete.bind(this));
195
- this.deleteAll = this._wrapMethod('delete_all', this.deleteAll.bind(this));
196
- this.history = this._wrapMethod('history', this.history.bind(this));
197
- this.deleteUsers = this._wrapMethod('delete_users', this.deleteUsers.bind(this));
198
- }
199
-
200
- _wrapMethod(methodName, method) {
201
- return async (...args) => {
202
- try {
203
- const result = await method(...args);
204
- captureClientEvent(methodName, this, { success: true });
205
- return result;
206
- } catch (error) {
207
- captureClientEvent(methodName, this, { success: false, error: error.message });
208
- throw error;
209
- }
210
- };
211
- }
212
176
  }
213
177
 
214
178
  export default MemoryClient;
215
-
216
- // Add a way to manually shutdown telemetry if needed
217
- MemoryClient.shutdownTelemetry = async () => {
218
- await telemetry.shutdown();
219
- };
package/src/telemetry.js DELETED
@@ -1,36 +0,0 @@
1
- import posthog from 'posthog-js';
2
-
3
- posthog.init('phc_hgJkUVJFYtmaJqrvf6CYN67TIQ8yhXAkWzUn9AMU4yX', { api_host: 'https://us.i.posthog.com' });
4
-
5
- class AnonymousTelemetry {
6
-
7
- async captureEvent(distinctId, eventName, properties = {}) {
8
- if (eventName === 'client.init') {
9
- posthog.identify(distinctId);
10
- }
11
- const eventProperties = {
12
- client_source: 'js',
13
- ...properties
14
- };
15
-
16
- posthog.capture(eventName, {
17
- properties: eventProperties
18
- });
19
- }
20
-
21
- async shutdown() {
22
- await posthog.shutdown();
23
- }
24
- }
25
-
26
- const telemetry = new AnonymousTelemetry();
27
-
28
- async function captureClientEvent(eventName, instance, additionalData = {}) {
29
- const eventData = {
30
- function: `${instance.constructor.name}`,
31
- ...additionalData
32
- };
33
- await telemetry.captureEvent(instance.telemetryId, `client.${eventName}`, eventData);
34
- }
35
-
36
- export { telemetry, captureClientEvent };