No description
Find a file
Edward Ly 66b4a9e3ef
Merge pull request #121 from nextcloud/fix/request-exception
fix: catch all HTTP request exceptions
2025-10-20 16:05:30 -07:00
.github chore: add stable32 server version 2025-10-08 14:22:56 +02:00
appinfo chore(info.xml): bump patch version 2025-08-05 07:54:06 -07:00
default_config Revert "feat: Use Gemma 3 12B as default model" 2025-05-06 09:51:16 +02:00
img enh: Add logo (#36) 2024-10-03 16:53:09 +05:30
lib fix: catch all HTTP request exceptions 2025-10-08 13:54:47 +02:00
LICENSES enh: Add logo (#36) 2024-10-03 16:53:09 +05:30
models initial commit 2024-01-15 15:08:01 +01:00
.gitignore chore: Add SPDX header 2024-09-14 11:27:17 +02:00
.nextcloudignore chore: Add SPDX header 2024-09-14 11:27:17 +02:00
.pre-commit-config.yaml chore: Add SPDX header 2024-09-14 11:27:17 +02:00
AUTHORS.md chore: Add SPDX header 2024-09-14 11:27:17 +02:00
CHANGELOG.md docs: update CHANGELOG.md 2025-08-05 07:54:07 -07:00
Dockerfile feat(podman): small corrections to allow build llm2 locally on podman 2025-09-24 13:38:30 +03:00
healthcheck.sh feat: added HaRP support for Nextcloud 32 2025-04-16 10:24:41 +03:00
krankerl.toml chore: Add SPDX header 2024-09-14 11:27:17 +02:00
LICENSE Initial commit 2024-01-11 18:55:39 +03:00
Makefile chore: add stable32 server version 2025-10-08 14:22:56 +02:00
poetry.lock refactor: replace httpx with niquests 2025-09-22 16:15:54 -07:00
pyproject.toml refactor: replace httpx with niquests 2025-09-22 16:15:54 -07:00
README.md docs: update README.md 2025-09-19 08:18:45 -07:00
REUSE.toml enh: Add logo (#36) 2024-10-03 16:53:09 +05:30
start.sh feat: added HaRP support for Nextcloud 32 2025-04-16 10:24:41 +03:00

Nextcloud Local Large Language Model

REUSE status

An on-premises text processing backend for the Nextcloud Assistant or any app that uses the text processing functionality.

This app uses llama.cpp under the hood and is thus compatible with any open-source model in GGUF format.

Installation

See the Nextcloud admin documentation for installation instructions and system requirements.

Development installation

  1. (Optional) Install Nvidia drivers and CUDA on your host system.

  2. Create and activate a Python virtual environment:

    python3 -m venv ./venv && . ./venv/bin/activate
    
  3. Install dependencies:

    poetry install
    
  4. (Optional) Enable hardware acceleration if your system supports it (check the llama.cpp documentation for your accelerator).

  5. (Optional) Download any additional desired models into the models directory:

    Examples:

    wget -nc -P models https://download.nextcloud.com/server/apps/llm/llama-2-7b-chat-ggml/llama-2-7b-chat.Q4_K_M.gguf
    wget -nc -P models https://download.nextcloud.com/server/apps/llm/leo-hessianai-13B-chat-bilingual-GGUF/leo-hessianai-13b-chat-bilingual.Q4_K_M.gguf
    wget -nc -P models https://huggingface.co/Nextcloud-AI/llm_neuralbeagle_14_7b_gguf/resolve/main/neuralbeagle14-7b.Q4_K_M.gguf
    
  6. Run the app:

    PYTHONUNBUFFERED=1 APP_HOST=0.0.0.0 APP_ID=llm2 APP_PORT=9081 APP_SECRET=12345 APP_VERSION=<APP_VERSION> NEXTCLOUD_URL=http://nextcloud.local python3 lib/main.py
    
  7. Register the app with the manual_install AppAPI deploy daemon (see AppAPI admin settings in Nextcloud).

    With the Nextcloud Docker dev environment, you can just run:

    make register
    

    Example if Nextcloud is installed on bare metal instead:

    sudo -u www-data php /var/www/nextcloud/occ app_api:app:unregister llm2 --force
    sudo -u www-data php /var/www/nextcloud/occ app_api:app:register llm2 manual_install --json-info "{\"id\":\"llm2\",\"name\":\"Local large language model\",\"daemon_config_name\":\"manual_install\",\"version\":\"<APP_VERSION>\",\"secret\":\"12345\",\"port\":9081}" --wait-finish
    

Development installation using Docker

Note

Currently, running the Docker image requires that your host system have CUDA/NVIDIA drivers installed and is equipped with a GPU capable of performing the required tasks.

  1. Install Nvidia drivers and CUDA on your host system and install NVIDIA Docker toolkit.

  2. Build the Docker image:

    docker build --no-cache -f Dockerfile -t llm2:latest .
    
  3. Run the Docker image:

    sudo docker run -ti -v /var/run/docker.sock:/var/run/docker.sock -e APP_ID=llm2 -e APP_HOST=0.0.0.0 -e APP_PORT=9081 -e APP_SECRET=12345 -e APP_VERSION=<APP_VERSION> -e NEXTCLOUD_URL='<YOUR_NEXTCLOUD_URL_REACHABLE_FROM_INSIDE_DOCKER>' -e CUDA_VISIBLE_DEVICES=0 -p 9081:9081 --gpus all llm2:latest
    
  4. Register the app.

    With the Nextcloud Docker dev environment, you can just run:

    make register
    

    Example if Nextcloud is installed on bare metal instead:

    sudo -u www-data php /var/www/nextcloud/occ app_api:app:unregister llm2 --force
    sudo -u www-data php /var/www/nextcloud/occ app_api:app:register llm2 manual_install --json-info "{\"id\":\"llm2\",\"name\":\"Local large language model\",\"daemon_config_name\":\"manual_install\",\"version\":\"<APP_VERSION>\",\"secret\":\"12345\",\"port\":9081}" --wait-finish