Skip to main content

Universal RAG framework SDK for Python developers

Project description

RAGKit

Universal RAG (Retrieval-Augmented Generation) framework SDK for Python.

Build AI-powered assistants, document search, and FAQ systems in minutes — without rewriting the pipeline for every project.

CI Coverage PyPI License: MIT Python 3.10+


What is RAGKit?

RAGKit is an open-source Python SDK that gives you a complete Retrieval-Augmented Generation pipeline in a few lines of code.

You plug in your data sources, RAGKit handles the rest: chunking, embedding, vector storage, retrieval, and LLM generation via OpenRouter.

Your Data → RAGKit → Answer

Quick Start

pip install ragkit-sdk
rag init

Add your API key to .env:

OPENROUTER_API_KEY=your-key-here

Build your first agent:

from ragkit import Agent, MarkdownSource

agent = Agent()
agent.use(MarkdownSource("./docs"))
agent.index()

print(agent.ask("How does authentication work?"))

That's it. No vector database setup. No embedding model download configuration. No prompt engineering.


Features

  • 6 built-in sources — Markdown, TXT, JSON, CSV, REST API, Directory
  • Automatic pipeline — load → clean → chunk → embed → index
  • Semantic search — Chroma or Qdrant vector store
  • 100+ LLMs — via OpenRouter (GPT-4o, Claude, Gemini, Llama…)
  • Streaming — async token-by-token output
  • Cache — embeddings and query results cached on disk
  • Hooks — intercept before/after generate and response
  • Plugin systempip install ragkit-pdf to add PDF support
  • CLIrag init, rag index, rag ask, rag dev, rag serve

Installation

pip install ragkit-sdk

Optional extras:

pip install ragkit-sdk[serve]    # HTTP server (FastAPI + uvicorn)
pip install ragkit-sdk[qdrant]   # Qdrant vector store

Usage Examples

Multiple sources

from ragkit import Agent, MarkdownSource, CsvSource, RestSource

agent = Agent()
agent.use(MarkdownSource("./docs"))
agent.use(CsvSource("./faq.csv", content_column="answer"))
agent.use(RestSource("https://api.example.com/kb", content_key="body"))

agent.index()
print(agent.ask("What is the return policy?"))

Streaming

import asyncio

async def main():
    agent = Agent()
    agent.use(MarkdownSource("./docs"))
    agent.index()

    async for token in agent.stream("Summarize the onboarding guide"):
        print(token, end="", flush=True)

asyncio.run(main())

Custom model

from ragkit import Agent
from ragkit.models import OpenRouterProvider

agent = Agent()
agent.set_model(OpenRouterProvider(
    model="anthropic/claude-sonnet-4-5",
    temperature=0.3,
))

Hooks

@agent.on("before_generate")
def log_prompt(prompt: str) -> None:
    print(f"Sending {len(prompt)} chars to LLM")

@agent.on("after_response")
def save_answer(response: str) -> None:
    with open("answers.log", "a") as f:
        f.write(response + "\n")

Extend with a custom source

from ragkit.core.base import SourceAdapter, Document

class NotionSource(SourceAdapter):
    def load(self) -> list[Document]:
        # fetch from Notion API
        ...

agent.use(NotionSource())

CLI

rag init                        # Initialize a new project (rag.yaml + .env)
rag index                       # Index all configured sources
rag sync                        # Sync sources and re-index
rag ask "What is X?"            # One-shot question
rag dev                         # Interactive REPL
rag serve --host 0.0.0.0        # HTTP API on /ask

Documentation

Full documentation: hustlerlabs.github.io/ragkit


Roadmap

Version Features
V0.1 Core pipeline, 6 sources, Chroma, OpenRouter, CLI, cache, hooks, plugins
V0.2 Hybrid search (BM25 + vector), streaming CLI, plugin PDF
V0.3 PostgreSQL, MongoDB sources
V0.5 Observability (cost tracking, latency dashboard)
V1.0 Stable API, full docs site

Contributing

Contributions are welcome. See CONTRIBUTING for guidelines.

git clone https://github.com/HustlerLabs/ragkit
cd ragkit
pip install -e ".[dev]"
pytest tests/

License

MIT — see 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

ragkit_sdk-0.1.1.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

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

ragkit_sdk-0.1.1-py3-none-any.whl (25.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ragkit_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ragkit_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0b6b17dceddfae89ea3ce690d65eac756cf895efcf58fa7052cfdc7af6006994
MD5 adb7f604e08bab6dc3610dd3e04f46e5
BLAKE2b-256 84353f57ee3671aadce8edb1f89e9e7e60e7c7de779102cc9e0b2ec75f377085

See more details on using hashes here.

Provenance

The following attestation bundles were made for ragkit_sdk-0.1.1.tar.gz:

Publisher: publish.yml on HustlerLabs/ragkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: ragkit_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ragkit_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 02ba01db144e9f61767d1ffff13fbf3c787224f4721844afb059fcbb1277b4f8
MD5 8177281f8dac80e68b7a1e2c2a596cbf
BLAKE2b-256 e7ba22ee3c9e78e9c0517e6cb8522df2f23db17f3a25520f6ad45e541ec88c85

See more details on using hashes here.

Provenance

The following attestation bundles were made for ragkit_sdk-0.1.1-py3-none-any.whl:

Publisher: publish.yml on HustlerLabs/ragkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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