Lightweight, LLM-agnostic RAG pipeline with pluggable corpora. Works with Claude, OpenAI, Gemini, or any LLM.
Project description
attune-rag
Lightweight, LLM-agnostic RAG pipeline with pluggable corpora. Works with Claude, OpenAI, Gemini, or any LLM.
- No LLM SDK at install time. All provider deps are optional extras.
- Pluggable corpus. Use attune-help (the default), any
markdown directory, or your own
CorpusProtocol. - Returns a prompt string by default — send it to whatever LLM you like. Optional provider adapters ship convenience wrappers.
- Optional hybrid retrieval.
QueryExpanderandLLMRerankerlayer Claude Haiku on top of keyword retrieval to improve recall and precision — both opt-in, both fail-safe.
Install
pip install attune-rag # core only
pip install 'attune-rag[attune-help]' # + bundled help corpus
pip install 'attune-rag[claude]' # + Claude adapter
pip install 'attune-rag[openai]' # + OpenAI adapter
pip install 'attune-rag[gemini]' # + Gemini adapter
pip install 'attune-rag[all]' # everything
Quick start — Claude
pip install 'attune-rag[attune-help,claude]'
import asyncio
from attune_rag import RagPipeline
async def main():
pipeline = RagPipeline() # defaults to AttuneHelpCorpus
response, result = await pipeline.run_and_generate(
"How do I run a security audit with attune?",
provider="claude",
)
print(response)
print("\nSources:", [h.entry.path for h in result.citation.hits])
asyncio.run(main())
Quick start — OpenAI
pip install 'attune-rag[attune-help,openai]'
response, result = await pipeline.run_and_generate(
"...", provider="openai", model="gpt-4o",
)
Quick start — Gemini
pip install 'attune-rag[attune-help,gemini]'
response, result = await pipeline.run_and_generate(
"...", provider="gemini", model="gemini-1.5-pro",
)
Quick start — custom corpus, any LLM
from pathlib import Path
from attune_rag import RagPipeline, DirectoryCorpus
pipeline = RagPipeline(corpus=DirectoryCorpus(Path("./my-docs")))
result = pipeline.run("How do I...?")
# Send result.augmented_prompt to whatever LLM you use.
# The pipeline itself does NOT call an LLM unless you use
# run_and_generate or call a provider adapter yourself.
Hybrid retrieval (optional)
QueryExpander and LLMReranker require the [claude] extra and an
ANTHROPIC_API_KEY. Both are opt-in and fail-safe — any API error
falls back to keyword-only order automatically.
from attune_rag import RagPipeline, LLMReranker, QueryExpander
# Reranker only (recommended for precision):
pipeline = RagPipeline(reranker=LLMReranker())
# Expander + reranker (max coverage):
pipeline = RagPipeline(
expander=QueryExpander(),
reranker=LLMReranker(),
)
Dashboard
attune-rag dashboard show # live terminal dashboard
attune-rag dashboard render --out report.html # HTML snapshot
Roadmap — embeddings (next minor release)
Keyword retrieval + optional Claude reranker currently carry
attune-rag past 87% P@1 on the attune-help golden set. The
remaining misses are queries with zero token overlap against
their target doc (e.g. "vulnerability scan" →
tool-security-audit.md). Closing that gap needs vector search.
Next minor release will ship attune-rag[embeddings] using
fastembed for local,
CPU-only embeddings — no new network dependency, no API key
required at retrieval time. Keyword retrieval stays the default;
embeddings layer in opt-in, same shape as QueryExpander and
LLMReranker.
See CHANGELOG.md for the decision record and remaining-gap analysis.
Prompt caching (Claude only)
When using the Claude provider, run_and_generate automatically enables
Anthropic prompt caching
on the stable RAG context prefix (≥ 1 024 chars). This eliminates
repeated token costs on the corpus portion of the prompt when the same
context block is reused across calls.
No configuration needed — the provider handles the cache_control
header automatically.
Status
v0.1.10. Part of the attune ecosystem (attune-ai, attune-help, attune-author).
License
Apache 2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 attune_rag-0.1.11.tar.gz.
File metadata
- Download URL: attune_rag-0.1.11.tar.gz
- Upload date:
- Size: 45.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d54a3992d9aa6517d7dda52217ad7545310f54d6ee631df8c1e14ac9ee5f47b2
|
|
| MD5 |
0ce845efefba5f7202ef4d286dad101e
|
|
| BLAKE2b-256 |
27b8911fd8c1fc6766b91109a66c3848de8e977fcb1a30701c16b62d5f1743a9
|
Provenance
The following attestation bundles were made for attune_rag-0.1.11.tar.gz:
Publisher:
publish.yml on Smart-AI-Memory/attune-rag
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
attune_rag-0.1.11.tar.gz -
Subject digest:
d54a3992d9aa6517d7dda52217ad7545310f54d6ee631df8c1e14ac9ee5f47b2 - Sigstore transparency entry: 1417795073
- Sigstore integration time:
-
Permalink:
Smart-AI-Memory/attune-rag@b630b005e89b02464ba4e255ffe481d879e70094 -
Branch / Tag:
refs/tags/v0.1.11 - Owner: https://github.com/Smart-AI-Memory
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b630b005e89b02464ba4e255ffe481d879e70094 -
Trigger Event:
release
-
Statement type:
File details
Details for the file attune_rag-0.1.11-py3-none-any.whl.
File metadata
- Download URL: attune_rag-0.1.11-py3-none-any.whl
- Upload date:
- Size: 54.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15703f7930e175a639d837243cb17b177708c9bbc90757eefd669f2c51b8e311
|
|
| MD5 |
e661d469fb1ab19c8a2f91a7307b4437
|
|
| BLAKE2b-256 |
fd32543d213a2935e50bd55075859ad85a29740765000c8c8ad65cf844292aa3
|
Provenance
The following attestation bundles were made for attune_rag-0.1.11-py3-none-any.whl:
Publisher:
publish.yml on Smart-AI-Memory/attune-rag
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
attune_rag-0.1.11-py3-none-any.whl -
Subject digest:
15703f7930e175a639d837243cb17b177708c9bbc90757eefd669f2c51b8e311 - Sigstore transparency entry: 1417795080
- Sigstore integration time:
-
Permalink:
Smart-AI-Memory/attune-rag@b630b005e89b02464ba4e255ffe481d879e70094 -
Branch / Tag:
refs/tags/v0.1.11 - Owner: https://github.com/Smart-AI-Memory
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b630b005e89b02464ba4e255ffe481d879e70094 -
Trigger Event:
release
-
Statement type: