Skip to main content

ragkit-local

A modular, pip-installable reliability layer for Retrieval-Augmented Generation (RAG) pipelines.

Why ragkit?

  • 100% Fully Local: Requires zero external API calls, zero hosted LLM inference, and runs completely offline.
  • Privacy-First: No data leaves your machine; uses local NLP rules and lightweight, open-source sentence-transformers NLI models.
  • Framework-Agnostic: Plugs directly into LangChain, LlamaIndex, or any custom pythonic RAG pipeline.
  • Import-Only-What-You-Need: Extremely fast import times with lazy loading of all underlying model dependencies on first invocation.

Installation

# Install the library in editable/dev mode or directly
pip install ragkit-local

# Download the required local English spaCy pipeline
python -m spacy download en_core_web_sm

Quickstart Examples

1. Query Decomposition

Split compound queries into atomic questions before retrieval.

from ragkit import QueryDecomposer

decomposer = QueryDecomposer()
sub_questions = decomposer.decompose("What is climate change and how does it affect oceans?")
print(sub_questions)
# Output: ['What is climate change?', 'How does it affect oceans?']

2. Confidence Scoring (Hallucination Detection)

Verify if the generated answer is supported by the retrieved document chunks.

from ragkit import ConfidenceScorer

scorer = ConfidenceScorer()  # Uses tiny 100MB model by default
chunks = ["Photosynthesis uses sunlight to convert water and CO2 into oxygen and glucose."]
answer = "Plants convert carbon dioxide and water into glucose using sunlight. They also produce helium."

result = scorer.score(answer, chunks)
print(f"Score: {result['score']}/100 | Verdict: {result['verdict']}")
# Output: Score: 50/100 | Verdict: partially_grounded
print("Reasoning:", result["reasoning"])

# For better accuracy, use the larger model:
# scorer = ConfidenceScorer(model_name="cross-encoder/nli-deberta-v3-base")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ragkit_local-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

ragkit_local-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file ragkit_local-0.1.0.tar.gz.

File metadata

  • Download URL: ragkit_local-0.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for ragkit_local-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9b2cae03b29a5dbb3b302d4e368a7f6284b6ce195bc0fbabf56706dc0e744753
MD5 72e2544f75920a42241184a672115be9
BLAKE2b-256 2665b0bb21e7a6130d39d830ed8564d54bf849fef506515eae40e3e79bac5dfd

See more details on using hashes here.

File details

Details for the file ragkit_local-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ragkit_local-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for ragkit_local-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbe537a9aff1a4e22e3cbe35965a9a924ea5837db25c31ad458f13a267159ce3
MD5 39d427ec5d463479dfdb4ce7fe74b7ae
BLAKE2b-256 c473b27808ecc98e7d53fff6c58452819b1a7f69c0c345bcb483cdf98d131719

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page