Skip to main content

Async RAG toolkit on top of Postgres/pgvector and Voyage AI.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ragsmith-0.0.2.tar.gz (46.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ragsmith-0.0.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file ragsmith-0.0.2.tar.gz.

File metadata

  • Download URL: ragsmith-0.0.2.tar.gz
  • Upload date:
  • Size: 46.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ragsmith-0.0.2.tar.gz
Algorithm Hash digest
SHA256 edc7edcfafbf505a201b1746b0ea889da4e02b5cb608ad2d50423ddd6dcdc907
MD5 194837c5367a841bdcc933b2cbb2f543
BLAKE2b-256 e63327a598dda8642fc3b2a3cee552be42311551430fd108473b3415f5a3dbe4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ragsmith-0.0.2.tar.gz:

Publisher: release.yml on gghez/ragsmith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ragsmith-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: ragsmith-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ragsmith-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 67b8270da60854e45a6d4a037df9c40239f6ad037efbeb979e81089e027107e2
MD5 61d29819a4073866ee439c3600f213e6
BLAKE2b-256 a5db0383cb7f8f0d6c12fe94027c1ac0254ca164e570a90335656c32700f385b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ragsmith-0.0.2-py3-none-any.whl:

Publisher: release.yml on gghez/ragsmith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page