Skip to content

Commit

Permalink
smaller model
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Cole <adrian.cole@elastic.co>
  • Loading branch information
codefromthecrypt committed Sep 20, 2024
1 parent 058aa19 commit 0ea3af4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ jobs:
ollama:
runs-on: ubuntu-latest

strategy:
matrix:
python-version:
# Only test the lastest python version.
- "3.12"
ollama-model:
# For quicker CI, use a smaller, tool-capable model than the default.
- "qwen2.5:0.5b"

steps:
- uses: actions/checkout@v4

Expand All @@ -49,8 +58,8 @@ jobs:
- name: Source Cargo Environment
run: source $HOME/.cargo/env

- name: Set up Python 3.12
run: uv python install 3.12
- name: Set up Python
run: uv python install ${{ matrix.python-version }}

- name: Install Ollama
run: curl -fsSL https://ollama.com/install.sh | sh
Expand All @@ -66,9 +75,11 @@ jobs:
# Tests use OpenAI which does not have a mechanism to pull models. Run a
# simple prompt to (pull and) test the model first.
- name: Test Ollama model
run: | # get the OLLAMA_MODEL from ./src/exchange/providers/ollama.py
OLLAMA_MODEL=$(uv run python -c "from src.exchange.providers.ollama import OLLAMA_MODEL; print(OLLAMA_MODEL)")
ollama run $OLLAMA_MODEL hello || cat ollama.log
run: ollama run $OLLAMA_MODEL hello || cat ollama.log
env:
OLLAMA_MODEL: ${{ matrix.ollama-model }}

- name: Run Ollama tests
run: uv run pytest tests -m integration -k ollama
env:
OLLAMA_MODEL: ${{ matrix.ollama-model }}
7 changes: 5 additions & 2 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import pytest
from exchange.exchange import Exchange
from exchange.message import Message
Expand All @@ -9,7 +10,7 @@
too_long_chars = "x" * (2**20 + 1)

cases = [
(get_provider("ollama"), OLLAMA_MODEL),
(get_provider("ollama"), os.getenv("OLLAMA_MODEL", OLLAMA_MODEL)),
(get_provider("openai"), "gpt-4o-mini"),
(get_provider("databricks"), "databricks-meta-llama-3-70b-instruct"),
(get_provider("bedrock"), "anthropic.claude-3-5-sonnet-20240620-v1:0"),
Expand Down Expand Up @@ -46,7 +47,9 @@ def read_file(filename: str) -> str:
Read the contents of the file.
Args:
filename (str): The path to the file, which can be relative or absolute.
filename (str): The path to the file, which can be relative or
absolute. If it is a plain filename, it is assumed to be in the
current working directory.
Returns:
str: The contents of the file.
Expand Down

0 comments on commit 0ea3af4

Please sign in to comment.