Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

API reference docs for Search V2 (#1760)

Dev Khant6057cf520234
diff --git a/docs/api-reference/memory/add-memories.mdx b/docs/api-reference/memory/add-memories.mdx
index d07ffd292..12d4df50c 100644
--- a/docs/api-reference/memory/add-memories.mdx
+++ b/docs/api-reference/memory/add-memories.mdx
@@ -1,4 +1,4 @@
---
title: 'Add Memories'
-openapi: post /memories/
+openapi: post /v1/memories/
---
\ No newline at end of file
diff --git a/docs/api-reference/memory/delete-memories.mdx b/docs/api-reference/memory/delete-memories.mdx
index 4b856fd2f..d4779208a 100644
--- a/docs/api-reference/memory/delete-memories.mdx
+++ b/docs/api-reference/memory/delete-memories.mdx
@@ -1,4 +1,4 @@
---
title: 'Delete Memories'
-openapi: delete /memories/
+openapi: delete /v1/memories/
---
diff --git a/docs/api-reference/memory/delete-memory.mdx b/docs/api-reference/memory/delete-memory.mdx
index f72c0ced9..0282ee122 100644
--- a/docs/api-reference/memory/delete-memory.mdx
+++ b/docs/api-reference/memory/delete-memory.mdx
@@ -1,4 +1,4 @@
---
title: 'Delete Memory'
-openapi: delete /memories/{memory_id}/
+openapi: delete /v1/memories/{memory_id}/
---
\ No newline at end of file
diff --git a/docs/api-reference/memory/get-memories.mdx b/docs/api-reference/memory/get-memories.mdx
index c8b792669..50a588812 100644
--- a/docs/api-reference/memory/get-memories.mdx
+++ b/docs/api-reference/memory/get-memories.mdx
@@ -1,4 +1,4 @@
---
title: 'Get Memories'
-openapi: get /memories/
+openapi: get /v1/memories/
---
diff --git a/docs/api-reference/memory/get-memory.mdx b/docs/api-reference/memory/get-memory.mdx
index a45702ffa..cab1f9861 100644
--- a/docs/api-reference/memory/get-memory.mdx
+++ b/docs/api-reference/memory/get-memory.mdx
@@ -1,4 +1,4 @@
---
title: 'Get Memory'
-openapi: get /memories/{memory_id}/
+openapi: get /v1/memories/{memory_id}/
---
\ No newline at end of file
diff --git a/docs/api-reference/memory/history-memory.mdx b/docs/api-reference/memory/history-memory.mdx
index f9c0e6c8a..0514ea5ec 100644
--- a/docs/api-reference/memory/history-memory.mdx
+++ b/docs/api-reference/memory/history-memory.mdx
@@ -1,4 +1,4 @@
---
title: 'Memory History'
-openapi: get /memories/{memory_id}/history/
+openapi: get /v1/memories/{memory_id}/history/
---
\ No newline at end of file
diff --git a/docs/api-reference/memory/search-memories.mdx b/docs/api-reference/memory/search-memories.mdx
deleted file mode 100644
index 0391c4d6f..000000000
--- a/docs/api-reference/memory/search-memories.mdx
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: 'Search Memories'
-openapi: post /memories/search/
----
\ No newline at end of file
diff --git a/docs/api-reference/memory/update-memory.mdx b/docs/api-reference/memory/update-memory.mdx
index 632f4db73..b6c46615e 100644
--- a/docs/api-reference/memory/update-memory.mdx
+++ b/docs/api-reference/memory/update-memory.mdx
@@ -1,4 +1,4 @@
---
title: 'Update Memory'
-openapi: put /memories/{memory_id}/
+openapi: put /v1/memories/{memory_id}/
---
\ No newline at end of file
diff --git a/docs/api-reference/memory/v1-search-memories.mdx b/docs/api-reference/memory/v1-search-memories.mdx
new file mode 100644
index 000000000..989ba5f7c
--- /dev/null
+++ b/docs/api-reference/memory/v1-search-memories.mdx
@@ -0,0 +1,4 @@
+---
+title: 'V1 Search Memories'
+openapi: post /v1/memories/search/
+---
\ No newline at end of file
diff --git a/docs/api-reference/memory/v2-search-memories.mdx b/docs/api-reference/memory/v2-search-memories.mdx
new file mode 100644
index 000000000..5c591d66b
--- /dev/null
+++ b/docs/api-reference/memory/v2-search-memories.mdx
@@ -0,0 +1,4 @@
+---
+title: 'V2 Search Memories'
+openapi: post /v2/memories/search/
+---
\ No newline at end of file
diff --git a/docs/mint.json b/docs/mint.json
index 19a9b7fa3..7b5c47a69 100644
--- a/docs/mint.json
+++ b/docs/mint.json
@@ -143,7 +143,8 @@
"api-reference/memory/get-memory",
"api-reference/memory/update-memory",
"api-reference/memory/delete-memory",
- "api-reference/memory/search-memories",
+ "api-reference/memory/v1-search-memories",
+ "api-reference/memory/v2-search-memories",
"api-reference/memory/history-memory"
]
},
diff --git a/docs/openapi.json b/docs/openapi.json
index f0480a5f5..9c28fc4d1 100644
--- a/docs/openapi.json
+++ b/docs/openapi.json
@@ -13,7 +13,7 @@
},
"servers":[
{
- "url":"https://api.mem0.ai/v1"
+ "url":"https://api.mem0.ai/"
}
],
"security":[
@@ -22,7 +22,7 @@
}
],
"paths":{
- "/agents/":{
+ "/v1/agents/":{
"post":{
"tags":[
"agents"
@@ -54,7 +54,7 @@
"x-codegen-request-body-name":"data"
}
},
- "/apps/":{
+ "/v1/apps/":{
"post":{
"tags":[
"apps"
@@ -86,7 +86,7 @@
"x-codegen-request-body-name":"data"
}
},
- "/entities/":{
+ "/v1/entities/":{
"get":{
"tags":[
"entities"
@@ -159,7 +159,7 @@
}
}
},
- "/entities/filters/":{
+ "/v1/entities/filters/":{
"get":{
"tags":[
"entities"
@@ -174,7 +174,7 @@
}
}
},
- "/entities/{entity_type}/{entity_id}/":{
+ "/v1/entities/{entity_type}/{entity_id}/":{
"get":{
"tags":[
"entities"
@@ -223,7 +223,7 @@
}
}
},
- "/events/":{
+ "/v1/events/":{
"get":{
"tags":[
"events"
@@ -240,7 +240,7 @@
}
}
},
- "/memories/":{
+ "/v1/memories/":{
"get":{
"tags":[
"memories"
@@ -400,7 +400,7 @@
}
}
},
- "/memories/events/":{
+ "/v1/memories/events/":{
"get":{
"tags":[
"memories"
@@ -415,7 +415,7 @@
}
}
},
- "/memories/search/":{
+ "/v1/memories/search/":{
"post":{
"tags":[
"memories"
@@ -534,7 +534,110 @@
"x-codegen-request-body-name":"data"
}
},
- "/memories/{entity_type}/{entity_id}/":{
+ "/v2/memories/search/": {
+ "post": {
+ "tags": [
+ "memories"
+ ],
+ "description": "Search memories based on a query and filters.",
+ "operationId": "memories_search_v2",
+ "requestBody":{
+ "content":{
+ "application/json":{
+ "schema":{
+ "$ref":"#/components/schemas/MemorySearchInputV2"
+ }
+ }
+ },
+ "required":true
+ },
+ "responses":{
+ "200":{
+ "description":"",
+ "content":{
+ "application/json":{
+ "schema":{
+ "type":"array",
+ "items":{
+ "type":"object",
+ "properties":{
+ "id":{
+ "type":"string",
+ "format":"uuid",
+ "description":"Unique identifier for the memory"
+ },
+ "memory":{
+ "type":"string",
+ "description":"The content of the memory"
+ },
+ "input":{
+ "type":"array",
+ "items":{
+ "type":"object",
+ "properties":{
+ "role":{
+ "type":"string",
+ "enum":[
+ "user",
+ "assistant"
+ ],
+ "description":"The role of the speaker in the conversation"
+ },
+ "content":{
+ "type":"string",
+ "description":"The content of the message"
+ }
+ },
+ "required":[
+ "role",
+ "content"
+ ]
+ },
+ "description":"The conversation input that was used to generate this memory"
+ },
+ "user_id":{
+ "type":"string",
+ "description":"The identifier of the user associated with this memory"
+ },
+ "hash":{
+ "type":"string",
+ "description":"A hash of the memory content"
+ },
+ "metadata":{
+ "type":"object",
+ "nullable":true,
+ "description":"Additional metadata associated with the memory"
+ },
+ "created_at":{
+ "type":"string",
+ "format":"date-time",
+ "description":"The timestamp when the memory was created"
+ },
+ "updated_at":{
+ "type":"string",
+ "format":"date-time",
+ "description":"The timestamp when the memory was last updated"
+ }
+ },
+ "required":[
+ "id",
+ "memory",
+ "input",
+ "user_id",
+ "hash",
+ "created_at",
+ "updated_at"
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-codegen-request-body-name":"data"
+ }
+ },
+ "/v1/memories/{entity_type}/{entity_id}/":{
"get":{
"tags":[
"memories"
@@ -567,7 +670,7 @@
}
]
},
- "/memories/{memory_id}/":{
+ "/v1/memories/{memory_id}/":{
"get":{
"tags":[
"memories"
@@ -776,7 +879,7 @@
}
}
},
- "/memories/{memory_id}/history/":{
+ "/v1/memories/{memory_id}/history/":{
"get":{
"tags":[
"memories"
@@ -894,7 +997,7 @@
}
}
},
- "/runs/":{
+ "/v1/runs/":{
"post":{
"tags":[
"runs"
@@ -926,7 +1029,7 @@
"x-codegen-request-body-name":"data"
}
},
- "/stats/":{
+ "/v1/stats/":{
"get":{
"tags":[
"stats"
@@ -943,7 +1046,7 @@
}
}
},
- "/users/":{
+ "/v1/users/":{
"post":{
"tags":[
"users"
@@ -1151,6 +1254,20 @@
"nullable":true,
"description":"Additional metadata associated with the memory."
},
+ "top_k": {
+ "title": "Top K",
+ "type": "integer",
+ "default": 10,
+ "description": "The number of top results to return."
+ },
+ "fields": {
+ "title": "Fields",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "A list of field names to include in the response. If not provided, all fields will be returned."
+ },
"rerank":{
"title":"Rerank",
"type":"boolean",
@@ -1159,6 +1276,48 @@
}
}
},
+ "MemorySearchInputV2": {
+ "type": "object",
+ "required": [
+ "query",
+ "filters"
+ ],
+ "properties": {
+ "query": {
+ "title": "Query",
+ "type": "string",
+ "description": "The query to search for in the memory."
+ },
+ "filters": {
+ "title": "Filters",
+ "type": "object",
+ "description": "A dictionary of filters to apply to the search. Users can pass AND, OR, IN, gte, lte, gt, lt, ne, icontains operators for advanced filtering.",
+ "additionalProperties": {
+ "type": "object"
+ }
+ },
+ "top_k": {
+ "title": "Top K",
+ "type": "integer",
+ "default": 10,
+ "description": "The number of top results to return."
+ },
+ "fields": {
+ "title": "Fields",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "A list of field names to include in the response. If not provided, all fields will be returned."
+ },
+ "rerank": {
+ "title": "Rerank",
+ "type": "boolean",
+ "default": false,
+ "description": "Whether to rerank the memories."
+ }
+ }
+ },
"CreateRun":{
"required":[
"run_id"