Skip to main content

ragsmith

CI codecov Docs License: MIT

Async RAG toolkit on top of Postgres + pgvector and Voyage AI, with zero direct or indirect numpy / pandas dependency.

Highlights

  • 100% async (asyncpg, httpx).
  • Voyage embeddings via the raw HTTP API (no SDK, no numpy).
  • pgvector storage with cosine similarity search.
  • Strict tooling: ruff (all rules), pytest, 100% coverage in CI.
  • Python 3.14+.

Install

uv sync

Local pgvector database

A docker-compose.yml is provided for local development and integration testing:

docker compose up -d           # start Postgres + pgvector on localhost:5432
docker compose down -v         # stop and wipe the volume

Connection string (also written in .env.example):

DATABASE_URL=postgresql://postgres:postgres@localhost:5432/ragsmith

Usage

import asyncio
import os

from ragsmith import PgVectorStore, VoyageClient, Retriever, Document, chunk_text


async def main() -> None:
    async with VoyageClient() as voyage:
        store = await PgVectorStore.from_dsn(os.environ["DATABASE_URL"], dim=1024)
        try:
            chunks = chunk_text("Long document text...", max_chars=500)
            vectors = await voyage.embed([c.text for c in chunks], input_type="document")
            await store.upsert(
                Document(content=c.text, embedding=v)
                for c, v in zip(chunks, vectors, strict=True)
            )

            retriever = Retriever(voyage, store)
            for hit in await retriever.retrieve("what is rag?", k=3):
                print(hit.score, hit.document.content)
        finally:
            await store.aclose()


asyncio.run(main())

Tests

uv run pytest                              # unit + doctests, 100% coverage gate
uv run pytest -m integration --no-cov      # live tests against pgvector + Voyage
uv run python examples/quickstart.py       # end-to-end demo

Integration tests skip cleanly when DATABASE_URL / VOYAGE_API_KEY are absent. Start the local DB with docker compose up -d and source .env before running them.

Documentation

Full API reference: https://gghez.github.io/ragsmith/

Releasing

Releases are fully automated through GitHub Actions and PyPI Trusted Publishing (OIDC, no API token stored).

  1. Bump version in pyproject.toml and commit (e.g. chore: bump to 0.2.0).

  2. Tag and push:

    git tag v0.2.0
    git push origin v0.2.0
    
  3. The Release workflow runs uv build, publishes the sdist + wheel to PyPI and creates a matching GitHub Release with the artifacts attached.

One-time PyPI setup: register the project on PyPI as a Trusted Publisher pointing to gghez/ragsmith, workflow release.yml, environment pypi.

License

MIT

Metadata

Release files for ragsmith 0.0.2

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

Source distribution (sdist)

Source distribution for ragsmith 0.0.2
File Size Uploaded
ragsmith-0.0.2.tar.gz 46.1 kB Details

Built distribution (wheel)

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

Total release size: 56.5 kB

Release files / ragsmith-0.0.2.tar.gz

Download URL ragsmith-0.0.2.tar.gz
Size 46.1 kB
Tags Source
SHA-256 checksum
How to use checksums
edc7edcfafbf505a201b1746b0ea889da4e02b5cb608ad2d50423ddd6dcdc907
BLAKE2b-256 checksum
How to use checksums
e63327a598dda8642fc3b2a3cee552be42311551430fd108473b3415f5a3dbe4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 13, 2026.

Transparency log

Release files / ragsmith-0.0.2-py3-none-any.whl

Download URL ragsmith-0.0.2-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67b8270da60854e45a6d4a037df9c40239f6ad037efbeb979e81089e027107e2
BLAKE2b-256 checksum
How to use checksums
a5db0383cb7f8f0d6c12fe94027c1ac0254ca164e570a90335656c32700f385b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release 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