pgvectorscale-rag-solution  by daveebbelaar

High-performance RAG solutions with PostgreSQL

Created 1 year ago
258 stars

Top 98.1% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

This project provides a practical implementation of Retrieval-Augmented Generation (RAG) using pgvectorscale and PostgreSQL as a robust, cost-effective vector database. Aimed at AI engineers, it enables building high-performance RAG solutions with advanced retrieval techniques and OpenAI embeddings, integrating vector data seamlessly with relational data.

How It Works

The solution leverages PostgreSQL, enhanced by pgvectorscale, to manage both relational and vector data, eliminating the need for separate vector databases. It utilizes OpenAI's text-embedding-3-small model for generating vector embeddings from document chunks. Core functionality includes hybrid search and intelligent answer generation, with pgvectorscale offering DiskANN-inspired indexing for accelerated Approximate Nearest Neighbor (ANN) searches, improved recall, and efficient time-based filtering.

Quick Start & Requirements

  • Prerequisites: Docker, Python 3.7+, OpenAI API key, PostgreSQL GUI client.
  • Setup: Requires setting up a Dockerized TimescaleDB instance, connecting via a GUI client, installing Python dependencies (pip install -r requirements.txt), configuring the OpenAI API key in .env, and running provided Python scripts (insert_vectors.py, similarity_search.py).
  • Resources: A YouTube tutorial and links to Timescale documentation are provided for detailed guidance.

Highlighted Details

  • Performance: Positions PostgreSQL with pgvectorscale as faster and cheaper than dedicated solutions like Pinecone, offering significant speedups for ANN searches.
  • Indexing: Supports multiple index types, including Timescale's proprietary DiskANN-inspired timescale_vector_index, pgvector's HNSW, and IVFFLAT, crucial for large datasets.
  • Vector Search: Implements cosine similarity search, with detailed explanations on interpreting distance metrics (0 being most similar).
  • Hybrid Search: Integrates advanced retrieval methods beyond simple vector similarity.

Maintenance & Community

This repository serves as a reference implementation for a RAG solution. Maintenance and community support details for the underlying pgvectorscale library are not specified within this README.

Licensing & Compatibility

The specific open-source license for this solution repository is not explicitly stated in the provided README. Compatibility for commercial use or integration with closed-source systems would require clarification on licensing terms.

Limitations & Caveats

The solution relies on external proprietary services (OpenAI API) for embeddings. Setup involves multiple components (Docker, Python environment, database connection). The absence of a stated license is a notable caveat for adoption.

Health Check
Last Commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
6 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.