RapidCanvas Docs
  • Welcome
  • GETTING STARTED
    • Quick start guide
    • Introduction to RapidCanvas
    • RapidCanvas Concepts
    • Accessing the platform
  • BASIC
    • Projects
      • Projects Overview
        • Creating a project
        • Reviewing the Projects listing page
        • Duplicating a Project
        • Modifying the project settings
        • Deleting Project(s)
        • Configuring global variables at the project level
        • Working on a project
        • Generating the about content for the project
        • Generating AI snippets for each node on the Canvas
        • Marking & Unmarking a Project as Favorite
      • Canvas overview
        • Shortcut options on canvas
        • Queuing the Recipes
        • Bulk Deletion of Canvas Nodes
        • AI Guide
      • Recipes
        • AI-assisted recipe
        • Rapid model recipe
        • Template recipe
        • Code Recipe
        • RAG Recipes
      • Scheduler overview
        • Creating a scheduler
        • Running the scheduler manually
        • Managing schedulers in a project
        • Viewing the schedulers in a project
        • Viewing the run history of a specific scheduler
        • Publishing the updated data pipeline to selected jobs from canvas
        • Fetching the latest data pipeline to a specific scheduler
        • Comparing the canvas of the scheduler with current canvas of the project
      • Predictions
        • Manual Prediction
        • Prediction Scheduler
      • Segments and Scenarios
      • DataApps
        • Model DataApp
        • Project Canvas Datasets
        • Custom Uploaded Datasets
        • SQL Sources
        • Documents and PDFs
        • Prediction Service
        • Scheduler
        • Import DataApp
    • Connectors
      • Importing dataset(s) from the local system
      • Importing Text Files from the Local System
      • Connectors overview
      • Connect to external connectors
        • Importing data from Google Cloud Storage (GCS)
        • Importing data from Amazon S3
        • Importing data from Azure Blob
        • Importing data from Mongo DB
        • Importing data from Snowflake
        • Importing data from MySQL
        • Importing data from Amazon Redshift
        • Importing data from Fivetran connectors
    • Workspaces
      • User roles and permissions
    • Artifacts & Models
      • Adding Artifacts at the Project Level
      • Adding Models at the Project Level
      • Creating an artifact at the workspace level
      • Managing artifacts at the workspace level
      • Managing Models at the Workspace Level
      • Prediction services
    • Environments Overview
      • Creating an environment
      • Editing the environment details
      • Deleting an environment
      • Monitoring the resource utilization in an environment
  • ADVANCED
    • Starter Guide
      • Quick Start
    • Setup and Installation
      • Installing and setting up the SDK
    • Helper Functions
    • Notebook Guide
      • Introduction
      • Create a template
      • Code Snippets
      • DataApps
      • Prediction Service
      • How to
        • How to Authenticate
        • Create a new project
        • Create a Custom Environment
        • Add a dataset
        • Add a recipe to the dataset
        • Manage cloud connection
        • Code recipes
        • Display a template on the UI
        • Create Global Variables
        • Scheduler
        • Create new scenarios
        • Create Template
        • Use a template in a flow notebook
      • Reference Implementations
        • DataApps
        • Artifacts
        • Connectors
        • Feature Store
        • ML model
        • ML Pipeline
        • Multiple Files
      • Sample Projects
        • Model build and predict
    • Rapid Rag
  • Additional Reading
    • Release Notes
      • May 14, 2025
      • April 21, 2025
      • April 01, 2025
      • Mar 18, 2025
      • Feb 27, 2025
      • Jan 27, 2025
      • Dec 26, 2024
      • Nov 26, 2024
      • Oct 24, 2024
      • Sep 11, 2024
        • Aug 08, 2024
      • Aug 29, 2024
      • July 18, 2024
      • July 03, 2024
      • June 19, 2024
      • May 30, 2024
      • May 15, 2024
      • April 17, 2024
      • Mar 28, 2024
      • Mar 20, 2024
      • Feb 28, 2024
      • Feb 19, 2024
      • Jan 30, 2024
      • Jan 16, 2024
      • Dec 12, 2023
      • Nov 07, 2023
      • Oct 25, 2023
      • Oct 01, 2024
    • Glossary
Powered by GitBook
On this page
  • A Rapid Retrieval-Augmented Generation Framework
  • Overview
  • Table of Contents
  • Installation
  • Dependencies
  • Core Components
  • Quick Start
  • Advanced Usage
  • API Reference
  1. ADVANCED

Rapid Rag

A Rapid Retrieval-Augmented Generation Framework

Overview

RapidRag is a Python package that simplifies the implementation of Retrieval-Augmented Generation (RAG) systems. The framework provides intuitive interfaces for document storage, embedding generation, LLM integration, and RAG pipeline construction.

This document serves as a comprehensive reference for data scientists and data engineers working with the RapidRag framework.

Table of Contents

  • Installation

  • Core Components

    • Document Stores

    • Embeddings

    • Language Models (LLMs)

    • RAG Implementation

    • Document Readers

    • Utilities

  • Quick Start

  • Advanced Usage

  • API Reference

Installation

RapidRag can be installed directly from the UI either at the environment level or the recipe level. Refer images below for more details

Dependencies

RapidRag relies on the following Python packages:

  • qdrant-client: For interacting with the Qdrant vector database

  • llama-index: For managing and querying document indices

  • openai: For integration with OpenAI's language models and embeddings

  • numpy: For numerical computations and vector operations

  • pandas: For data manipulation and analysis

  • requests: For making HTTP requests to external APIs

  • tqdm: For progress bar visualization during data processing

  • typing-extensions: For enhanced type hinting support in Python

These dependencies are installed in your environment when RapidRag is selected.

Core Components

Document Stores

RapidRag provides vector store interfaces for efficiently storing and retrieving embeddings.

Available Document Stores

  • Qdrant: A high-performance vector similarity search engine

Usage

from rapid_rag.document_stores import get_document_store
from rapid_rag.utils.enums import DocumentStore

# Initialize a Qdrant document store
qdrant_store = get_document_store(DocumentStore.QDRANT, 
                                  location=":memory:", 
                                  collection_name="my_collection")

Embeddings

RapidRag offers interfaces for various embedding models to convert text into vector representations.

Available Embedding Types

  • OpenAI Embeddings: Uses OpenAI's embedding models

  • OpenAI-like Embeddings: Compatible with services that provide an OpenAI-like API

  • Custom Embeddings: For custom embedding implementations

Usage

from rapid_rag.embeddings import get_embeddings_model
from rapid_rag.utils.enums import ModelType

# Initialize OpenAI embeddings
openai_embeddings = get_embeddings_model(ModelType.OPEN_AI, 
                                         model="text-embedding-3-small")

# Initialize OpenAI-like embeddings (e.g., for Azure or other compatible services)
openai_like_embeddings = get_embeddings_model(ModelType.OPEN_AI_LIKE,
                                              api_base="https://your-endpoint/",
                                              model="your-embedding-model")

Language Models (LLMs)

RapidRag integrates with various LLM providers for generating responses.

Available LLM Types

  • OpenAI: Direct integration with OpenAI models

  • OpenAI-like: Compatible with services providing an OpenAI-like API

Usage

from rapid_rag.llms import get_llms
from rapid_rag.utils.enums import ModelType

# Initialize OpenAI LLM
openai_llm = get_llms(ModelType.OPEN_AI, 
                      model="gpt-4o")

# Initialize OpenAI-like LLM
openai_like_llm = get_llms(ModelType.OPEN_AI_LIKE,
                           api_base="https://your-endpoint/",
                           model="your-model")

RAG Implementation

RapidRag provides a high-level SimpleRag class for easy implementation of RAG systems.

Features

  • Document ingestion from files or text

  • Integration with Qdrant vector store

  • Query and chat interfaces

  • Revival of existing vector stores

Usage

from rapid_rag.rag.simple_rag import SimpleRag
from qdrant_client import QdrantClient

# Create a Qdrant client
client = QdrantClient(":memory:")

# From text input
texts = [
    "Python is a popular programming language known for its simplicity and versatility.",
    "Retrieval-Augmented Generation combines retrieval systems with generative models."
]
rag_system = SimpleRag.from_text_with_qdrant(
    texts=texts, 
    collection_name="example_collection", 
    client=client
)

# From document input
rag_system = SimpleRag.from_document_with_qdrant(
    files_dir="documents/", 
    collection_name="docs_collection", 
    client=client
)

# Get query engine
query_engine = rag_system.as_query_engine()
response = query_engine.query("What can you tell me about Retrieval-Augmented Generation?")
print(response)

# Get chat engine
chat_engine = rag_system.as_chat_engine()

Document Readers

RapidRag includes document readers for ingesting various file types into the RAG system.

Available Readers

  • OpenAIAssistantPDFReader: Uses OpenAI's Assistant API to extract structured data from PDF documents

Usage

from rapid_rag.readers.open_ai_reader import OpenAIAssistantPDFReader

reader = OpenAIAssistantPDFReader(
    assistant_name="PDF Extractor",
    assistant_prompt="Extract all relevant information from this PDF document.",
    model="gpt-4o"
)

documents = reader.load_data("path/to/document.pdf")

Utilities

RapidRag provides utility modules to support the RAG implementation.

Enums

  • DocumentStore: Types of document stores (e.g., QDRANT)

  • IngestorType: Types of ingestors (e.g., DOCLING)

  • ModelType: Types of models (e.g., OPEN_AI, OPEN_AI_LIKE, CUSTOM)

Quick Start

Here's a complete example to get started with RapidRag:

from rapid_rag.rag.simple_rag import SimpleRag
from qdrant_client import QdrantClient

# Initialize client
client = QdrantClient(":memory:")

# Sample text data
texts = [
    "RapidRag is a framework for implementing Retrieval-Augmented Generation systems.",
    "RAG systems combine document retrieval with language model generation.",
    "Vector databases like Qdrant are commonly used in RAG for efficient similarity search."
]

# Create RAG system
rag = SimpleRag.from_text_with_qdrant(
    texts=texts,
    collection_name="quickstart",
    client=client
)

# Create query engine
query_engine = rag.as_query_engine()

