A web-based Retrieval Augmented Generation (RAG) system that performs real-time web searches and generates vector embeddings for improved information retrieval.
- Real-time web scraping and content extraction
- Vector embeddings storage in PostgreSQL
- Similarity search capabilities
- Integrated DuckDuckGo search
- Automatic text chunking and embedding generation
- Set up your environment variables:
export POSTGRES_USER=your_user
export POSTGRES_PASSWORD=your_password
export POSTGRES_DB=your_database
export POSTGRES_HOST=localhost
export POSTGRES_PORT=5432
export PG_SET=true- Install dependencies:
pip install langchain-postgres langchain-core duckduckgo-search psycopg- Initialize the PostgreSQL database with the required schema.
Also ensure that the
pgvectorextension is installed.
from web.vec import VectorStorage
from your_embeddings_model import Embeddings
# Initialize with your preferred embeddings model
embeddings = Embeddings()
vector_store = VectorStorage(embeddings)
# Search with automatic web retrieval
results = vector_store.search("your query", refresh=True)
# Search existing embeddings only with automatic web retrival if needed (default)
results = vector_store.search("your query")
# This can then be used as context for a RAG model
# Look at example.py for a good example of how to use this with Google's Gemini ModelThe system consists of three main components:
- Web Scraper: Fetches and extracts content from web pages
- Vector Storage: Manages embeddings in PostgreSQL
- Search Interface: Provides similarity search capabilities
Contributions are welcome! Please feel free to submit a Pull Request.