Candil.Installer (Candil v1.0.0)

Copy Markdown View Source

Download and installation utilities for llama.cpp binaries and GGUF models.

Handles:

  • Detecting the right precompiled llama.cpp asset for the current machine.
  • Downloading and extracting it to the engine's binary_dir.
  • Downloading GGUF model files from any HTTP/HTTPS URL.
  • Resuming interrupted downloads via HTTP Range requests where supported.

All downloads stream to disk — files are never loaded fully into memory.

Summary

Functions

Downloads and installs the appropriate llama.cpp precompiled binary for the given engine.

Downloads a GGUF model file from model.download_url to model.model_dir/model.filename.

Functions

download_engine(engine)

@spec download_engine(Candil.Engine.t()) :: :ok | {:error, binary()}

Downloads and installs the appropriate llama.cpp precompiled binary for the given engine.

The binary is extracted to engine.binary_dir (or ~/.apero/llm/bin by default). Existing binaries are overwritten only if the version differs.

Steps

  1. Resolve the release tag (:latest → real tag via GitHub API).
  2. Detect OS/arch/GPU and select the matching asset URL.
  3. Download the .zip archive to a temp file.
  4. Extract llama-server (and llama-cli) from the archive.
  5. Make the binary executable.

download_model(model)

@spec download_model(Candil.Model.t()) :: {:ok, binary()} | {:error, binary()}

Downloads a GGUF model file from model.download_url to model.model_dir/model.filename.

Returns {:ok, dest_path} on success. Returns immediately without downloading if the file already exists.