Search memory entries
Search memory entries - Low latency for conversational
Parameters
If true, aggregates information from multiple memories to create new synthesized memories. The result will be a mix of aggregated and non-aggregated memories, reranked by relevance to the query. Works in conjunction with reranking.
Optional tag this search should be containerized by. This can be an ID for your user, a project ID, or any other identifier you wish to use to filter memories.
Optional tags this search should be containerized by. Search is scoped to memories under these tags.
Filter search results by filepath. Exact match for full paths, prefix match if ending with /
If true, rerank the results based on the query. This is helpful if you want to ensure the most relevant results are returned.
Search memory entries
import os
from supermemory import Supermemory
client = Supermemory(
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
)
response = client.search.memories(
q="what are the API rate limits",
)
print(response.results){
"results": [
{
"id": "mem_abc123",
"metadata": {
"source": "bar",
"confidence": "bar"
},
"similarity": 0.89,
"updatedAt": "updatedAt",
"chunk": "This is a chunk of content from a document...",
"chunks": [
{
"content": "This is a chunk of content from the document...",
"documentId": "doc_xyz789",
"position": 0
}
],
"context": {
"children": [
{
"memory": "Later version: API rate limit increased to 100 req/min on the free tier.",
"relation": "extends",
"updatedAt": "updatedAt",
"metadata": {
"foo": "bar"
},
"version": 1
}
],
"parents": [
{
"memory": "Earlier version: API rate limit is 50 req/min on the free tier.",
"relation": "updates",
"updatedAt": "updatedAt",
"metadata": {
"foo": "bar"
},
"version": -1
}
],
"related": [
{
"memory": "memory",
"relation": "extends",
"updatedAt": "updatedAt",
"metadata": {
"foo": "bar"
}
}
]
},
"documents": [
{
"id": "doc_xyz789",
"createdAt": "createdAt",
"updatedAt": "updatedAt",
"metadata": {
"source": "bar",
"language": "bar"
},
"summary": "API rate limit policy: 100 req/min free, 1000 req/min pro.",
"title": "API Rate Limiting Policy",
"type": "web"
}
],
"filepath": "filepath",
"isAggregated": false,
"memory": "The user prefers detailed API responses over minimal ones.",
"rootMemoryId": "mem_abc123",
"version": 3
}
],
"timing": 245,
"total": 5
}Returns Examples
{
"results": [
{
"id": "mem_abc123",
"metadata": {
"source": "bar",
"confidence": "bar"
},
"similarity": 0.89,
"updatedAt": "updatedAt",
"chunk": "This is a chunk of content from a document...",
"chunks": [
{
"content": "This is a chunk of content from the document...",
"documentId": "doc_xyz789",
"position": 0
}
],
"context": {
"children": [
{
"memory": "Later version: API rate limit increased to 100 req/min on the free tier.",
"relation": "extends",
"updatedAt": "updatedAt",
"metadata": {
"foo": "bar"
},
"version": 1
}
],
"parents": [
{
"memory": "Earlier version: API rate limit is 50 req/min on the free tier.",
"relation": "updates",
"updatedAt": "updatedAt",
"metadata": {
"foo": "bar"
},
"version": -1
}
],
"related": [
{
"memory": "memory",
"relation": "extends",
"updatedAt": "updatedAt",
"metadata": {
"foo": "bar"
}
}
]
},
"documents": [
{
"id": "doc_xyz789",
"createdAt": "createdAt",
"updatedAt": "updatedAt",
"metadata": {
"source": "bar",
"language": "bar"
},
"summary": "API rate limit policy: 100 req/min free, 1000 req/min pro.",
"title": "API Rate Limiting Policy",
"type": "web"
}
],
"filepath": "filepath",
"isAggregated": false,
"memory": "The user prefers detailed API responses over minimal ones.",
"rootMemoryId": "mem_abc123",
"version": 3
}
],
"timing": 245,
"total": 5
}