Using cloud application to deploy the pre-built basic pipeline: https://www.loom.com/share/e3b934b554484787b005702ced650ac9
Note - the example above uses SciPhi Cloud to pair with the R2R framework for observability and optimization. We intend on launching a self-hosted version of the cloud framework as our codebase matures.
Install R2R directly using pip:
# use the `'r2r[all]'` to download all required deps
pip install 'r2r[parsing,eval]'
# setup env
export OPENAI_API_KEY=sk-...
export LOCAL_DB_PATH=local.sqlite
# OR do `vim .env.example && cp .env.example .env`
# INCLUDE secrets and modify config.json
# if using cloud providers (e.g. pgvector, supabase, ...)For a full installation, which is recommended for development, please refer to the relevant documentation.
- 🚀 Deploy: production-ready RAG pipelines with streaming in seconds
- 🧩 Customize: your pipeline using intuitive configuration files
- 🔌 Extend: your pipeline logic with code
- ⚖️ Autoscale: your pipeline in the cloud with SciPhi
- 🤖 OSS: framework built for and by the OSS community to make RAG easier.
The project includes several examples that demonstrate application deployment and interaction:
-
basic_pipeline.py: This example runs the backend server with the basic RAG pipeline, which includes the ingestion, embedding, and RAG pipelines served via FastAPI.python -m r2r.examples.servers.basic_pipeline
-
synthetic_query_pipeline.py: This example demonstrates a more advanced pipeline that generates synthetic queries to improve the RAG pipeline's performance.python -m r2r.examples.servers.synthetic_query_pipeline
-
reducto_pipeline.py: This example showcases the integration of the Reducto adapter for PDF ingestion.python -m r2r.examples.servers.reducto_pipeline
-
web_search_pipeline.py: This example demonstrates the usage of theWebSearchRAGPipelinefor web search capabilities.python -m r2r.examples.servers.web_search_pipeline
-
run_basic_client.py: This example should be run after starting the basic pipeline server. It demonstrates uploading text entries and a PDF to the local server using the Python client. It also showcases document and user-level vector management with built-in features.python -m r2r.examples.clients.run_basic_client
-
run_basic_client_ext.py: This example extends the basic client functionality and provides a more interactive experience for uploading and querying documents.python -m r2r.examples.clients.run_basic_client_ext
-
run_synthetic_query_client.py: This example is optimized for interaction with the synthetic query pipeline server, showcasing the enhanced RAG pipeline's capabilities.python -m r2r.examples.clients.run_synthetic_query_client
The framework primarily revolves around three core abstractions:
-
The Ingestion Pipeline: Facilitates the preparation of embeddable 'Documents' from various data formats (json, txt, pdf, html, etc.). The abstraction can be found in
ingestion.pyand relevant documentation is available here. -
The Embedding Pipeline: Manages the transformation of text into stored vector embeddings, interacting with embedding and vector database providers through a series of steps (e.g., extract_text, transform_text, chunk_text, embed_chunks, etc.). The abstraction can be found in
embedding.pyand relevant documentation is available here. -
The RAG Pipeline: Works similarly to the embedding pipeline but incorporates an LLM provider to produce text completions. The abstraction can be found in
rag.pyand relevant documentation is available here. -
The Eval Pipeline: Samples some subset of rag_completion calls for evaluation. Currently DeepEval is supported. The abstraction can be found in
eval.pyand relevant documentation is available here.
Each pipeline incorporates a logging database for operation tracking and observability.