> ## Documentation Index
> Fetch the complete documentation index at: https://ionet-cca8037f-confidential-compute.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> The R2R Retrieval API provides vector search, knowledge graph retrieval, and RAG-based generation capabilities. It powers semantic search, conversational agents, and flexible AI generation across documents, enabling intelligent data interaction and discovery.

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

### Vector Search

* 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

### Knowledge Graph Search

* 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

| **Method** | **Endpoint**                                                              | **Description**                                                                                 |
| ---------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `POST`     | [/retrieval/search](/reference/rag/retrieval/semantic-search)             | Perform semantic search with hybrid vector and knowledge graph capabilities.                    |
| `POST`     | [/retrieval/rag](/reference/rag/retrieval/retrieve-and-generate-rag)      | Generate contextual responses using retrieved information with optional web search integration. |
| `POST`     | [/retrieval/agent](/reference/rag/retrieval/agent-based-query-resolution) | Engage with a conversational RAG agent capable of web-enhanced query resolution.                |
| `POST`     | [/retrieval/completion](/reference/rag/retrieval/prompt-based-completion) | Generate free-form text completions using language models.                                      |
| `POST`     | [/retrieval/embedding](/reference/rag/retrieval/generate-embedding)       | Generate embeddings for documents or raw text for similarity search.                            |

## Search Settings

### Vector Search Example

<CodeGroup>
  ```json json theme={null}
  {
    "use_semantic_search": true,
    "filters": {"document_id": {"$eq": "3e157b3a-8469-51db-90d9-52e7d896b49b"}},
    "limit": 20,
    "use_hybrid_search": true
  }
  ```
</CodeGroup>

### Generation Configuration Example

<CodeGroup>
  ```json json theme={null}
  {
    "stream": false,
    "temperature": 0.7,
    "max_tokens": 150,
    "model": "gpt-4o-mini"
  }
  ```
</CodeGroup>

## Key Concepts

### Search

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:**

<CodeGroup>
  ```json json theme={null}
  {
    "filters": {
      "metadata.category": {"$eq": "research"},
      "created_at": {"$gte": "2024-01-01"},
      "collection_ids": {"$in": ["uuid1", "uuid2"]}
    }
  }
  ```
</CodeGroup>
