Skip to main content

therag (Python) v0.9.0

Hosted RAG client + fully local RAG through Ollama / LM Studio / llama.cpp. pip install therag — only dependency is requests.

Local RAG (no API key, no cloud)

ollama pull llama3.2
ollama pull nomic-embed-text
ollama serve                       # http://localhost:11434
from therag import LocalRAG

rag = LocalRAG(
    base_url="http://localhost:11434/v1",  # LM Studio: http://localhost:1234/v1
    llm="llama3.2",
    embed_model="nomic-embed-text",
    store="my-store.json",                # "" = memory only
)

rag.build_from_text("Air Zoom Pegasus Rs 11895, in stock")
rag.build_from_file("catalog.txt")
rag.build_from_url("https://example.com/help")

print(rag.ask("Pegasus ki price kya hai?"))
print(rag.ask_full("Kya stock hai?"))  # answer + sources + usage
print(rag.stats())
  • Embeddings fail ho to automatic keyword retrieval fallback.
  • JSON store local rehta hai — data kahin upload nahi hota.
  • Store format JS SDK ke saath same hai (dono SDKs ek hi file shared kar sakte hain).

Hugging Face provider (open models, serverless)

Ollama ke alava HF Inference Providers bhi chalte hain. Chat HF router par, embeddings HF feature-extraction endpoint par. Token HF_TOKEN env se bhi milta hai.

from therag import LocalRAG

rag = LocalRAG(
    provider="huggingface",
    llm="deepseek-ai/DeepSeek-V4.1-Flash:fastest",
    embed_model="sentence-transformers/all-MiniLM-L6-v2",
    # api_key="hf_..."  # optional — HF_TOKEN env sufficient
)
rag.build_from_text("Air Zoom Pegasus Rs 11895, in stock")
print(rag.ask("Pegasus ki price?"))

embed_url se custom embeddings endpoint bhi de sakte ho ({model} replace hota hai). HF serverless hai — internet + token chahiye; Ollama jaisa free/offline nahi.

Automated software flow (one call)

from therag import LocalRAG

# Software ko bas user ki scripts/data folder do — baaki auto:
rag = LocalRAG.auto(
    folder="./user-scripts",   # ya data=... ya text="..."
    llm="llama3.2",
    embed_model="nomic-embed-text",
    base_url="http://localhost:11434/v1",
    store="project-rag.json",
    install=True,              # missing models -> ollama pull (default)
)
print(rag.ask("is script me login kaise hota hai?"))

auto() pehle models check/pull karta hai, phir folder ki saari .py/.js/.ts/.md/.txt/.json/.csv files RAG me daalta hai. LM Studio ke liye install=False rakho aur models GUI se load karo.

Hosted API (as before)

from therag import RAG
rag = RAG(api_key="tk_live_...", rag="catalog.txt")
rag.build_from_text("Product: Pen, Rs 10")
print(rag.ask("cheapest product?"))

Metadata

Release files for therag 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for therag 0.9.0
File Size Uploaded Provenance Actions
therag-0.9.0.tar.gz 13.0 kB Without provenance Details for therag-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for therag 0.9.0
File Interpreter ABI Platform Actions
therag-0.9.0-py3-none-any.whl Python 3 none any Details for therag-0.9.0-py3-none-any.whl

Total release size: 25.2 kB

Release files / therag-0.9.0.tar.gz

Download URL therag-0.9.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5251dd76efc014e18a26c7cc2dd583219be4c1e247eb7659a691567f16a8e63d
BLAKE2b-256 checksum
How to use checksums
c8e4d476780c7534d1e2a8b1e29266bba7797803c90fab0e2f30cb8476e420b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / therag-0.9.0-py3-none-any.whl

Download URL therag-0.9.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a6fa4d007c3dee716c65d2dae81b9ba2077608638c706c0d9add5edc1236325
BLAKE2b-256 checksum
How to use checksums
7ccaa45ad20f685a58733a9a0ab7ddb6993fe0b7946f221b4e9d8ffb2fd86e55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for therag 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files No provenance

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