Skip to main content

A customizable RAG pipeline supporting multiple LLM providers and embedding backends.

Project description

๐Ÿง  customrag

customrag is a customizable Retrieval-Augmented Generation (RAG) pipeline that supports multiple LLMs and embedding models via a simple YAML config. Itโ€™s built for developers who want a plug-and-play RAG setup that works across:

  • โœ… OpenAI (ChatGPT, Embeddings)
  • โœ… Gemini (Cloud Console SDK or Gemini Studio via LangChain)
  • โœ… HuggingFace Hub
  • โœ… xAI
  • โœ… Local models via Sentence Transformers

๐Ÿš€ Features

  • ๐Ÿ“† Easy pip install (pip install customrag)
  • โš™๏ธ YAML-based config โ€” switch providers anytime
  • ๐Ÿ”— Supports multiple file formats (.txt, .pdf, .csv, .json, .docx, .md)
  • ๐Ÿ“ Saves vectorstore using FAISS
  • ๐Ÿง Built-in SDK support for Gemini Cloud Console (not supported by LangChain)
  • ๐Ÿ› ๏ธ LangChain-native support for OpenAI, xAI, Gemini Studio, and HuggingFace

๐Ÿ‘… Installation

pip install customrag

๐Ÿ› ๏ธ One-Time Setup

Create a default config file in your project directory:

customrag-setup

This generates a config.yaml file with placeholders for your API keys and model settings.


๐Ÿ“ Example config.yaml

embedding:
  provider: gemini            # Options: gemini, openai, huggingface, sentence-transformers, xai, gemini_studio
  model: models/embedding-001 # Model for embeddings

llm:
  provider: gemini            # Options: gemini, gemini_studio, openai, huggingface, xai
  model: gemini-1.5-pro       # Chat model

api_keys:
  gemini: your_gemini_api_key_here
  gemini_studio: your_gemini_studio_api_key_here
  openai: your_openai_api_key_here
  huggingface: your_huggingface_token_here
  xai: your_xai_api_key_here

๐Ÿ”ง Usage

1โƒฃ Initialize the Pipeline

from customrag import RAGPipeline

pipeline = RAGPipeline(config_path="config.yaml")

2โƒฃ Build a Vectorstore from Documents

pipeline.build_vectorstore("resume.pdf")  # Accepts .pdf, .txt, .docx, .md, .json, .csv

This will:

  • Load and chunk your document
  • Embed it using the configured embedding model
  • Save the FAISS vectorstore locally

3โƒฃ Ask a Question

answer = pipeline.query("What are my key skills?")

Depending on your config, it will:

  • Retrieve top matching chunks using FAISS
  • Generate an answer using either LangChain or Gemini SDK

๐Ÿค– Supported Providers

Provider Embeddings โœ… Chat (LLM) โœ… Chat SDK Support
OpenAI โœ… text-embedding-ada-002 โœ… gpt-3.5 / gpt-4 โŒ
Gemini โœ… models/embedding-001 โŒ (SDK only) โœ…
Gemini Studio โœ… โœ… gemini-pro โŒ
HuggingFace โœ… โœ… via HuggingFaceHub โŒ
xAI โœ… โœ… Grok (xAI) โŒ
Local (sentence-transformers) โœ… โŒ โŒ

๐Ÿ“† Example Project Structure

your-project/
โ”œโ”€โ”€ config.yaml
โ”œโ”€โ”€ resume.pdf
โ”œโ”€โ”€ script.py
โ””โ”€โ”€ faiss_index/

๐Ÿ‘จโ€๐Ÿ’ผ CLI Tool

Run this once in your project root:

customrag-setup

It will create a config.yaml you can edit with your API keys and model names.


๐Ÿ’ƒ Supported Document Formats

You can ingest files of type:

  • ๐Ÿ“„ .txt, .pdf, .docx, .md
  • ๐Ÿ“ˆ .csv
  • ๐Ÿงพ .json (array of objects)

๐Ÿง  How It Works

graph TD
    A[User Input] -->|Query| B[RAGPipeline]
    B --> C[FAISS Vectorstore]
    C --> D[Top-K Context]
    D --> E[LLM or Gemini SDK]
    E --> F[Answer Returned]

๐Ÿ‘จโ€๐Ÿ’ป Author

Made by Anuj Goel


๐Ÿ“ฌ Contribute

Issues and PRs are welcome. Add support for more LLMs or improve CLI! ๐Ÿš€


๐Ÿ“„ License

MIT License โ€“ free for personal and commercial use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

customrag-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

customrag-0.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file customrag-0.1.1.tar.gz.

File metadata

  • Download URL: customrag-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for customrag-0.1.1.tar.gz
Algorithm Hash digest
SHA256 36ad462880de3df6854be02ed6dd280a52a4aa0b8022db4c0525208b2d85090d
MD5 384c55013ed7a2cd3842585734a3e063
BLAKE2b-256 d6b0b5317a863128c1d4b85454d52800c561ef80fd5160fe83adf0e1e7e4ca63

See more details on using hashes here.

File details

Details for the file customrag-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: customrag-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for customrag-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4c4c9bc00c223ff44c91e6eb7fe4f72d7b6cfff6ee9afde5cbc5585c056a187
MD5 885464c0dc619f0c73f83b4372182edb
BLAKE2b-256 f7144512682e887bf3a3ed3e4f02f6e8e1edb716a30310afb0d488f08b6176e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page