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

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ollama-action

version test License: MIT

🦙 Run Ollama large language models in GitHub Actions.

Quick Start

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

      - name: Get response
        env:
          response: ${{ steps.llm.outputs.response }}
        run: echo "$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?"

- name: Get response
  env:
    response: ${{ steps.explanation.outputs.response }}
  run: echo "$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 to use. See available versions.

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

Outputs

response

The generated response message.

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

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

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

License

MIT