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())

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.1.tar.gz (45.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.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ragsmith-0.0.1.tar.gz
  • Upload date:
  • Size: 45.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.1.tar.gz
Algorithm Hash digest
SHA256 02f39258626c121ae5bd82d3eec15dd27ac4770c6ef698ab8b9467169ae4b5f7
MD5 5b917bc4c6dbb3e2e3f64a12d425883a
BLAKE2b-256 587e5f92e10b58e5d69ae53b5c176dd47585bedb4d01634fe1d56653e45344ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for ragsmith-0.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: ragsmith-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 747c0b65990d5e4d6b984a4c7a072b7829142c8592082fcb76f386c1a44158da
MD5 2d70386e616d237e146001ee42c4d794
BLAKE2b-256 739a74df241ecf2114956f27ecdaa9fe024d0f2549350033dd1c0aa6af3a8e82

See more details on using hashes here.

Provenance

The following attestation bundles were made for ragsmith-0.0.1-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