ragkitframe
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 ragkitframe
# 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
ragkitframe-0.1.0.tar.gz
(10.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ragkitframe-0.1.0.tar.gz.
File metadata
- Download URL: ragkitframe-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0691912744b8129f69d4cedfbfa4c83a231088c1039050ba52fa915e25433a5a
|
|
| MD5 |
196b6b4ca477ac82fe20d70b9c0a9a28
|
|
| BLAKE2b-256 |
7a36d022a865b54aed7697bf3c8115581bb665ffe2682179f1dd7d4fadf1384c
|
File details
Details for the file ragkitframe-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ragkitframe-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
108aaaea2774be30163e5d03b9d6025b3bc7fbd1d5c01ecf69cd065f87bba6ae
|
|
| MD5 |
49760399db922590a0c0a84f72aee4ac
|
|
| BLAKE2b-256 |
67da0173260b2fdd34f31cf8dcb6b521e277fd61487ea1dbbfa33d9a01c6fae9
|