Skip to main content

A RAG (Retrieval-Augmented Generation) library for document processing and retrieval.

Project description

insta_rag

insta_rag is a modular, plug-and-play Python library for building advanced Retrieval-Augmented Generation (RAG) pipelines. It abstracts the complexity of document processing, embedding, and hybrid retrieval into a simple, configuration-driven client.

Core Features

  • Semantic Chunking: Splits documents at natural topic boundaries to preserve context.
  • Hybrid Retrieval: Combines semantic vector search with BM25 keyword search for the best of both worlds.
  • Query Transformation (HyDE): Uses an LLM to generate hypothetical answers, improving retrieval relevance.
  • Reranking: Integrates with state-of-the-art rerankers like Cohere to intelligently re-order results.
  • Pluggable Architecture: Easily extend the library by adding new chunkers, embedders, or vector databases.
  • Hybrid Storage: Optional integration with MongoDB for cost-effective content storage, keeping Qdrant lean for vector search.

Quick Start

1. Installation

# Recommended: using uv
uv pip install insta-rag

# Or with pip
pip install insta-rag

2. Basic Usage

from insta_rag import RAGClient, RAGConfig, DocumentInput

# Load configuration from environment variables (.env file)
config = RAGConfig.from_env()
client = RAGClient(config)

# 1. Add documents to a collection
documents = [DocumentInput.from_text("Your first document content.")]
client.add_documents(documents, collection_name="my_docs")

# 2. Retrieve relevant information
response = client.retrieve(
    query="What is this document about?", collection_name="my_docs"
)

# Print the most relevant chunk
if response.chunks:
    print(response.chunks[0].content)

Documentation

For detailed guides on installation, configuration, and advanced features, please see the Full Documentation.

Key sections include:

Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • Setting up your development environment
  • Code quality tools and pre-commit hooks
  • Commit and branch naming conventions
  • Version management
  • Pull request process

License

This project is licensed under the MIT License.

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

insta_rag-0.1.1b1.tar.gz (38.4 kB view details)

Uploaded Source

Built Distribution

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

insta_rag-0.1.1b1-py3-none-any.whl (49.1 kB view details)

Uploaded Python 3

File details

Details for the file insta_rag-0.1.1b1.tar.gz.

File metadata

  • Download URL: insta_rag-0.1.1b1.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.5

File hashes

Hashes for insta_rag-0.1.1b1.tar.gz
Algorithm Hash digest
SHA256 cc3d61885045b65c4ce9c74cb92a421e7f9b6765f16a39ff8dc76cbd4ea36ba6
MD5 4d7c449be4765725be30180a2bb7148c
BLAKE2b-256 1b1fdf756c4f2bff954796cae8243cdd92ce94d87d1f3d58ea5e0519cf8531af

See more details on using hashes here.

File details

Details for the file insta_rag-0.1.1b1-py3-none-any.whl.

File metadata

File hashes

Hashes for insta_rag-0.1.1b1-py3-none-any.whl
Algorithm Hash digest
SHA256 1701b9c03cd127ce82605c5138cb185608f038184136f00d8c0430d9ed38888b
MD5 aecd6a0e2889657bd11292e7f44ea09d
BLAKE2b-256 92411694ea78bb70d6128aa71edb9728e348a194eba4a194000e27a17ac8fc8b

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