Skip to content

zeerafle/personal-website-rag

Repository files navigation

Personal Website RAG

This repository hosts a FastAPI application that implements a Retrieval-Augmented Generation (RAG) chain for answering questions. It is designed as part of the personal website project and incorporates various themes and configuration assets.

Overview

  • Backend API: The core of the application is a FastAPI service defined in src/personal_website_rag/__init__.py. It exposes an endpoint /ask that accepts a question and returns an answer along with source references.

  • RAG Chain: The API leverages a RAG chain implementation imported from src/personal_website_rag/rag_chain.py (as qa) to process queries. This module encapsulates the logic for input transformation, retrieval, and answer generation.

  • Dependencies: The project depends on several libraries including FastAPI, langchain, python-dotenv, and others as specified in pyproject.toml. See the [project.dependencies] section for details.

Installation

  1. Clone the Repository:
    git clone https://github.com/zeerafle/personal-website-rag.git
    cd personal-website-rag
  2. Set up a Python Virtual Environment and Install Dependencies with RY:
    curl -sSf https://rye.astral.sh/get | bash
    rye sync

Running the Application

Start the FastAPI server using a command like:

uvicorn personal_website_rag.app:app --reload

This will start the service on http://127.0.0.1:8000. You can test the /ask endpoint by navigating to the auto-generated API documentation at http://127.0.0.1:8000/docs.

API Usage

  • Endpoint: /ask Method: POST Payload Example:
    {
      "question": "What is the purpose of this application?"
    }
    Response Example:
    {
      "answer": "Your answer generated by the RAG chain...",
      "sources": ["source_1", "source_2"]
    }

The endpoint's implementation in app.py demonstrates error handling using FastAPI's HTTP exceptions.

Project Structure

  • src/ Contains the core application code. The FastAPI app and its supporting modules (like the RAG chain in src/personal_website_rag/rag_chain.py) live here.

  • .env, pyproject.toml, README.md, etc.: Additional configuration files for the environment, dependencies, and packaging.

Contact

For questions, please contact Sam Fareez at 20249258020@cumhuriyet.edu.tr.

About

A RAG implementation for my personal site

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors