RAG (Retrieval-Augmented Generation) System
A Python-based RAG system that processes text files, generates embeddings, and stores them in a Postgres database with pgvector for efficient similarity search.
For detailed information, see:
- Design Document - System architecture and requirements
- Developer Guide - Detailed setup and development instructions
Features
- File ingestion (source code, Markdown, plain text)
- Text chunking with configurable overlap
- Vector embeddings via OpenAI or Hugging Face
- Postgres + pgvector for vector storage and search
- Project-based organization of documents
- Comprehensive Taskfile for development workflows
- Dockerized Postgres database with pgvector
Getting Started
Prerequisites
- Python 3.10+
- Docker
- Poetry (will be installed automatically by the setup script)
Poetry Management
This project uses Poetry for dependency management. Key Poetry commands are wrapped in Taskfile tasks:
- Install dependencies:
task install
- Set up development environment:
task setup-dev
- Update dependencies:
task update-deps
- Export requirements files:
task export-reqs
- Check dependency status:
task verify-deps
The project includes both runtime and development dependencies specified in pyproject.toml.
Installation
- Clone the repository:
git clone https://github.com/SpillwaveSolutions/vector-rag
cd vector-rag
- Set up the development environment:
task setup-dev
- Configure environment variables:
cp environment/.env.example .env
# Edit .env with your settings:
# - Database credentials
# - OpenAI API key (if using OpenAI embeddings)
Running the System
Start the Database
The system uses a Dockerized Postgres database with pgvector:
task db:up
Run Examples
- With mock embeddings (no API key required):
task demo:mock
- With OpenAI embeddings (requires API key in .env):
task demo:openai
Interactive Database Access
To access the database directly:
task psql
Testing
The project includes comprehensive tests:
- Run all tests:
task test:all
- Run integration tests:
task test:integration
- Run tests with coverage report:
task test:coverage
- Run a specific test:
task test:single -- tests/path/to/test_file.py::test_name
Development Workflow
Code Formatting and Linting
task format # Runs black and isort
task typecheck # Runs mypy
task lint # Runs all code quality checks
Dependency Management
- Update dependencies:
task update-deps
- Export requirements files:
task export-reqs
Database Management
- Recreate the database from scratch:
task db:recreate
- Stop the database:
task db:down
Configuration
The system is configured through environment variables in .env. Key settings include:
DB_*: Database connection settingsOPENAI_API_KEY: Required for OpenAI embeddingsLOCAL_EMBEDDING: Set totrueto use local SentenceTransformersEMBEDDINGS_DIM: Vector dimension (384 for local, 1536 for OpenAI)CHUNK_SIZE/CHUNK_OVERLAP: Text chunking parameters
License
MIT License
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
Please ensure all tests pass and code is properly formatted before submitting PRs.
Metadata
Release files for vector-rag 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vector_rag-0.1.1.tar.gz | 19.3 kB | Without provenance | Details for vector_rag-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vector_rag-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for vector_rag-0.1.1-py3-none-any.whl |
Total release size: 45.5 kB
Release files / vector_rag-0.1.1.tar.gz
| Download URL | vector_rag-0.1.1.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d035f33ee6e95b7495cfe9def7b5eed1a4f4033064b97644cd205eca8e6fa7b
|
|
BLAKE2b-256 checksum How to use checksums |
b1b1d393bfd3fc4900fa7dac879afba780d4a3163fd693bfb857f9a9c302ad80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / vector_rag-0.1.1-py3-none-any.whl
| Download URL | vector_rag-0.1.1-py3-none-any.whl |
|---|---|
| Size | 26.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7809061e8df272edd638005b91152979646d8ab15321e61d918a06265820c39d
|
|
BLAKE2b-256 checksum How to use checksums |
55830e6bebb3a6d6bda9cc4be34fda3659faf85fa70e90b7aebf9a2df6027d2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for vector-rag 0.1.1
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.