curl --request POST \
--url https://api.memmachine.ai/v2/memories/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"query": "What was the user's last conversation about finance?",
"project_id": "",
"expand_context": 0,
"filter": "metadata.user_id=123 AND metadata.session_id=abc",
"score_threshold": 0,
"top_k": 5,
"types": [
"episodic",
"semantic"
]
}
EOF{
"content": {
"episodic_memory": {
"long_term_memory": {
"episodes": [
{
"content": "<string>",
"producer_id": "<string>",
"producer_role": "<string>",
"uid": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"episode_type": "message",
"metadata": {},
"produced_for_id": "<string>",
"score": 123
}
]
},
"short_term_memory": {
"episode_summary": [
"<string>"
],
"episodes": [
{
"content": "<string>",
"producer_id": "<string>",
"producer_role": "<string>",
"uid": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"episode_type": "message",
"metadata": {},
"produced_for_id": "<string>",
"score": 123
}
]
}
},
"semantic_memory": [
{
"category": "<string>",
"feature_name": "<string>",
"tag": "<string>",
"value": "<string>",
"metadata": {
"citations": [
"<string>"
],
"id": "<string>",
"other": {}
},
"set_id": "<string>"
}
]
},
"status": 0
}Search memories within a project.
System returns the top K relevant memories matching the natural language query. The result is sorted by timestamp to help with context.
The filter field allows for filtering based on metadata key-value pairs. The types field allows specifying which memory types to include in the search.
curl --request POST \
--url https://api.memmachine.ai/v2/memories/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"query": "What was the user's last conversation about finance?",
"project_id": "",
"expand_context": 0,
"filter": "metadata.user_id=123 AND metadata.session_id=abc",
"score_threshold": 0,
"top_k": 5,
"types": [
"episodic",
"semantic"
]
}
EOF{
"content": {
"episodic_memory": {
"long_term_memory": {
"episodes": [
{
"content": "<string>",
"producer_id": "<string>",
"producer_role": "<string>",
"uid": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"episode_type": "message",
"metadata": {},
"produced_for_id": "<string>",
"score": 123
}
]
},
"short_term_memory": {
"episode_summary": [
"<string>"
],
"episodes": [
{
"content": "<string>",
"producer_id": "<string>",
"producer_role": "<string>",
"uid": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"episode_type": "message",
"metadata": {},
"produced_for_id": "<string>",
"score": 123
}
]
}
},
"semantic_memory": [
{
"category": "<string>",
"feature_name": "<string>",
"tag": "<string>",
"value": "<string>",
"metadata": {
"citations": [
"<string>"
],
"id": "<string>",
"other": {}
},
"set_id": "<string>"
}
]
},
"status": 0
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Specification model for searching memories.
The natural language query used for semantic memory search. This should be a descriptive string of the information you are looking for.
"What was the user's last conversation about finance?"
The identifier of the project. If empty, the user's default project is used.
^[\p{L}\p{N}_:-]*$The number of additional episodes to include around each matched episode from long term memory for better context.
0
An optional string filter applied to the memory metadata. This uses a simple query language (e.g., 'metadata.user_id=123') for exact matches. Multiple conditions can be combined using AND operators. The metadata fields are prefixed with 'metadata.' to distinguish them from other fields.
"metadata.user_id=123 AND metadata.session_id=abc"
The minimum score for a memory to be included in the search results. Defaults to -inf (no threshold) represented as None. Meaningful only for certain ranking methods.
0
The maximum number of memories to return in the search results.
5
A list of memory types to include in the search (e.g., episodic, semantic). If empty, all available types are searched.
Memory type.
semantic, episodic ["episodic", "semantic"]