Local AI chatbot

The llm example allows you to run advanced AI chatbots and services on your own computer with just one command. Once you’ve downloaded the model, you can use it without needing a constant internet connection.

/nix/store/ib546lg6wrn501ma4hqkc35yq785zvn4-source/doc/llm.png
On dev vs app mode

services-flake provides two main uses:

  • Running services in development projects with source code access.
  • Creating end-user apps that run multiple services.

Our example is based on the second use. These apps can be launched with nix run or installed using nix profile install.

Running the app

To run the local AI chatbot and launch the Web UI,

# You can also use `nix profile install` on this URL, and run `services-flake-llm`
nix run "github:juspay/services-flake?dir=example/llm"

Before launching the Web UI, this will download the phi3 model, which is about 2.4GB. To reduce or avoid this delay, you can:

  • Choose a different model, or
  • Use no model at all

See further below for more options.

Demo

Default configuration & models

The example runs two processes Ollama and Open WebUI

Key points:

  • Data storage:
    • Ollama data is stored in $HOME/.services-flake/llm/ollama
    • To change this location, edit the dataDir option in flake.nix
  • Model management:
    • By default, the phi3 model is automatically downloaded
    • To change or add more models: a. Edit the models option in flake.nix, or b. Use the open-webui interface to download additional models.
Links to this page