Skip to main content

rag-anchor

A Python library for adding RAG (Retrieval-Augmented Generation) to an existing project: ingest documents, store them as vectors, and answer questions from them.

Status: under development. The version published on PyPI (0.0.0) only reserves the name. The first working release will be 0.1.0.

Install

pip install rag-anchor

Use

from rag_anchor import GoogleProvider, MemoryStore, RagAnchor

provider = GoogleProvider()  # reads GEMINI_API_KEY
rag = RagAnchor(store=MemoryStore(), embedder=provider, generator=provider)

rag.ingest_directory("notes/")
answer = rag.ask("Where did you work in 2022?")

print(answer.text)
for hit in answer.hits:
    print(f"  {hit.score:.2f}  {hit.chunk.content[:60]}")

Or from the command line:

rag-anchor build notes/          # ingest a directory -> index.json
rag-anchor ask "..." -v          # answer, with the score of each excerpt
rag-anchor chunks                # see what was actually indexed

Principles

  • No web dependency in the core — usable from Django, FastAPI, a cron script or a notebook.
  • No infrastructure required — the index can be a plain file; Postgres with pgvector is an option, not a prerequisite.
  • Similarity scores are always exposed, so "the information is absent from the corpus" can be told apart from "retrieval missed it".

Development

pip install -e ".[dev]"
pytest

examples/ holds a small demo corpus about a fictional person, which the test suite runs the whole pipeline against without touching the network.

Metadata

Release files for rag-anchor 0.1.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 rag-anchor 0.1.0
File Size Uploaded Provenance Actions
rag_anchor-0.1.0.tar.gz 52.1 kB Without provenance Details for rag_anchor-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rag-anchor 0.1.0
File Interpreter ABI Platform Actions
rag_anchor-0.1.0-py3-none-any.whl Python 3 none any Details for rag_anchor-0.1.0-py3-none-any.whl

Total release size: 82.1 kB

Release files / rag_anchor-0.1.0.tar.gz

Download URL rag_anchor-0.1.0.tar.gz
Size 52.1 kB
Tags Source
SHA-256 checksum
How to use checksums
445f613e9645a2c0659286c2da5b024fd8d17a1727fe95a2b4210b5cb94f3006
BLAKE2b-256 checksum
How to use checksums
12bf71daa239236c694728fb27951f12fb0dca50e687d7e474b0dde2bba3a05c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / rag_anchor-0.1.0-py3-none-any.whl

Download URL rag_anchor-0.1.0-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
104a718710911dc94d5ccfdd61ad4d0cb80552e04f77c017a51b8eb955b53190
BLAKE2b-256 checksum
How to use checksums
08fb9f47dbb2ca055ab826e59d1bc6f6f4a3a5824f8d79be3f84a4116d8afcc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for rag-anchor 0.1.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.1.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