# Execute query
response = query_engine.query("What is RapidRag and how does it work?")
print(response)

Advanced Usage

Reviving Existing Vector Stores

from rapid_rag.rag.simple_rag import SimpleRag
from qdrant_client import QdrantClient

# Connect to existing Qdrant instance
client = QdrantClient(host="localhost", port=6333)

# Revive the vector store
rag = SimpleRag.revive_vector_store(
    client=client,
    collection_name="existing_collection"
)

# Use the revived RAG system
query_engine = rag.as_query_engine()

Customizing Node Parsing

from rapid_rag.rag.simple_rag import SimpleRag
from qdrant_client import QdrantClient
from llama_index.core.node_parser import HierarchicalNodeParser

# Custom node parser configuration
node_parser = HierarchicalNodeParser.from_defaults(
    chunk_size=512,
    chunk_overlap=20
)

# Create RAG system with custom parser
rag = SimpleRag.from_document_with_qdrant(
    files_dir="documents/",
    collection_name="custom_parsed",
    client=QdrantClient(":memory:"),
    node_parser=node_parser
)

Using Custom Embeddings

from rapid_rag.rag.simple_rag import SimpleRag
from rapid_rag.embeddings import get_embeddings_model
from rapid_rag.utils.enums import ModelType
from qdrant_client import QdrantClient

# Create custom embeddings model
embeddings_model = get_embeddings_model(
    ModelType.CUSTOM,
    api_base="https://your-embedding-api/",
    model="your-model-name"
)

# Create RAG system with custom embeddings
rag = SimpleRag.from_text_with_qdrant(
    texts=["Sample text for embedding"],
    collection_name="custom_embeddings",
    client=QdrantClient(":memory:"),
    embeddings_model=embeddings_model
)

API Reference

Document Stores

get_document_store(store_type, **kwargs)

Returns an initialized document store instance.

  • Parameters:

    • store_type (DocumentStore): Type of document store to use

    • **kwargs: Arguments passed to the document store constructor

  • Returns: Document store instance

  • Raises: NotImplementedError if unsupported document store is requested

qdrant(**qdrant_kwargs)

Returns an initialized QdrantVectorStore instance.

  • Parameters:

    • **qdrant_kwargs: Arguments for the Qdrant vector store

  • Returns: QdrantVectorStore instance

Embeddings

get_embeddings_model(type, **kwargs)

Returns an interface for embedding models of the specified type.

  • Parameters:

    • type (ModelType): Type of embedding model

    • **kwargs: Arguments passed to the embedding model constructor

  • Returns: Embedding model instance

  • Raises: NotImplementedError if embedding model type is not supported

RemoteEmbeddingModelInterface

A model interface that wraps remote embedding models with a common API.

  • Parameters:

    • api_base (str): Base URL of the remote API endpoint

    • model (str): Model identifier to use for encoding

    • instruction (str, optional): Instruction for semantic search

    • embedding_type (str, optional): Type of embedding to use

RemoteEmbeddingOpenaiLike

A remote embedding model that uses an OpenAI-like interface for encoding text.

  • Parameters:

    • api_base (str): Base URL of the remote API endpoint

    • model (str): Model identifier to use for encoding

Language Models (LLMs)

get_llms(model_type, **kwargs)

Returns a LLM interaction object.

  • Parameters:

    • model_type (ModelType): Type of LLM

    • **kwargs: Arguments passed to the LLM constructor

  • Returns: LLM instance

get_openai(**kwargs)

Returns an OpenAI LLM instance.

get_openai_like(**kwargs)

Returns an OpenAI-like LLM instance.

RAG Implementation

SimpleRag

A simple Retrieval-Augmented Generation (RAG) engine that integrates with a vector store.

Constructor

  • Parameters:

    • index (VectorStoreIndex): The vector store index

Methods

  • as_query_engine(**kwargs): Returns a query engine interface

  • as_chat_engine(**kwargs): Returns a chat engine interface

  • from_text_with_qdrant(texts, collection_name, client, ...): Creates a SimpleRag from text input

  • from_document_with_qdrant(files_dir, collection_name, client, ...): Creates a SimpleRag from documents

  • revive_vector_store(client, collection_name, ...): Revives an existing vector store

Document Readers

OpenAIAssistantPDFReader

A reader that uses OpenAI's Assistant API to extract structured data from PDF documents.

  • Parameters:

    • assistant_name (str): Name of the assistant

    • assistant_prompt (str): Instructions for the assistant

    • api_key (str, optional): OpenAI API key

    • model (str, default="gpt-4o"): OpenAI model to use

    • delete_thread (bool, default=False): Whether to delete the thread after processing

    • message (str, optional): User message prompt

    • meta_data_extraction_keys (List[str], optional): Keys to extract as metadata

Methods

  • load_data(file_path): Loads and parses data from a PDF file

Utilities

Enums

  • DocumentStore: Vector store types (QDRANT)

  • IngestorType: Ingestor types (DOCLING)

  • ModelType: Model types (CUSTOM, OPEN_AI, OPEN_AI_LIKE)

PreviousModel build and predictNextRelease Notes

Last updated 23 hours ago