Skip to main content

A simple, clean Python library for Retrieval-Augmented Generation (RAG)

Project description

ragify-lib: Effortless Retrieval-Augmented Generation (RAG) Workflows in Python

ragify-lib is a modern, production-ready Python library that makes Retrieval-Augmented Generation (RAG) simple, fast, and flexible. With just a few lines of code, you can chunk, embed, store, and retrieve text using state-of-the-art embedding models and vector databases. Whether you’re building chatbots, search engines, or knowledge assistants, ragify-lib helps you unlock the power of RAG with minimal setup.


🚀 Why Choose ragify-lib?

  • Minimal Setup: Go from raw text to powerful retrieval in minutes.
  • Flexible: Easily configure your embedding model, chunking strategy, and vector database (supports Quadrant and mock mode).
  • Human-Readable Results: Retrieve relevant text chunks with similarity scores and metadata—no need to handle raw embeddings.
  • CLI Included: Use the command-line tool for quick experiments and automation.
  • Open Source: Free to use for research and commercial projects.
  • SEO-Optimized: Designed for discoverability and best practices in AI/NLP.

👤 About the Developer

Rahul Wale
AI Developer & Researcher
Rahul specializes in building practical, scalable AI solutions for real-world problems, with a focus on natural language processing and information retrieval.


📦 Installation

pip install ragify-lib

📝 Example 1: Local RAG Workflow in Python

from ragify import KaliRAG

# 1. Configure your database and embedding model (optional, uses sensible defaults)
rag = KaliRAG()
rag.configure_db(host="localhost", port=6333, collection="my_collection")
rag.configure_embedder(model_name="all-MiniLM-L6-v2")
rag.configure_chunker(chunk_size=256, chunk_overlap=32)

# 2. Store your documents
documents = [
    "Retrieval-Augmented Generation (RAG) combines retrieval and generation for better answers.",
    "ragify-lib makes it easy to build RAG pipelines in Python.",
    "You can use Quadrant or mock mode for vector storage."
]
for doc in documents:
    rag.create_store_embedding(doc)

# 3. Retrieve relevant chunks for a query
results = rag.retrieve_embedding("How does RAG work?")
for chunk in results:
    print(f"Text: {chunk['text']}\nScore: {chunk['score']}\n")

📝 Example 2: File-Based Workflow & CLI Usage

Create embeddings from a file and query them using the CLI:

# Store embeddings from a text file
ragify create --input knowledge.txt --output embeddings.json

# Query your knowledge base
ragify query "What is retrieval-augmented generation?" --top-k 3

Or configure everything via the CLI:

ragify config --host "localhost" --port 6333 --collection "my_collection" --model "all-MiniLM-L6-v2" --chunk-size 256 --chunk-overlap 32

🌟 Features

  • Plug-and-play with Quadrant vector database or use built-in mock mode
  • Customizable chunking and embedding for any use case
  • Returns human-readable results with scores and metadata
  • Designed for both developers and researchers
  • Robust CLI for automation and scripting
  • Easy integration with existing Python projects

🛠️ Advanced Usage

  • Recursive Chunking: Handles very long documents with automatic recursion.
  • Similarity Thresholds: Filter results by similarity score.
  • Comprehensive Logging: Built-in logging for debugging and monitoring.
  • Error Handling: Robust error handling with detailed error messages.

📚 Use Cases

  • AI-powered chatbots and assistants
  • Semantic search engines
  • Knowledge base augmentation
  • Research and prototyping in NLP

📖 Documentation

For full documentation, visit the official docs or see the CLI help:

ragify --help

📄 License

This project is licensed under the MIT License.


ragify-lib: The easiest way to add Retrieval-Augmented Generation to your Python projects.

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

ragify_lib-0.1.2.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

ragify_lib-0.1.2-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file ragify_lib-0.1.2.tar.gz.

File metadata

  • Download URL: ragify_lib-0.1.2.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for ragify_lib-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4e7ee5ecc709755ae39e5d8cb166023d7defde6babdc7c42a8fd7433ebd8d72b
MD5 c7f5f96c577a1eccc739fc92cb7f8667
BLAKE2b-256 7463faea4a364988b9518d0f057cc4d8abed85c5d82d24285bf751379a69b91e

See more details on using hashes here.

File details

Details for the file ragify_lib-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ragify_lib-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for ragify_lib-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 05c7db749460b359a836ebd35052503705fdd79bbd6b62921d241872e1a041fa
MD5 4e629483f3cc7db9cea8a21abb7093df
BLAKE2b-256 61120ecc808396f032115e51608c2111f252ebfdbec615b22fbe19f155f0d01d

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