This project is an implementation of RAG technology which stands for Retrieval-Augmented Generation.
You can ask questions to your PDF files with its easy-to-use interface.
-
Download Ollama from the given link: https://ollama.com/
-
Download Mistral for Ollama in terminal:
ollama pull mistral
-
Download text encoder for Ollama in terminal:
ollama pull nomic-embed-text
-
Create a directory in your workspace.
-
Change directory into your project folder.
-
Clone the repo to the project folder:
-
Create a virtual environment:
python -m venv env
-
Activate the virtual environment:
- Unix/MacOS:
source env/bin/activate
- Windows:
.\env\Scripts\activate
- Unix/MacOS:
-
Install the required packages:
pip install -r requirements.txt
- Add PDF documents into the
data
folder** - Run the database population script:
or start from scratch with the
python createVectorDatabase.py
--reset
argument:python createVectorDatabase.py --reset
- Wait until the building process is done.
-
Open a terminal and start Ollama:
ollama serve
-
Open another terminal in the project folder and run the server:
python server.py
-
Go to
localhost:5000
or the given IP in the second terminal. -
Ask a question based on the context that you uploaded to the
data
folder.python ask.py "What is RAG?"
In Unix systems, file paths are written using forward slashes (/):
# File path for Unix systems
images_dir_unix = "/images"
print(images_dir_unix)
In Windows systems, file paths are written using backslashes (). However, in Python, backslashes are escape characters, so you should use double backslashes (\) or raw strings:
# File path for Windows systems (using double backslashes)
images_dir_windows = "\\images"
# or using raw strings
images_dir_windows_raw = r"\images"
print(images_dir_windows)
print(images_dir_windows_raw)
This project is licensed under the MIT License - see the LICENSE file for details.
List the authors of the project.
- Ümit - Initial work
-
Ollama'yı verilen bağlantıdan indirin: https://ollama.com/
-
Terminalden Ollama Mistral'ı indirin:
ollama pull mistral
-
Terminalden Ollama için metin kodlayıcıyı indirin:
ollama pull nomic-embed-text
- Çalışma alanınızda bir dizin oluşturun.
- Proje klasörünüze geçin.
- Depoyu proje klasörüne klonlayın
- Sanal bir ortam oluşturun:
python -m venv env
- Sanal ortamı etkinleştirin:
- Unix/MacOS:
source env/bin/activate
- Windows:
.\env\Scripts\activate
- Unix/MacOS:
- Gerekli paketleri yükleyin:
pip install -r requirements.txt
- PDF belgelerinizi
data
klasörüne ekleyin** - Veritabanı popülasyon skriptini çalıştırın:
veya sıfırdan başlamak isterseniz
python createVectorDatabase.py
--reset
argümanı ile çalıştırın:python createVectorDatabase.py --reset
- Oluşturma işlemi tamamlanana kadar bekleyin.
-
Bir terminal açın ve Ollama'yı başlatın:
ollama serve
-
Proje klasörünüzde başka bir terminal açın ve sunucuyu başlatın:
python server.py
-
Tarayıcınızda
localhost:5000
adresine veya ikinci terminalde belirtilen IP adresine gidin. -
data
klasörüne yüklediğiniz belgelerden yararlanarak bir soru sorun.python ask.py "What is RAG?"
Unix sistemlerinde dosya yolları ileri eğik çizgi (/) kullanılarak yazılır:
# Unix sistemleri için dosya yolu
images_dir_unix = "/images"
print(images_dir_unix)
Windows sistemlerinde dosya yolları geri eğik çizgi () kullanılarak yazılır. Ancak, Python'da geri eğik çizgi kaçış karakteri olduğundan, çift geri eğik çizgi (\) kullanmalısınız veya ham string (r
) kullanabilirsiniz:
# Windows sistemleri için dosya yolu (çift geri eğik çizgi kullanarak)
images_dir_windows = "\\images"
# veya ham string kullanarak
images_dir_windows_raw = r"\images"
print(images_dir_windows)
print(images_dir_windows_raw)
Bu proje MIT Lisansı altında lisanslanmıştır - daha fazla bilgi için LICENSE dosyasına bakın.
- Ümit - Başlangıç çalışması