Getting Started
Pipeline SDK(s)

Interacting with a Deployed Pipeline

Once you have deployed your RAG pipeline using SciPhi and the R2R framework, you can interact with it using the R2R python client (opens in a new tab). The R2R client provides a convenient way to communicate with your deployed pipeline, allowing you to perform various operations such as upserting entries, searching, and performing RAG completions.

Refer to the Pipeline API for detailed API documentation.

Getting Started

To get started, make sure you have installed R2R.

pip install r2r_client

Next, initialize the R2R client with the base URL of your deployed API:

from r2r import R2RClient
client = R2RClient()
base_url = ""  # Replace with your actual deployed API URL
client = R2RClient(base_url)

Ingesting Files

You can ingest files into your remote database using the the ingest_documents method of the R2R client:

# Define the file paths
file_paths = ["/path/to/your/file1.txt", "/path/to/your/file2.pdf"]  # Replace with your actual file paths
# Define user ID
user_id = 'your_user_id'  # Replace with your actual user ID
# Ingest the documents
response = client.ingest_files(

Note that chunking is handled by the default ingestion pipeline and is configurable.


You can perform searches on your remote database using the search method:

# Perform a search over documents
search_response =
    query="your_query",  # Replace with your actual query

Generating RAG Completions

To perform a RAG completion we can call the client's rag method. If we'd like, we can stream the response in from the R2R client as well:

# Complete a RAG generation
response = client.rag(
    message="your message",  # Replace with your actual message
# To stream in the RAG generation simply set streaming to true
response = client.rag(
    message="your message", # Replace with your actual message
    streaming=True, # Set to True for streaming response
# We can now iterate over the response to get the chunks as they come in
collector = ""
for chunk in response:
    collector += chunk

Document Management

R2R supports a variety of mechanisms for managing documents. Here are a few helpful commands:

To update document(s) we may use the update_files or update_documents methods. Resubmitting an existing file will overwrite the data associated with the existing file with new data corresponding to the new file and increments the file's version.

files = ["/your_file_to_update"] # Replace with your files
ids = ['file_id_to_update'] # Replace with your file id, availible in the SciPhi documents dashboard
client.update_files(files=files, ids=ids)

You may also include other metadata such as a unique user_id during the document generation process and perform filtered deletions on these keys as well.

To delete files you can call the delete method of the R2R client, which takes in a key ('document_id' for files and documents) and a value. This will delete all chunks corresponding to the uploaded file.

response = client.delete(
    values=['document_id_to_delete'] # Replace with the document id that you wish to delete

Similarly, we can delete a user by calling the client.delete method with the key user_id.

Fetching Logs

You can fetch logs using the logs method:

# Fetch logs
logs_response = client.logs()

Next Steps

Continue on to learn about the various ready-made pipeline template which have been constructed by the R2R community. Afterwards, learn how to customize your own pipeline.

For more detailed information about the raw source API, refer to the Pipeline API documentation.