From 80c9c6a577935db9b502bcbd2b357491ddee807c Mon Sep 17 00:00:00 2001 From: Dev Khant Date: Sat, 18 Jan 2025 10:43:03 +0530 Subject: [PATCH] Doc: Update V2 Search/GetAll docs (#2158) --- docs/openapi.json | 64 +++++++++++++++++++++++++++++++++--- docs/platform/quickstart.mdx | 4 +-- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/docs/openapi.json b/docs/openapi.json index 9a61d7a2..4d191da3 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -1136,9 +1136,32 @@ "name": "filters", "in": "query", "schema": { - "type": "object" + "type": "object", + "properties": { + "user_id": {"type": "string"}, + "agent_id": {"type": "string"}, + "app_id": {"type": "string"}, + "run_id": {"type": "string"}, + "created_at": {"type": "string", "format": "date-time"}, + "updated_at": {"type": "string", "format": "date-time"}, + "categories": {"type": "array", "items": {"type": "string"}}, + "keywords": {"type": "string"} + }, + "additionalProperties": { + "type": "object", + "properties": { + "in": {"type": "array"}, + "gte": {"type": "string"}, + "lte": {"type": "string"}, + "gt": {"type": "string"}, + "lt": {"type": "string"}, + "ne": {"type": "string"}, + "contains": {"type": "string"}, + "icontains": {"type": "string"} + } + } }, - "description": "Filters to apply to the memories", + "description": "Filters to apply to the memories. Available fields are: user_id, agent_id, app_id, run_id, created_at, updated_at, categories, keywords. Supports logical operators (AND, OR) and comparison operators (in, gte, lte, gt, lt, ne, contains, icontains)", "style": "deepObject", "explode": true }, @@ -4523,9 +4546,30 @@ "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.", + "description": "A dictionary of filters to apply to the search. Available fields are: user_id, agent_id, app_id, run_id, created_at, updated_at, categories, keywords. Supports logical operators (AND, OR) and comparison operators (in, gte, lte, gt, lt, ne, contains, icontains).", + "properties": { + "user_id": {"type": "string"}, + "agent_id": {"type": "string"}, + "app_id": {"type": "string"}, + "run_id": {"type": "string"}, + "created_at": {"type": "string", "format": "date-time"}, + "updated_at": {"type": "string", "format": "date-time"}, + "text": {"type": "string"}, + "categories": {"type": "array", "items": {"type": "string"}}, + "metadata": {"type": "object"} + }, "additionalProperties": { - "type": "object" + "type": "object", + "properties": { + "in": {"type": "array"}, + "gte": {"type": "string"}, + "lte": {"type": "string"}, + "gt": {"type": "string"}, + "lt": {"type": "string"}, + "ne": {"type": "string"}, + "contains": {"type": "string"}, + "icontains": {"type": "string"} + } } }, "top_k": { @@ -4548,6 +4592,18 @@ "default": false, "description": "Whether to rerank the memories." }, + "threshold": { + "title": "Threshold", + "type": "number", + "default": 0.3, + "description": "The minimum similarity threshold for returned results." + }, + "smart_search": { + "title": "Smart Search", + "type": "boolean", + "default": false, + "description": "Whether to enable smart search functionality." + }, "org_name": { "title": "Organization Name", "type": "string", diff --git a/docs/platform/quickstart.mdx b/docs/platform/quickstart.mdx index 4661b7ca..0c4d2389 100644 --- a/docs/platform/quickstart.mdx +++ b/docs/platform/quickstart.mdx @@ -493,7 +493,7 @@ curl -X POST "https://api.mem0.ai/v1/memories/search/?version=v2" \ #### Search using custom filters -Our advanced search allows you to set custom search filters. You can filter by user_id, agent_id, app_id, date, and more. +Our advanced search allows you to set custom search filters. You can filter by user_id, agent_id, app_id, run_id, created_at, updated_at, categories, and text. The filters support logical operators (AND, OR) and comparison operators (in, gte, lte, gt, lt, ne, contains, icontains). For more details, see [V2 Search Memories](/api-reference/memory/v2-search-memories). Here you need to define `version` as `v2` in the search method. @@ -1209,7 +1209,7 @@ curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&keywords=to play&p #### Get all memories using custom filters -Our advanced retrieval allows you to set custom filters when fetching memories. You can filter by user_id, agent_id, app_id, date, and more. +Our advanced retrieval allows you to set custom filters when fetching memories. You can filter by user_id, agent_id, app_id, run_id, created_at, updated_at, categories, and keywords. The filters support logical operators (AND, OR) and comparison operators (in, gte, lte, gt, lt, ne, contains, icontains). For more details, see [V2 Get Memories](/api-reference/memory/v2-get-memories). Here you need to define `version` as `v2` in the get_all method.