import Supermemory from 'supermemory';
const client = new Supermemory({
apiKey: 'My API Key',
});
const response = await client.search.memories({ q: 'machine learning concepts' });
console.log(response.results);
{
"results": [
{
"id": "mem_abc123",
"memory": "John prefers machine learning over traditional programming",
"metadata": {
"source": "conversation",
"confidence": 0.9
},
"updatedAt": "2023-11-07T05:31:56Z",
"similarity": 0.89,
"version": 3,
"context": {
"parents": [
{
"relation": "updates",
"version": -1,
"memory": "Earlier version: Dhravya is working on a patent at Cloudflare.",
"metadata": {},
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"children": [
{
"relation": "extends",
"version": 1,
"memory": "Later version: Dhravya has filed the patent successfully.",
"metadata": {},
"updatedAt": "2023-11-07T05:31:56Z"
}
]
},
"documents": [
{
"id": "doc_xyz789",
"title": "Introduction to Machine Learning",
"type": "web",
"metadata": {
"category": "technology",
"isPublic": true,
"readingTime": 5,
"source": "web",
"tag_1": "ai",
"tag_2": "machine-learning"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
],
"timing": 245,
"total": 5
}
Search memory entries - Low latency for conversational
import Supermemory from 'supermemory';
const client = new Supermemory({
apiKey: 'My API Key',
});
const response = await client.search.memories({ q: 'machine learning concepts' });
console.log(response.results);
{
"results": [
{
"id": "mem_abc123",
"memory": "John prefers machine learning over traditional programming",
"metadata": {
"source": "conversation",
"confidence": 0.9
},
"updatedAt": "2023-11-07T05:31:56Z",
"similarity": 0.89,
"version": 3,
"context": {
"parents": [
{
"relation": "updates",
"version": -1,
"memory": "Earlier version: Dhravya is working on a patent at Cloudflare.",
"metadata": {},
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"children": [
{
"relation": "extends",
"version": 1,
"memory": "Later version: Dhravya has filed the patent successfully.",
"metadata": {},
"updatedAt": "2023-11-07T05:31:56Z"
}
]
},
"documents": [
{
"id": "doc_xyz789",
"title": "Introduction to Machine Learning",
"type": "web",
"metadata": {
"category": "technology",
"isPublic": true,
"readingTime": 5,
"source": "web",
"tag_1": "ai",
"tag_2": "machine-learning"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
],
"timing": 245,
"total": 5
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Memory search results
The response is of type object
.
Was this page helpful?