Retrieval Modes

Understanding the different ways to query your context database

Query Performance Spectrum

The Ontbo API offers four retrieval modes, each optimized for different use cases. Choose the right mode based on your needs for speed, accuracy, and comprehensiveness.

FULL_DATA

Most PreciseSlowest

Performs an extensive search on all profile facts. This mode provides the most comprehensive and accurate results but may take longer to process.

Best For

  • • Comprehensive analysis
  • • Complex multi-faceted queries
  • • When accuracy is critical
  • • Background processing

Considerations

  • • Higher latency
  • • More resource intensive
  • • May timeout on large datasets
  • • Best for non-real-time use
Example Query
curl -X GET "https://api.ontbo.com/api/tests/profiles/user123/facts/query?query=What are all the user's preferences and behaviors?&query_type=FULL_DATA" \
  -H "Authorization: Bearer YOUR_API_KEY"

MULTI_HOP

BalancedGood Accuracy

Makes multiple sub-queries to answer complex questions. This mode provides a good balance between accuracy and performance for most use cases.

Best For

  • • Complex reasoning tasks
  • • Multi-step queries
  • • General-purpose applications
  • • When you need good accuracy

Considerations

  • • Moderate latency
  • • Good balance of features
  • • Handles complex queries well
  • • Suitable for most applications
Example Query
curl -X GET "https://api.ontbo.com/api/tests/profiles/user123/facts/query?query=How do the user's preferences relate to their past decisions?&query_type=MULTI_HOP" \
  -H "Authorization: Bearer YOUR_API_KEY"

SINGLE_HOP

FastSimple

Simple call to the facts database. This is the fastest option for straightforward queries that don't require complex reasoning.

Best For

  • • Simple fact retrieval
  • • Real-time applications
  • • Direct information lookup
  • • High-frequency queries

Considerations

  • • Limited to direct matches
  • • May miss related information
  • • Best for specific queries
  • • Fastest response time
Example Query
curl -X GET "https://api.ontbo.com/api/tests/profiles/user123/facts/query?query=What is the user's favorite color?&query_type=SINGLE_HOP" \
  -H "Authorization: Bearer YOUR_API_KEY"

VECTOR_SEARCH

FastestSemantic

Uses embeddings to find semantically similar content. This is the fastest option and great for finding conceptually related information.

Best For

  • • Semantic similarity search
  • • Real-time applications
  • • Finding related concepts
  • • High-performance queries

Considerations

  • • May return conceptually similar but not exact matches
  • • Great for discovery and exploration
  • • Fastest response time
  • • Good for fuzzy matching
Example Query
curl -X GET "https://api.ontbo.com/api/tests/profiles/user123/facts/query?query=Find information about user interface preferences&query_type=VECTOR_SEARCH" \
  -H "Authorization: Bearer YOUR_API_KEY"

Performance Comparison

ModeSpeedAccuracyUse Case
VECTOR_SEARCHFastestGoodSemantic similarity
SINGLE_HOPFastGoodDirect fact lookup
MULTI_HOPMediumVery GoodComplex reasoning
FULL_DATASlowestBestComprehensive analysis

Best Practices

Choosing the Right Mode

  • • Use VECTOR_SEARCH for real-time semantic queries
  • • Use SINGLE_HOP for direct fact retrieval
  • • Use MULTI_HOP for complex reasoning tasks
  • • Use FULL_DATA for comprehensive analysis

Performance Tips

  • • Start with faster modes and escalate if needed
  • • Cache results for frequently accessed data
  • • Use appropriate timeouts for each mode
  • • Monitor query performance and adjust

Next Steps

Now that you understand retrieval modes, learn about profile update policies to optimize your data processing workflow.