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.
-
Backend API: The core of the application is a FastAPI service defined in
src/personal_website_rag/__init__.py. It exposes an endpoint/askthat 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(asqa) 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.
- Clone the Repository:
git clone https://github.com/zeerafle/personal-website-rag.git cd personal-website-rag - Set up a Python Virtual Environment and Install Dependencies with RY:
curl -sSf https://rye.astral.sh/get | bash rye sync
Start the FastAPI server using a command like:
uvicorn personal_website_rag.app:app --reloadThis 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.
- Endpoint:
/askMethod: POST Payload Example:Response Example:{ "question": "What is the purpose of this application?" }{ "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.
-
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.
For questions, please contact Sam Fareez at 20249258020@cumhuriyet.edu.tr.