This project is based on Kapelo AI RAG, which was also the reason for creating a larger and more customizable script for local AI RAG.
What is RAG?
Retrieval-Augmented Generation (or RAG), which loads a specific dataset into an AI model. Without it, a highly intricate and complex model training process would be required. Essentially, RAG converts text into vectors and then splits it into chunks, enabling the model to understand what that information represents. Also you can search more informations in Web
- Go to ollama.com and select a model
- Execute command
ollama run [full model name]--> Exampleollama run ilsp/llama-krikri-8b-instruct:q4_k_m
cd [directory of use]python -m venv venv./venv/bin/pip install --upgrade pip--only at install (one time)./venv/bin/pip install chromadb pypdf python-pptx tqdm requests pytesseract pdf2image pillow mwparserfromhell--only at install (one time)./venv/bin/python Setup.py(Setup file must be in the same folder with cd command)
--model [ollama model name*] --> Example ./venv/bin/python Setup.py --model krikri-gpu:latest
After load of model Setup.py support indexing from a database (.xml.bz2 dump), like Wikipedia (Greek Wikipedia).
Example:
💬 Question: wiki
📂 Path from .xml.bz2 dump: [full file path of .xml.bz2]
*Ollama model name can be found be the execute of command ollama list
- Support OCR from images, pdfs, pptx
- In the index, a selection is made between sources containing more theory and sources that primarily feature logical content (Mathematics - Computer Science). 'OneTime' refers to the folders containing sources, meaning data that will be added to the model without indexing
- It supports the automatic extraction of files to the
Outputfolder - Multithread
- Progress check
- 100% self-host (No API keys required)
Full tree path folder
|-- AuthorizedMath/ (Sources with Math/Logic for indexing) |-- AuthorizedThe/ (Sources with Theory for indexing) |-- db/ (ChromaDB database directory) |-- materials/ (Materials/Documents storage) |-- OneTimeMath/ (One-time-use Math sources - no indexing) |-- OneTimeThe/ (One-time-use Theory sources - no indexing) |-- Output/ (Automatic file extraction folder) |-- venv/ (Python Virtual Environment) |-- Modelfile (Ollama configuration file) |-- Modelfile.save (Backup configuration file) |-- Data_Trainner (Beta) |-- topics_tag.py (All the tags with keywords) |-- Setup.py (Main application script)
All this code was written by Claude, DeepSeek and Gemini, while the idea and review were done by Android_Creator.
Python libraries: chromadb, pypdf, python-pptx, tqdm, requests, pytesseract, pdf2image, pillow, mwparserfromhell