From b08b50cbc683ca616f9cc0b8ea9d08a16b0524c8 Mon Sep 17 00:00:00 2001 From: Prateek Chhikara <46902268+prateekchhikara@users.noreply.github.com> Date: Wed, 5 Feb 2025 12:34:52 -0800 Subject: [PATCH] added enhanced search params (#2195) --- docs/features/advanced-retrieval.mdx | 47 ++++++++++++++++++++++++++++ docs/mint.json | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 docs/features/advanced-retrieval.mdx diff --git a/docs/features/advanced-retrieval.mdx b/docs/features/advanced-retrieval.mdx new file mode 100644 index 00000000..b4f12c8e --- /dev/null +++ b/docs/features/advanced-retrieval.mdx @@ -0,0 +1,47 @@ +--- +title: Advanced Retrieval +--- + +Mem0's **Advanced Retrieval** feature delivers superior search results by leveraging state-of-the-art search algorithms. Beyond the default search functionality, Mem0 offers the following advanced retrieval modes: + +1. **Keyword Search** + + This mode emphasizes keywords within the query, returning memories that contain the most relevant keywords alongside those from the default search. By default, this parameter is set to `false`. Enabling it enhances search recall, though it may slightly impact precision. + + ```python + client.search(query, keyword_search=True, user_id='alex') + ``` + +2. **Reranking** + + Reranking allows you to reorder the memories returned by the default search based on relevance. This parameter is set to `false` by default. When enabled, it reorders the memories based on the relevance score. + + ```python + client.search(query, rerank=True, user_id='alex') + ``` + +3. **Filtering** + + Filtering enables you to narrow down the search results by applying specific criteria. This parameter is set to `false` by default. Activating it enhances search precision, potentially reducing recall by a small margin. + + ```python + client.search(query, filter_memories=True, user_id='alex') + ``` + +**Note:** You can enable or disable these search modes by passing the respective parameters to the `search` method. There is no required sequence for these modes, and any combination can be used based on your needs. + + +### Latency Numbers + +Here are the typical latency ranges for each search mode: + +| **Mode** | **Latency** | +|---------------------|------------------| +| **Keyword Search** | **>10ms** | +| **Reranking** | **150-200ms** | +| **Filtering** | **200-300ms** | + + +If you have any questions, please feel free to reach out to us using one of the following methods: + + \ No newline at end of file diff --git a/docs/mint.json b/docs/mint.json index e7ec6113..4244602f 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -63,7 +63,7 @@ "platform/quickstart", { "group": "Features", - "pages": ["features/selective-memory", "features/custom-categories", "features/custom-instructions", "features/direct-import", "features/async-client", "features/memory-export"] + "pages": ["features/advanced-retrieval", "features/selective-memory", "features/custom-categories", "features/custom-instructions", "features/direct-import", "features/async-client", "features/memory-export"] } ] },