This installation tutorial covers installations with Docker as well as locally, and is divided into 3 parts:
Albert models are deployable with VLLM. We provide an "LLM API" (located in llm/
) to embed an Albert LLM as well as an embeddings model for the Retrieval Augmented Generation, RAG. For more information on the models, refer to the documentation about supported models.
- With VLLM:
docker build --tag albert/llm:latest --build-context pyalbert=./pyalbert --file ./llm/Dockerfile ./llm
- With GPT4All, in the case without GPU:
If you don't have GPU, you will find in a Dockerfile to build the API image with GPT4All (instead of VLLM). This API is in the format of the previously described VLLM API but does not require the use of a GPU. However, this is maintained on a best efforts basis by the teams.
docker build --tag albert/llm:latest --build-context pyalbert=./pyalbert --file ./contrib/gpt4all/Dockerfile ./contrib/gpt4all
The models currently available without GPU are listed in the models documentation.
docker compose --env-file ./llm/.env.example --file ./llm/docker-compose.yml up --detach
⚠️ If you do not specify an embeddings model, the/embeddings
endpoint of the API will return a 404 response and will be hidden in its automatic documentation (Swagger).
You can access the automatic documentation (Swagger) of the model API at http://localhost:8000/docs.
-
Install
pip install llm/. ln -s $(pwd)/pyalbert llm/pyalbert
-
Run (example to deploy an Albert model with given settings)
python3 llm/app.py --llm-hf-repo-id AgentPublic/albertlight-8b --tensor-parallel-size 1 --gpu-memory-utilization 0.4 --models-dir ~/_models --host 0.0.0.0 --port 8088
Alert API uses three databases: a PostgreSQL database, an Elasticsearch database, and a Qdrant database. For more information on their usefulness, refer to the documentation databases.md.
The Docker images for these databases are available on the official Docker registry, so no image build is necessary.
We recommend setting the POSTGRES_STORAGE_DIR environment variable to a local directory to ensure better data persistence.
-
Run
export PROJECT_NAME=postgres export POSTGRES_STORAGE_DIR=./data/postgres # configurer un dossier local docker compose --file ./databases/postgres/docker-compose.yml up --detach
We recommend setting the QDRANT_STORAGE_DIR and ELASTIC_STORAGE_DIR environment variables to a local directory to ensure better data persistence.
⚠️ Warning the folder mentioned in the ELASTIC_STORAGE_DIR variable must have rights 1000:1000.
- Run
export PROJECT_NAME=vector-store export QDRANT_STORAGE_DIR=./data/qdrant export ELASTIC_STORAGE_DIR=./data/elastic docker compose --file ./databases/vector_store/docker-compose.yml up --detach
Make sure your ENV
environment variable in pyalbert/.env is set to dev
such as ENV="dev"
, and run:
docker compose --env-file ./pyalbert/.env.example --file ./api/docker-compose.yml up --detach
- Install the dependencies:
cd api/
ln -s $(pwd)/../pyalbert pyalbert
pip install . pyalbert
-
Ensure you are using dev environement: you should have
ENV=dev
in the file pyalbert/.env -
Create the database schema (sqlite in dev mode) using Alembic:
PYTHONPATH=. alembic upgrade head
- Start the API locally:
uvicorn app.main:app --reload
-
To test, you can access the automatic documentation (Swagger) of the model API at http://localhost:8000/docs
-
Run unit tests:
pytest app/tests
Or, for report options:
pytest --cov=app --cov-report=html --cov-report=term-missing app/tests