GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - RaghavOG/rag-python: rag-python— lightweight Python RAG library with multi-LLM, query rewriting, reranking, and guardrails

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
data
data
 
 
docs
docs
 
 
examples
examples
 
 
frontend
frontend
 
 
src/rag_python
src/rag_python
 
 
tests
tests
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
main.py
main.py
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

rag-python

PyPI version PyPI downloads Python 3.10+ License: MIT Documentation

Production-grade Retrieval-Augmented Generation (RAG) for Python — ingest documents, ask questions, get grounded answers with multi-LLM support, hybrid search, streaming, and guardrails.

pip install rag-python
export OPENAI_API_KEY=sk-...
rag-python ingest ./docs --reindex
rag-python query "What is our leave policy?"

Author: Raghav Singla · Repo: github.com/RaghavOG/rag-python


Why rag-python?

Capability What you get
Ingest TXT, MD, PDF, DOCX, CSV, JSON, HTML → chunk → embed → ChromaDB
Retrieve Multi-query rewriting, hybrid BM25+vector, reranking, metadata filters
Generate Multi-LLM answers with guardrails, evaluation, and retry loop
Stream rag.query_stream() and --stream CLI for responsive UX
Offline Local embeddings via sentence-transformers
CLI rag-python ingest, query, docs — no code required

Install

pip install rag-python
Extra Install Enables
local pip install rag-python[local] Offline embeddings (sentence-transformers)
hybrid pip install rag-python[hybrid] BM25 + vector hybrid retrieval
rerank pip install rag-python[rerank] Cross-encoder reranking
anthropic pip install rag-python[anthropic] Claude LLM
gemini pip install rag-python[gemini] Gemini LLM
all pip install rag-python[all] All optional features

Quickstart (Python)

from rag_python import RAG

rag = RAG(llm_model="gpt-4o-mini")
rag.ingest(["./data"], reindex=True)

answer = rag.query("How many days of annual leave?")
print(answer.text)
print(answer.sources)

Streaming

stream = rag.query_stream("How many days of annual leave?")
for token in stream:
    print(token, end="", flush=True)
print(stream.result.evaluation)

Hybrid search + metadata filter

rag = RAG(
    retriever="hybrid",  # pip install rag-python[hybrid]
    metadata_filter={"filename": "leave-policy.pdf"},
)
rag.ingest(["./policies/"])
print(rag.query("annual leave policy").text)

Quickstart (CLI)

export OPENAI_API_KEY=sk-...

rag-python ingest ./data --reindex
rag-python query "How many days of annual leave?"
rag-python query "PTO policy" --stream -v
rag-python query "benefits" --retriever hybrid

# Built-in terminal docs
rag-python docs quickstart
rag-python docs --list
rag-python --help

Documentation

Guide Description
Docs index Start here
Usage Python API, streaming, retrieval
CLI reference All rag-python commands and flags
Configuration Env vars and RAGConfig
Providers OpenAI, Azure, Anthropic, Gemini, Ollama, local
Changelog Release notes

In the terminal: rag-python docs [topic] — topics: quickstart, install, cli, config, providers, features


Environment variables

Variable Description
OPENAI_API_KEY Default LLM + embeddings
ANTHROPIC_API_KEY Claude
GEMINI_API_KEY Gemini
AZURE_OPENAI_ENDPOINT / AZURE_OPENAI_API_KEY Azure OpenAI
OLLAMA_BASE_URL Local Ollama (default http://localhost:11434)
RAG_PYTHON_DATA_DIR Document dir (default ./data)
RAG_PYTHON_CHROMA_DIR Vector store (default ./chroma_db)

See Configuration and .env.example.


Project layout

src/rag_python/     # pip install rag-python → import rag_python
  client.py         # RAG, RAGAnswer, query_stream
  rag_pipeline.py   # ingest / query pipeline
  providers/        # OpenAI, Azure, Anthropic, Gemini, Ollama, local
docs/               # User documentation (linked from PyPI README)
tests/
examples/

License

MIT © Raghav Singla

About

rag-python— lightweight Python RAG library with multi-LLM, query rewriting, reranking, and guardrails

pypi.org/project/rag-python/

Topics

chromadbclaudeembeddingsllmopenairagretrieval-augmented-generation

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.