Skip to main content
R2R’s Retrieval system provides advanced search and generation capabilities powered by vector search, knowledge graphs, and large language models (LLMs).
It offers multiple ways to interact with your data, enabling both direct retrieval and AI-augmented reasoning.
  • Direct semantic search across documents and chunks
  • Retrieval-Augmented Generation (RAG) for AI-powered answers
  • Conversational RAG agents for complex queries
  • Raw LLM completions for flexible text generation

Core Features

  • Semantic similarity matching using document and chunk embeddings
  • Hybrid retrieval combining vector and keyword search
  • Complex filtering with Postgres-style operators
  • Configurable search limits and similarity thresholds
  • Retrieval based on entities and relationships
  • Multi-hop traversal for connected information discovery
  • Local and global search strategies for context depth
  • Community-aware graph navigation and clustering

RAG Generation

  • Contextual responses grounded in retrieved content
  • Customizable generation parameters (temperature, token limits, etc.)
  • Source attribution and citation support
  • Streaming responses for real-time output
  • Optional web search integration for current information

Deep Research Agent

  • Multi-turn conversational capabilities
  • Complex query decomposition and reasoning
  • Context retention across multiple interactions
  • Branch management for conversation trees
  • Integration with web search for external knowledge

API Endpoints

MethodEndpointDescription
POST/retrieval/searchPerform semantic search with hybrid vector and knowledge graph capabilities.
POST/retrieval/ragGenerate contextual responses using retrieved information with optional web search integration.
POST/retrieval/agentEngage with a conversational RAG agent capable of web-enhanced query resolution.
POST/retrieval/completionGenerate free-form text completions using language models.
POST/retrieval/embeddingGenerate embeddings for documents or raw text for similarity search.

Search Settings

Vector Search Example

{
  "use_semantic_search": true,
  "filters": {"document_id": {"$eq": "3e157b3a-8469-51db-90d9-52e7d896b49b"}},
  "limit": 20,
  "use_hybrid_search": true
}

Generation Configuration Example

{
  "stream": false,
  "temperature": 0.7,
  "max_tokens": 150,
  "model": "gpt-4o-mini"
}

Key Concepts

The /retrieval/search endpoint provides direct access to R2R’s retrieval capabilities, enabling semantic and graph-based search across your content. It supports advanced filtering, sorting by relevance, and hybrid retrieval using both embeddings and keywords.

RAG

Retrieval-Augmented Generation (RAG) combines content retrieval with language model generation. It retrieves relevant context from your documents and optionally integrates live web search results to produce accurate, source-grounded responses.

Agent

The /retrieval/agent endpoint provides a conversational interface for advanced retrieval. It maintains context, decomposes complex queries, and delivers responses with citations. The agent can also use web search to enhance context beyond internal data.

Completion

The /retrieval/completion endpoint gives direct access to language model generation without retrieval. It supports both single-turn and multi-turn interactions, making it ideal for creative generation, summarization, and reasoning tasks.

Filter Operations

Supported operators for content filtering include:
  • eq: Equals
  • neq: Not equals
  • gt: Greater than
  • gte: Greater than or equal
  • lt: Less than
  • lte: Less than or equal
  • like: Pattern matching
  • ilike: Case-insensitive pattern matching
  • in: In list
  • nin: Not in list
Example:
{
  "filters": {
    "metadata.category": {"$eq": "research"},
    "created_at": {"$gte": "2024-01-01"},
    "collection_ids": {"$in": ["uuid1", "uuid2"]}
  }
}