Build, scale, and manage user-facing Retrieval-Augmented Generation applications.

R2R JavaScript SDK Documentation

Installation

Before starting, make sure you have completed the R2R installation.

Install the R2R JavaScript SDK:

$npm install r2r-js

Getting Started

  1. Import the R2R client:
1const { r2rClient } = require('r2r-js');
  1. Initialize the client:
1const client = new r2rClient('http://localhost:7272');
  1. Check if R2R is running correctly:
1const healthResponse = await client.health();
2// {"status":"ok"}
  1. Login (Optional):
1// client.register("[email protected]", "my_password"),
2// client.verify_email("[email protected]", "my_verification_code")
3client.login("[email protected]", "my_password")

When using authentication the commands below automatically restrict the scope to a user’s available documents.

Additional Documentation

For more detailed information on specific functionalities of R2R, please refer to the following documentation:

  • Document Ingestion: Learn how to add, retrieve, and manage documents in R2R.
  • Search & RAG: Explore various querying techniques and Retrieval-Augmented Generation capabilities.
  • Authentication: Understand how to manage users and implement authentication in R2R.
  • Observability: Learn about analytics and monitoring tools for your R2R system.