π¦ Set up GitHub Actions workflow with Ollama.
# .github/workflows/ollama.yml
name: ollama
on: push
jobs:
ollama:
runs-on: ubuntu-latest
steps:
- name: Setup Ollama
uses: ai-action/setup-ollama@v2
- name: Run LLM
run: ollama run llama3.2 'Explain the basics of machine learning.'Install Ollama:
- uses: ai-action/setup-ollama@v2Run a prompt against a model:
- run: ollama run tinyllama "What's a large language model?"Cache the model to speed up CI:
- uses: actions/cache@v5
with:
path: ~/.ollama
key: ${{ runner.os }}-ollama
- run: ollama run tinyllama 'Define cache'See action.yml.
Optional: The CLI version. Defaults to 0.17.0:
- uses: ai-action/setup-ollama@v2
with:
version: 0.17.0Optional: The CLI name. Defaults to ollama:
- uses: ai-action/setup-ollama@v2
with:
name: ollamaIf you get the error on a Linux self-hosted runner:
tar (child): zstd: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
It means that zstd is not installed.
To fix this error, you can install zstd:
- name: Install zstd
run: apt-get update && apt-get install zstdOr use Ollama version <0.14.0:
- uses: ai-action/setup-ollama@v2
with:
version: 0.13.5See #423.