Skip to main content

RAG-X Library

Overview

RAG-X is a comprehensive library designed to optimize Retrieval-Augmented Generation (RAG) processes. It provides a suite of tools to automatically determine the best parameters for processing specific documents. This includes selecting appropriate chunking techniques, embedding models, vector databases, and Language Model (LLM) configurations.

Flow Chart

Flow Chart

Key Features:

  • Adaptive Chunking: Incorporates four advanced text chunking methodologies to enhance the handling of diverse document structures.
    • Specific Text Splitting
    • Recursive Text Splitting
    • Sentence Window Splitting
    • Semantic Window Splitting
  • Expandability: Future versions will introduce additional chunking strategies and enhancements based on user feedback and ongoing research.
  • Compatibility: Designed to seamlessly integrate with a wide range of embedding models and vector databases.

Getting Started

Installation

To get started, install the test_RAG_X library using the following command:

pip install test-RAG-X

To verify the installation and view library details, execute:

pip show test_RAG_X

Setting Up Your Environment

Before diving into the functionality of test-RAG-X, ensure that your environment variables are properly configured with your OpenAI API key and your Hugging Face token:

import os

os.environ['OPENAI_API_KEY'] = "YOUR_OPENAI_API_KEY"

** Note :- API Key from Free tier OpenAI account is not supported. **

Usage

The following steps guide you through the process of utilizing the test-RAG-X library to optimize your RAG parameters:

import hagrid as hg

# Specify the path to your PDF document
file_path = "PATH_TO_YOUR_PDF_FILE"

# Initialize the RAG-X instance
model = hg.ChunkEvaluator(file_path)

# Generate the optimal RAG parameters for your document
score_card = model.evaluate_parameters()

# Output the results
print(score_card)

Set parameters for evaluation

If you wish to analyse the performance of your parameters, you can pass the parameters as below:

kwarg = {
        'number_of_questions': 5, # Number of questions used to evaluate the process: type(int)
        'chunk_size': 250, # Chunk size: type(int)
        'chunk_overlap': 0, # Chunk overlap size: type(int)
        'separator': '',  # Separator to be used for chunking if any, type(str)
        'strip_whitespace': False, # Strip white space, type(bool)
        'sentence_buffer_window': 3, # Sentence Buffer window, type(int) 
        'sentence_cutoff_percentile': 80, # Sentence chunk split percentile for spliting context, type(int), range(1,100)
        }

# Specify the path to your PDF document
file_path = "PATH_TO_YOUR_PDF_FILE"

# Initialize the RAG-X instance
model = hg.ChunkEvaluator(file_path, **kwargs)

# Generate the optimal RAG parameters for your document
score_card = model.evaluate_parameters()

# Output the results, output will be a pandas dataframe
print(score_card)

Output

output_image

Contribution

We are open for contributions and any feedback from the users. Feel free to contact us.

Contact Us:

If you wish to integarte GenAI into your company, please contact at ...

Metadata

Release files for test-RAG-X 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for test-RAG-X 0.2.1
File Size Uploaded
test_RAG_X-0.2.1.tar.gz 14.0 kB Details

Release files / test_RAG_X-0.2.1.tar.gz

Download URL test_RAG_X-0.2.1.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
73cf8b79c4e36a8354364bcef282ba29f791498db9c2abe48078ce28e754d7cc
BLAKE2b-256 checksum
How to use checksums
aeb403db5c19e554ed962f9a29984e92c5401463b36827ccda01dd5914952589
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page