https://github.com/fedeegmz/hayek-rag
A specialized chat application focused on Friedrich August von Hayek, implementing Retrieval-Augmented Generation (RAG) to provide contextually relevant responses based on Hayek's works.
https://github.com/fedeegmz/hayek-rag
ai artificial-intelligence fastapi mongodb python rag uv voyageai
Last synced: about 2 months ago
JSON representation
A specialized chat application focused on Friedrich August von Hayek, implementing Retrieval-Augmented Generation (RAG) to provide contextually relevant responses based on Hayek's works.
- Host: GitHub
- URL: https://github.com/fedeegmz/hayek-rag
- Owner: fedeegmz
- Created: 2025-06-20T00:13:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-03-05T19:55:31.000Z (4 months ago)
- Last Synced: 2026-04-30T22:35:03.266Z (about 2 months ago)
- Topics: ai, artificial-intelligence, fastapi, mongodb, python, rag, uv, voyageai
- Language: Jupyter Notebook
- Homepage:
- Size: 246 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hayek RAG
A specialized chat application focused on Friedrich August von Hayek, implementing Retrieval-Augmented Generation (RAG)
to provide contextually relevant responses based on Hayek's works.
## Description
Hayek RAG is a project that allows users to upload PDF documents about Friedrich August von Hayek, processes them to
generate embeddings, and stores this information in a MongoDB database. The application uses these embeddings to
implement RAG, enhancing the chat experience by providing responses with relevant context from Hayek's works. Future
plans include fine-tuning the model to further improve its understanding of Hayek's philosophy and economic theories.
## Features
- PDF document upload and processing
- Text extraction and chunking
- Embedding generation using VoyageAI
- MongoDB storage for documents and embeddings
- RAG-powered chat interface
- Context-aware responses based on Hayek's works
## Installation
### Prerequisites
- Python 3.12 or higher
- MongoDB instance (local or Atlas)
- VoyageAI API key
### Setting up the environment
1. Clone the repository:
```bash
git clone https://github.com/fedeegmz/hayek-rag.git
cd hayek-rag
```
2. Create a virtual environment and install dependencies using `uv`:
```bash
uv sync
```
3. Activate a virtual environment:
```bash
source .venv/bin/activate # On Linux/macOS
# or
.venv\Scripts\activate # On Windows
```
### Configuration
Create a `.env` file in the project root with the following variables:
```
MONGODB_URI="your_atlas_connection_string"
EMBEDDING_API_KEY="your_embedding_api_key"
```
## Running the Application
Start the FastAPI server:
```bash
fastapi dev app/main.py
```
The application will be available at http://localhost:8000
API documentation is available at:
- http://localhost:8000/docs (Swagger UI)
## Project Structure
```
hayek-rag/
├── app/ # Main application code
│ ├── core/ # Core configuration
│ ├── document/ # Document processing module
│ │ ├── application/ # Application services
│ │ ├── domain/ # Domain models and interfaces
│ │ └── infrastructure/ # Implementation details
│ ├── shared/ # Shared components
│ │ ├── domain/ # Shared domain models
│ │ └── infrastructure/ # Shared infrastructure
│ └── main.py # Application entry point
├── notebooks/ # Jupyter notebooks for experimentation
├── temp/ # Temporary files
├── .env # Environment variables (create this file)
├── pyproject.toml # Project dependencies
├── README.md # This file
└── uv.lock # Lock file for dependencies
```
## Development
For development, the project uses:
- Ruff and Black for code formatting
- Ruff for linting
- pre-commit for Git hooks
To set up the development environment:
```bash
pre-commit install
```