Skip to content

ai-action/ollama-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ollama

ollama-action

version test License: MIT

πŸ¦™ Run Ollama large language models (LLMs) with GitHub Actions.

Quick Start

# .github/workflows/ollama.yml
on: push
jobs:
  ollama:
    runs-on: ubuntu-latest
    steps:
      - name: Run model
        uses: ai-action/ollama-action@v1
        id: model
        with:
          model: llama3.2
          prompt: Explain the basics of machine learning.

      - name: Print response
        run: echo "$response"
        env:
          response: ${{ steps.model.outputs.response }}

Usage

Run a prompt against a model:

- uses: ai-action/ollama-action@v1
  id: explanation
  with:
    model: tinyllama
    prompt: "What's a large language model?"

- run: echo "$response"
  env:
    response: ${{ steps.explanation.outputs.response }}

See action.yml

Inputs

model

Required: The language model to use.

- uses: ai-action/ollama-action@v1
  with:
    model: llama3.2

prompt

Required: The input prompt to generate the text from.

- uses: ai-action/ollama-action@v1
  with:
    prompt: Tell me a joke.

To set a multiline prompt:

- uses: ai-action/ollama-action@v1
  with:
    prompt: |
      Tell me
      a joke.

version

Optional: The Ollama version. See all available versions.

- uses: ai-action/ollama-action@v1
  with:
    version: 0.9.5

cache

Optional: Whether to cache the model. Defaults to true.

- uses: ai-action/ollama-action@v1
  with:
    cache: true

Outputs

response

The generated response message.

- uses: ai-action/ollama-action@v1
  id: answer
  with:
    model: llama3.2
    prompt: What's 1+1?

- run: echo "$response"
  env:
    response: ${{ steps.answer.outputs.response }}

Note

The environment variable is wrapped in double quotes to preserve newlines.

Articles

License

MIT