API reference docs for Search V2 (#1760)

This commit is contained in:
Dev Khant
2024-08-27 21:36:46 +05:30
committed by GitHub
parent a94bd11a76
commit 6057cf5202
12 changed files with 192 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
--- ---
title: 'Add Memories' title: 'Add Memories'
openapi: post /memories/ openapi: post /v1/memories/
--- ---

View File

@@ -1,4 +1,4 @@
--- ---
title: 'Delete Memories' title: 'Delete Memories'
openapi: delete /memories/ openapi: delete /v1/memories/
--- ---

View File

@@ -1,4 +1,4 @@
--- ---
title: 'Delete Memory' title: 'Delete Memory'
openapi: delete /memories/{memory_id}/ openapi: delete /v1/memories/{memory_id}/
--- ---

View File

@@ -1,4 +1,4 @@
--- ---
title: 'Get Memories' title: 'Get Memories'
openapi: get /memories/ openapi: get /v1/memories/
--- ---

View File

@@ -1,4 +1,4 @@
--- ---
title: 'Get Memory' title: 'Get Memory'
openapi: get /memories/{memory_id}/ openapi: get /v1/memories/{memory_id}/
--- ---

View File

@@ -1,4 +1,4 @@
--- ---
title: 'Memory History' title: 'Memory History'
openapi: get /memories/{memory_id}/history/ openapi: get /v1/memories/{memory_id}/history/
--- ---

View File

@@ -1,4 +0,0 @@
---
title: 'Search Memories'
openapi: post /memories/search/
---

View File

@@ -1,4 +1,4 @@
--- ---
title: 'Update Memory' title: 'Update Memory'
openapi: put /memories/{memory_id}/ openapi: put /v1/memories/{memory_id}/
--- ---

View File

@@ -0,0 +1,4 @@
---
title: 'V1 Search Memories'
openapi: post /v1/memories/search/
---

View File

@@ -0,0 +1,4 @@
---
title: 'V2 Search Memories'
openapi: post /v2/memories/search/
---

View File

@@ -143,7 +143,8 @@
"api-reference/memory/get-memory", "api-reference/memory/get-memory",
"api-reference/memory/update-memory", "api-reference/memory/update-memory",
"api-reference/memory/delete-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" "api-reference/memory/history-memory"
] ]
}, },

View File

@@ -13,7 +13,7 @@
}, },
"servers":[ "servers":[
{ {
"url":"https://api.mem0.ai/v1" "url":"https://api.mem0.ai/"
} }
], ],
"security":[ "security":[
@@ -22,7 +22,7 @@
} }
], ],
"paths":{ "paths":{
"/agents/":{ "/v1/agents/":{
"post":{ "post":{
"tags":[ "tags":[
"agents" "agents"
@@ -54,7 +54,7 @@
"x-codegen-request-body-name":"data" "x-codegen-request-body-name":"data"
} }
}, },
"/apps/":{ "/v1/apps/":{
"post":{ "post":{
"tags":[ "tags":[
"apps" "apps"
@@ -86,7 +86,7 @@
"x-codegen-request-body-name":"data" "x-codegen-request-body-name":"data"
} }
}, },
"/entities/":{ "/v1/entities/":{
"get":{ "get":{
"tags":[ "tags":[
"entities" "entities"
@@ -159,7 +159,7 @@
} }
} }
}, },
"/entities/filters/":{ "/v1/entities/filters/":{
"get":{ "get":{
"tags":[ "tags":[
"entities" "entities"
@@ -174,7 +174,7 @@
} }
} }
}, },
"/entities/{entity_type}/{entity_id}/":{ "/v1/entities/{entity_type}/{entity_id}/":{
"get":{ "get":{
"tags":[ "tags":[
"entities" "entities"
@@ -223,7 +223,7 @@
} }
} }
}, },
"/events/":{ "/v1/events/":{
"get":{ "get":{
"tags":[ "tags":[
"events" "events"
@@ -240,7 +240,7 @@
} }
} }
}, },
"/memories/":{ "/v1/memories/":{
"get":{ "get":{
"tags":[ "tags":[
"memories" "memories"
@@ -400,7 +400,7 @@
} }
} }
}, },
"/memories/events/":{ "/v1/memories/events/":{
"get":{ "get":{
"tags":[ "tags":[
"memories" "memories"
@@ -415,7 +415,7 @@
} }
} }
}, },
"/memories/search/":{ "/v1/memories/search/":{
"post":{ "post":{
"tags":[ "tags":[
"memories" "memories"
@@ -534,7 +534,110 @@
"x-codegen-request-body-name":"data" "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":{ "get":{
"tags":[ "tags":[
"memories" "memories"
@@ -567,7 +670,7 @@
} }
] ]
}, },
"/memories/{memory_id}/":{ "/v1/memories/{memory_id}/":{
"get":{ "get":{
"tags":[ "tags":[
"memories" "memories"
@@ -776,7 +879,7 @@
} }
} }
}, },
"/memories/{memory_id}/history/":{ "/v1/memories/{memory_id}/history/":{
"get":{ "get":{
"tags":[ "tags":[
"memories" "memories"
@@ -894,7 +997,7 @@
} }
} }
}, },
"/runs/":{ "/v1/runs/":{
"post":{ "post":{
"tags":[ "tags":[
"runs" "runs"
@@ -926,7 +1029,7 @@
"x-codegen-request-body-name":"data" "x-codegen-request-body-name":"data"
} }
}, },
"/stats/":{ "/v1/stats/":{
"get":{ "get":{
"tags":[ "tags":[
"stats" "stats"
@@ -943,7 +1046,7 @@
} }
} }
}, },
"/users/":{ "/v1/users/":{
"post":{ "post":{
"tags":[ "tags":[
"users" "users"
@@ -1151,6 +1254,20 @@
"nullable":true, "nullable":true,
"description":"Additional metadata associated with the memory." "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":{ "rerank":{
"title":"Rerank", "title":"Rerank",
"type":"boolean", "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":{ "CreateRun":{
"required":[ "required":[
"run_id" "run_id"