Skip to main content

SciPhi R2R

Project description

Screenshot 2025-03-27 at 6 35 02 AM

The most advanced AI retrieval system.

Agentic Retrieval-Augmented Generation (RAG) with a RESTful API.

About

R2R is an advanced AI retrieval system supporting Retrieval-Augmented Generation (RAG) with production-ready features. Built around a RESTful API, R2R offers multimodal content ingestion, hybrid search, knowledge graphs, and comprehensive document management.

R2R also includes a Deep Research API, a multi-step reasoning system that fetches relevant data from your knowledgebase and/or the internet to deliver richer, context-aware answers for complex queries.

Usage

# Basic search
results = client.retrieval.search(query="What is DeepSeek R1?")

# RAG with citations
response = client.retrieval.rag(query="What is DeepSeek R1?")

# Deep Research RAG Agent
response = client.retrieval.agent(
  message={"role":"user", "content": "What does deepseek r1 imply? Think about market, societal implications, and more."},
  rag_generation_config={
    "model": "anthropic/claude-3-7-sonnet-20250219",
    "extended_thinking": True,
    "thinking_budget": 4096,
    "temperature": 1,
    "top_p": None,
    "max_tokens_to_sample": 16000,
  },
)

Getting Started

# Quick install and run in light mode
pip install r2r
export OPENAI_API_KEY=sk-...
python -m r2r.serve

# Or run in full mode with Docker
# git clone git@github.com:SciPhi-AI/R2R.git && cd R2R
# export R2R_CONFIG_NAME=full OPENAI_API_KEY=sk-...
# docker compose -f compose.full.yaml --profile postgres up -d

For detailed self-hosting instructions, see the self-hosting docs.

Demo

https://github.com/user-attachments/assets/173f7a1f-7c0b-4055-b667-e2cdcf70128b

Using the API

1. Install SDK & Setup

# Install SDK
pip install r2r  # Python
# or
npm i r2r-js    # JavaScript

2. Client Initialization

from r2r import R2RClient
client = R2RClient(base_url="http://localhost:7272")
const { r2rClient } = require('r2r-js');
const client = new r2rClient("http://localhost:7272");

3. Document Operations

# Ingest sample or your own document
client.documents.create(file_path="/path/to/file")

# List documents
client.documents.list()

Key Features

  • 📁 Multimodal Ingestion: Parse .txt, .pdf, .json, .png, .mp3, and more
  • 🔍 Hybrid Search: Semantic + keyword search with reciprocal rank fusion
  • 🔗 Knowledge Graphs: Automatic entity & relationship extraction
  • 🤖 Agentic RAG: Reasoning agent integrated with retrieval
  • 🔐 User & Access Management: Complete authentication & collection system

Community & Contributing

Our Contributors

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

r2r-3.6.6.tar.gz (396.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

r2r-3.6.6-py3-none-any.whl (514.0 kB view details)

Uploaded Python 3

File details

Details for the file r2r-3.6.6.tar.gz.

File metadata

  • Download URL: r2r-3.6.6.tar.gz
  • Upload date:
  • Size: 396.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for r2r-3.6.6.tar.gz
Algorithm Hash digest
SHA256 f84c626e7fd9512ea312c75cc1d20221223a391222c382980a82100f25697258
MD5 8cb2f3505bc4f144a52c487cf3de0456
BLAKE2b-256 81009b9953e9adf115ed245e4d52ce1a9d8cbc4ae2c037315b748a7f0e2f1f6e

See more details on using hashes here.

File details

Details for the file r2r-3.6.6-py3-none-any.whl.

File metadata

  • Download URL: r2r-3.6.6-py3-none-any.whl
  • Upload date:
  • Size: 514.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for r2r-3.6.6-py3-none-any.whl
Algorithm Hash digest
SHA256 48c9326db0ff23c41affdb846df0c9014827b1316a14bcc87bb43c810b0410f9
MD5 a6d3f905c1e4f9e537dac7d9d1f4b92a
BLAKE2b-256 1413ad97d16a161bd96148b7562c3f6298c9cae79c7e0b7b1025a2fc74da95c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page