diff --git a/docs/components/rerankers/custom-prompts.mdx b/docs/components/rerankers/custom-prompts.mdx index 250de339d..613152458 100644 --- a/docs/components/rerankers/custom-prompts.mdx +++ b/docs/components/rerankers/custom-prompts.mdx @@ -193,7 +193,7 @@ for i, prompt in enumerate(prompts): config["reranker"]["config"]["scoring_prompt"] = prompt memory = Memory.from_config(config) - results = memory.search("test query", filters={"user_id": "test_user"}) + results = memory.search("test query", filters={"user_id": "test_user"}, rerank=True) print(f"Prompt {i+1} results: {results}") ``` diff --git a/docs/components/rerankers/models/cohere.mdx b/docs/components/rerankers/models/cohere.mdx index 07db57566..fb4c717f9 100644 --- a/docs/components/rerankers/models/cohere.mdx +++ b/docs/components/rerankers/models/cohere.mdx @@ -95,7 +95,7 @@ messages = [ memory.add(messages, user_id="bob") # Search with reranking -results = memory.search("What is the user's profession?", filters={"user_id": "bob"}) +results = memory.search("What is the user's profession?", filters={"user_id": "bob"}, rerank=True) for result in results['results']: print(f"Memory: {result['memory']}") diff --git a/docs/components/rerankers/models/llm.mdx b/docs/components/rerankers/models/llm.mdx index 44c20a64d..0f24a79e4 100644 --- a/docs/components/rerankers/models/llm.mdx +++ b/docs/components/rerankers/models/llm.mdx @@ -111,7 +111,7 @@ messages = [ memory.add(messages, user_id="david") # Search with LLM reranking -results = memory.search("What programming topics is the user studying?", filters={"user_id": "david"}) +results = memory.search("What programming topics is the user studying?", filters={"user_id": "david"}, rerank=True) for result in results['results']: print(f"Memory: {result['memory']}") diff --git a/docs/components/rerankers/models/sentence_transformer.mdx b/docs/components/rerankers/models/sentence_transformer.mdx index 236cb0d0b..a76fd8543 100644 --- a/docs/components/rerankers/models/sentence_transformer.mdx +++ b/docs/components/rerankers/models/sentence_transformer.mdx @@ -101,7 +101,7 @@ messages = [ memory.add(messages, user_id="charlie") # Search with local reranking -results = memory.search("What books does the user like?", filters={"user_id": "charlie"}) +results = memory.search("What books does the user like?", filters={"user_id": "charlie"}, rerank=True) for result in results['results']: print(f"Memory: {result['memory']}") diff --git a/docs/components/rerankers/models/zero_entropy.mdx b/docs/components/rerankers/models/zero_entropy.mdx index a44c8a224..babd97be0 100644 --- a/docs/components/rerankers/models/zero_entropy.mdx +++ b/docs/components/rerankers/models/zero_entropy.mdx @@ -86,7 +86,7 @@ messages = [ memory.add(messages, user_id="alice") # Search with reranking -results = memory.search("What Italian food does the user like?", filters={"user_id": "alice"}) +results = memory.search("What Italian food does the user like?", filters={"user_id": "alice"}, rerank=True) for result in results['results']: print(f"Memory: {result['memory']}") diff --git a/docs/components/rerankers/optimization.mdx b/docs/components/rerankers/optimization.mdx index 6fb5e5f48..e7be59328 100644 --- a/docs/components/rerankers/optimization.mdx +++ b/docs/components/rerankers/optimization.mdx @@ -146,7 +146,7 @@ def measure_reranker_performance(config, queries, user_id): latencies = [] for query in queries: start_time = time.time() - results = memory.search(query, filters={"user_id": user_id}) + results = memory.search(query, filters={"user_id": user_id}, rerank=True) latency = time.time() - start_time latencies.append(latency) @@ -218,7 +218,7 @@ async def parallel_search(config, queries, user_id): # Process multiple queries concurrently tasks = [ - memory.search(query, filters={"user_id": user_id}) + memory.search(query, filters={"user_id": user_id}, rerank=True) for query in queries ]