mem0ai 1.0.4-beta → 1.0.4-beta.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/package.json +7 -2
- package/examples/basic-usage.js +0 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mem0ai",
|
|
3
|
-
"version": "1.0.4-beta",
|
|
3
|
+
"version": "1.0.4-beta.0",
|
|
4
4
|
"description": "The memory layer for personalized AI",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,5 +19,10 @@
|
|
|
19
19
|
"license": "Apache-2.0",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"axios": "^0.21.1"
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"src/",
|
|
25
|
+
"package.json",
|
|
26
|
+
"README.md"
|
|
27
|
+
]
|
|
23
28
|
}
|
package/examples/basic-usage.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const MemoryClient = require('../src/index');
|
|
2
|
-
|
|
3
|
-
async function main() {
|
|
4
|
-
const apiKey = 'm0-UlqGB4SLcLgVcZ7YmYNlzHum3BxEqS0TzaYd09U0';
|
|
5
|
-
const client = new MemoryClient(apiKey);
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
// Add a new memory
|
|
9
|
-
const messages = [
|
|
10
|
-
{ "role": "user", "content": "Hey, I am Alex. I'm a vegetarian."},
|
|
11
|
-
{"role": "assistant", "content": "Hello Alex! I am vegetarian too!"},
|
|
12
|
-
];
|
|
13
|
-
const addResult = await client.add(messages, { user_id: "alex" });
|
|
14
|
-
console.log('Memory added:', addResult);
|
|
15
|
-
|
|
16
|
-
// Get all memories
|
|
17
|
-
const allMemories = await client.getAll({ user_id: "alex" });
|
|
18
|
-
console.log('All memories:', allMemories);
|
|
19
|
-
|
|
20
|
-
// Search memories
|
|
21
|
-
const searchResult = await client.search('What do you know about me?', { user_id: "alex"});
|
|
22
|
-
console.log('Search results:', searchResult);
|
|
23
|
-
|
|
24
|
-
// Get all users
|
|
25
|
-
const allUsers = await client.users();
|
|
26
|
-
console.log('All users:', allUsers);
|
|
27
|
-
|
|
28
|
-
// // Delete a memory (assuming we have a memory ID from the add result)
|
|
29
|
-
if (addResult && addResult.id) {
|
|
30
|
-
const deleteResult = await client.delete(addResult.id);
|
|
31
|
-
console.log('Memory deleted:', deleteResult);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
} catch (error) {
|
|
35
|
-
console.error('Error:', error.message);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
main();
|