A RAG (Retrieval Augmented Generation) based assistant for question solving and topic explanation, developed for YKS (Higher Education Institutions Examination) students.
- Local Document Processing: Processes lecture notes and books in PDF and TXT formats.
- Vector Search: Finds relevant content, formulas, and sample questions quickly using FAISS.
- Smart Solution: Generates step-by-step, understandable mathematical solutions using Google Gemini API (Gemini 2.5).
- Fast and Lightweight: Does not require a GPU, can run on CPU.
-
Install Requirements
pip install -r requirements.txt
-
Set Environment Variables Copy
.env.exampleto.envand add your Gemini API key.copy .env.example .env
Open
.envand enter yourGEMINI_API_KEY.It is also recommended to add
HF_TOKEN(Hugging Face Token) (https://huggingface.co/settings/tokens):HF_TOKEN=hf_...
Place your PDF or TXT files in the documents/ folder. A sample file konu_anlatimi_ornek.txt is included.
To start indexing:
python -m ingest.ingest_documentsThis process splits documents into chunks, generates embeddings, and saves them to the index/ folder.
Start the API server:
uvicorn app.main:app --reloadThe server will run at http://localhost:8000.
You can ask questions by sending a POST request while the API is running.
Example Request (Curl):
curl -X POST "http://localhost:8000/ask" -H "Content-Type: application/json" -d "{\"question\": \"What are the roots of x^2 + 5x + 6 = 0?\"}"Example Request (Python):
import requests
url = "http://localhost:8000/ask"
payload = {"question": "What are the roots of x^2 + 5x + 6 = 0?"}
response = requests.post(url, json=payload)
print(response.json())app/: Main application code (API, Core, Utils)ingest/: Document processing scriptsdocuments/: Source documentsindex/: Vector database files