What is Advanced Retrieval?

Advanced Retrieval gives you precise control over how memories are found and ranked. While basic search uses semantic similarity, these advanced options help you find exactly what you need, when you need it.

Search Enhancement Options

Expands results to include memories with specific terms, names, and technical keywords.
  • Searching for specific entities, names, or technical terms
  • Need comprehensive coverage of a topic
  • Want broader recall even if some results are less relevant
  • Working with domain-specific terminology

Reranking

Reorders results using deep semantic understanding to put the most relevant memories first.
  • Need the most relevant result at the top
  • Result order is critical for your application
  • Want consistent quality across different queries
  • Building user-facing features where accuracy matters

Memory Filtering

Filters results to keep only the most precisely relevant memories.
  • Need highly specific, focused results
  • Working with large datasets where noise is problematic
  • Quality over quantity is essential
  • Building production or safety-critical applications

Real-World Use Cases

Python
# Smart home assistant finding device preferences
results = client.search(
    query="How do I like my bedroom temperature?",
    keyword_search=True,    # Find specific temperature mentions
    rerank=True,           # Get most recent preferences first
    user_id="user123"
)

# Finds: "Keep bedroom at 68°F", "Too cold last night at 65°F", etc.

Choosing the Right Combination

# Fast and broad - good for exploration
def quick_search(query, user_id):
    return client.search(
        query=query,
        keyword_search=True,
        user_id=user_id
    )

# Balanced - good for most applications  
def standard_search(query, user_id):
    return client.search(
        query=query,
        keyword_search=True,
        rerank=True,
        user_id=user_id
    )

# High precision - good for critical applications
def precise_search(query, user_id):
    return client.search(
        query=query,
        rerank=True,
        filter_memories=True,
        user_id=user_id
    )

Best Practices

✅ Do

  • Start simple with just one enhancement and measure impact
  • Use keyword search for entity-heavy queries (names, places, technical terms)
  • Use reranking when the top result quality matters most
  • Use filtering for production systems where precision is critical
  • Handle empty results gracefully when filtering is too aggressive
  • Monitor latency and adjust based on your application’s needs

❌ Don’t

  • Enable all options by default without measuring necessity
  • Use filtering for broad exploratory queries
  • Ignore latency impact in real-time applications
  • Forget to handle cases where filtering returns no results
  • Use advanced retrieval for simple, fast lookup scenarios

Performance Guidelines

Latency Expectations

Python
# Performance monitoring example
import time

start_time = time.time()
results = client.search(
    query="user preferences",
    keyword_search=True,  # +10ms
    rerank=True,         # +150ms
    filter_memories=True, # +250ms
    user_id="user123"
)
latency = time.time() - start_time
print(f"Search completed in {latency:.2f}s")  # ~0.41s expected

Optimization Tips

  1. Cache frequent queries to avoid repeated advanced processing
  2. Use session-specific search with run_id to reduce search space
  3. Implement fallback logic when filtering returns empty results
  4. Monitor and alert on search latency patterns

Ready to enhance your search? Start with keyword search for broader coverage, add reranking for better ordering, and use filtering when precision is critical.