This project is in an experimental phase and remains under active development. Please use it with caution and understand that you do so at your own risk.
- Prepare the docker environment:
- Open the file named
.env-example
.-
Replace the placeholder configurations with your actual settings:
# For OpenAI configuration OPENAI_KEY="your-openai-key" # Default model settings MODEL_NAME="gpt-4o-mini" EMBEDDING_MODEL_NAME="text-embedding-3-small" TEMPERATURE=0.0
-
If using OpenAI models, make sure
OPENAI_KEY
is set, and you can selectMODEL_NAME
andEMBEDDING_MODEL_NAME
from https://platform.openai.com/docs/models. -
If using Ollama, remove
OPENAI_KEY
from the environment to avoid conflicts, and you can selectMODEL_NAME
andEMBEDDING_MODEL_NAME
from https://www.ollama.com/search. -
Save and close the file.
-
Rename the file to
.env
.
-
- Prepare the ollama environment:
- Start the Ollama Docker image using
docker-compose
docker-compose start ollama
- Pull a model supported by Ollama. You can find Ollama models here and replace
mistral
with another model, andavr/sfr-embedding-mistral
with another embedding.
docker exec -it ollama ollama pull mistral
docker exec -it ollama ollama pull avr/sfr-embedding-mistral
Since this project is based on context (RAG), all files in the *.txt
format should be added to the backend/docs
folder.
Please note that if you modify the models, you should ensure the embedding dimensions are correct. Otherwise, you can delete the existing data in chromaDB
by calling the following function from your browser after running the server, and then restart the server to re-embed the docs automatically:
http://localhost:5000/delete-collection
docker compose up --build -d
docker compose up -d
You can skip this part if your system meets all the requirements listed below 👇
-
Clone the project in your preferred IDE (e.g. VScode)
-
Prepare the backend environment:
- Navigate to the backend using
backend
folder:cd backend
- Create a virtual environment for dependencies called
env
using the following command:python -m venv env
- Activate the created
env
by running:- Windows:
env\Scripts\activate.bat
- Unix/MacOS:
env/bin/activate
- Install the required libraries listed in
requirements.txt
by running:pip install -r requirements.txt
- Navigate to the backend using
-
Prepare the frontend environment:
- Navigate to the
frontend
folder:cd ../frontend
- follow the same steps of the
backend
environment
- Navigate to the
-
Set Up Environment Variables:
-
Open the file named
.env-example
. -
Replace the placeholder configurations with your actual settings:
# For OpenAI configuration OPENAI_KEY="your-openai-key" # For Ollama configuration LLM_BASE_URL="http://localhost:11434" # Default model settings MODEL_NAME="gpt-4o-mini" EMBEDDING_MODEL_NAME="text-embedding-3-small" TEMPERATURE=0.0 #for backend configuration API_BASE_URL="http://localhost:5000" # Database configuration CHROMA_DB_SERVER_HOST="localhost" CHROMA_DB_SERVER_PORT=8000 CHROMA_DB_COLLECTION_NAME="docs_collection"
-
If using OpenAI models, make sure
OPENAI_KEY
is set, and you can selectMODEL_NAME
andEMBEDDING_MODEL_NAME
from https://platform.openai.com/docs/models. -
If using Ollama, remove
OPENAI_KEY
from the environment to avoid conflicts, and you can selectMODEL_NAME
andEMBEDDING_MODEL_NAME
from https://www.ollama.com/search. -
Save and close the file.
-
Rename the file to
.env
.
-
-
Prepare the ollama environment:
- Start the Ollama Docker image using
docker-compose
docker-compose start ollama
- Pull a model supported by Ollama. You can find Ollama models here and replace
mistral
with another model, andavr/sfr-embedding-mistral
with another embedding.
docker exec -it ollama ollama pull mistral docker exec -it ollama ollama pull avr/sfr-embedding-mistral
- Start the Ollama Docker image using
-
Prepare the ChromaDB environment:
- Start the ChromaDB Docker image using
docker-compose
docker-compose start chromadb
- Start the ChromaDB Docker image using
Since this project is based on context (RAG), all files in the *.txt
format should be added to the backend/docs
folder.
Please note that if you modify the models, you should ensure the embedding dimensions are correct. Otherwise, you can delete the existing data in chromaDB
by calling the following function from your browser after running the server, and then restart the server to re-embed the docs automatically:
http://localhost:5000/delete-collection
- Navigate to the backend using
backend
folder:cd backend
- Run the application:
uvicorn app:app --host 0.0.0.0 --port 5000 --reload
- Open a new terminal and navigate to the
frontend
folder:cd frontend
- Run the development web server:
streamlit run app.py --server.port=8080 --server.address=0.0.0.0
- Access the web application on the displayed localhost: http://localhost:8080