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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36ad462880de3df6854be02ed6dd280a52a4aa0b8022db4c0525208b2d85090d
|
|
| MD5 |
384c55013ed7a2cd3842585734a3e063
|
|
| BLAKE2b-256 |
d6b0b5317a863128c1d4b85454d52800c561ef80fd5160fe83adf0e1e7e4ca63
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4c4c9bc00c223ff44c91e6eb7fe4f72d7b6cfff6ee9afde5cbc5585c056a187
|
|
| MD5 |
885464c0dc619f0c73f83b4372182edb
|
|
| BLAKE2b-256 |
f7144512682e887bf3a3ed3e4f02f6e8e1edb716a30310afb0d488f08b6176e3
|