This guide walks you through how to start developing Nesis on your local workstation. You can get an overview of the components that make up Nesis and its architecture here.
- We use docker and docker-compose to support our development process. If you don't have docker installed locally, please for the Install Docker Engine{target="_blank"} link for instructions on how install docker on your local workstation.
- If you rather not install docker, you will need to have access to a Postgres and Memcached instance.
- Optional: The RAG Engine needs access to an LLM endpoint such as an OpenAI's endpoint or a private LLM endpoint
in order to start querying your documents. You will need to set the
OPENAI_API_KEYand theOPENAI_API_BASEenvironment variables. - Recently, Huggingface requires a
HF_TOKENto download embedding models. You may need to obtain and set yourHF_TOKEN. - You need to have python 3.11 for the API and RAG Engine microservices.
- You also need to have node and npm installed.
!!! note "A word on vector databases"
Nesis' RAG Engine requires a vector database to store vector embeddings. In order to contain the number of
components, we use pgvector packaged into an extended Bitnami Postgres docker image `ametnes/postgresql:16-debian-12`
[here](https://github.com/ametnes/postgresql){target="_blank"}. You are however free to use other vector databases.
Curently, we support `chromadb` and `qdrant`.
Start by checking out the repository.
git checkout https://github.com/ametnes/nesis.git
cd nesis{
docker build --build-arg PUBLIC_URL=/ --build-arg PROFILE=PROD -t ametnes/nesis:latest-frontend . -f nesis/frontend/Dockerfile
docker build -t ametnes/nesis:latest-api . -f nesis/api/Dockerfile
docker build -t ametnes/nesis:latest-rag . -f nesis/rag/Dockerfile
}docker-compose up-
Point your browser to http://localhost:58000/
-
Login with
- Email:
some.email@domain.com - Password:
password
- Email:
Supporting services include:
- Postgres (for the backend database as well as the vector database).
- Memcached for caching and locking services.
- Optional Minio for document storage.
- Optional Samba for document storage.
To start the supporting services, in a separate terminal, run:
docker-compose -f compose-dev.yml up- Create a virtual environment:
python -m venv .venv
- Activate the virtual environment:
source .venv/bin/activate
If you do not have source, you can activate the virtualenv with:
bash . .venv/bin/activate
-
Press the Windows button and type PowerShell.
-
Run as Administrator.
-
Set the execution policy to allow scripts to run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
-
Navigate to the root of the nesis project.
-
Create a virtual environment:
python -m venv .venv -
Activate the virtual environment:
.venv\Scripts\activate
pip install -r nesis/rag/requirements.txt -r nesis/rag/requirements-huggingface.txt --default-timeout=1200export NESIS_RAG_EMBEDDING_DIMENSIONS=384
export OPENAI_API_KEY=<your-openai-api-key>
python nesis/rag/core/main.py!!! warning "Huggingface vs OpenAI's Embeddings"
Huggingface embeddings use a dimension of 384 while OpenAI's default embeddings size varies.
The env variable NESIS_RAG_EMBEDDING_DIMENSIONS can be used to alter the dimension of embeddings
to suit your needs.
Make sure you are using Python version 3.8.1 to 3.11:
python --versionIf your Python version is outside this range, consider downgrading it.
Ensure Microsoft Visual C++ 14.0 or greater is installed.
pip install -r nesis/rag/requirements.txt -r nesis/rag/requirements-huggingface.txt --default-timeout=1200Visit PyTorch's official website and get the appropriate installation command based on your OS. For example:
cd nesis/rag
pip3 install torch torchvision torchaudioset NESIS_RAG_EMBEDDING_DIMENSIONS=384
set OPENAI_API_KEY=<your-openai-api-key>$env:NESIS_RAG_EMBEDDING_DIMENSIONS = 384
$env:OPENAI_API_KEY = "<your-openai-api-key>"Set the PYTHONPATH environment variable directly in PowerShell before running your script:
# Place path to the root of the project, e.g., "E:\coding\new wave latest\nesis german\nesis-fork-3"
$env:PYTHONPATH = "<your-project-absolute-path>"Then run:
python nesis/rag/core/main.pySince the terminal of the rag engine will be occupied, you will need to open a new terminal and again set up your Python virtual environment there.
Windows users after setting up your Python virtual environment dont forget to Set the PYTHONPATH environment variable directly in PowerShell before running your script:
# Place path to the root of the project, e.g., "E:\coding\new wave latest\nesis german\nesis-fork-3"
$env:PYTHONPATH = "<your-project-absolute-path>"With the virtual environment activated, install the required dependencies:
pip install -r nesis/api/requirements.txtSet up the necessary environment variables and start the service. Replace <path-to-config.yml> with the path to your actual config.yml file eg --config=nesis/api/config.yml.
export NESIS_ADMIN_EMAIL="some.email@domain.com"
export NESIS_ADMIN_PASSWORD="password"
export NESIS_API_DATABASE_CREATE="true"
python nesis/api/core/main.py --config=<path-to-config.yml>Install dependencies
cd nesis/frontend
npm install --legacy-peer-deps --prefix client
npm install --legacy-peer-depsStart the frontend-backend service with
npm run start:server:localIn a separate terminal, start the frontend with
cd nesis/frontend
npm run start:client-
Point your browser to http://localhost:3000/
-
Login with
- Email:
some.email@domain.com - Password:
password
- Email:
You should now be ready to start developing Nesis