-
Notifications
You must be signed in to change notification settings - Fork 966
feat: Draft ollama test #566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
c572e27
2de364b
8ebd9a7
9d0d96e
b4088be
b670697
bfe039d
6bc4f6a
96adcfb
c06c28d
edd681f
02b0109
a91e83e
326c418
92602aa
f2d0909
97465f1
73662b8
90d96aa
3a88b94
11442df
1dfb0dd
4c4723b
846c45e
2c0bfc8
91512cd
5c7b4a5
7a85e71
0bba1f8
061fbbd
0ed6aa6
3090333
80ccf55
ce8c2da
65927b3
6463c2e
70f9b5f
468268c
c72b12d
c224556
ec9bbca
cabbfd6
c329cef
44f02df
6b49078
fe7da60
a77655a
cfc93e3
647d872
01bb8cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| name: test | ollama | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| types: [ labeled, synchronize ] | ||
|
|
||
| jobs: | ||
| setup-ollama: | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| ollama: | ||
| image: ollama/ollama | ||
| ports: | ||
| - 11434:11434 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.x" | ||
|
|
||
| - name: Cache pip packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cache/pip | ||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pip- | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install ollama-python requests | ||
|
|
||
| - name: Wait for Ollama to be ready | ||
| run: | | ||
| for i in {1..30}; do | ||
| if curl -s http://localhost:11434/api/tags > /dev/null; then | ||
| echo "Ollama is ready" | ||
| exit 0 | ||
| fi | ||
| echo "Waiting for Ollama... attempt $i" | ||
| sleep 2 | ||
| done | ||
| echo "Ollama failed to start" | ||
| exit 1 | ||
|
|
||
| - name: Pull Models | ||
| run: | | ||
| curl -X POST http://localhost:11434/api/pull -d '{"name": "ollama/llama3.2"}' | ||
| curl -X POST http://localhost:11434/api/pull -d '{"name": "avr/sfr-embedding-mistral:latest"}' | ||
|
|
||
| run_simple_example_test: | ||
| needs: setup-ollama | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| ollama: | ||
| image: ollama/ollama | ||
| ports: | ||
| - 11434:11434 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12.x' | ||
|
|
||
| - name: Install Poetry | ||
| uses: snok/[email protected] | ||
| with: | ||
| virtualenvs-create: true | ||
| virtualenvs-in-project: true | ||
| installer-parallel: true | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| poetry install --no-interaction --all-extras | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install ollama-python requests | ||
|
|
||
| - name: Wait for Ollama to be ready | ||
| run: | | ||
| for i in {1..30}; do | ||
| if curl -s http://localhost:11434/api/tags > /dev/null; then | ||
| echo "Ollama is ready" | ||
| exit 0 | ||
| fi | ||
| echo "Waiting for Ollama... attempt $i" | ||
| sleep 2 | ||
| done | ||
| echo "Ollama failed to start" | ||
| exit 1 | ||
|
|
||
| - name: Dump Docker logs | ||
| run: | | ||
| docker ps | ||
| docker logs $(docker ps --filter "ancestor=ollama/ollama" --format "{{.ID}}") | ||
|
|
||
|
|
||
| - name: Run example test | ||
| env: | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| GRAPHISTRY_USERNAME: ${{ secrets.GRAPHISTRY_USERNAME }} | ||
| GRAPHISTRY_PASSWORD: ${{ secrets.GRAPHISTRY_PASSWORD }} | ||
| LLM_API_KEY: "ollama" | ||
| LLM_PROVIDER: "ollama" | ||
| LLM_ENDPOINT: "http://localhost:11434" | ||
| LLM_MODEL: "ollama/llama3.2" | ||
| EMBEDDING_PROVIDER: "ollama" | ||
| EMBEDDING_MODEL: "avr/sfr-embedding-mistral:latest" | ||
| EMBEDDING_ENDPOINT: "http://localhost:11434/api/embeddings" | ||
| EMBEDDING_DIMENSIONS: "4096" | ||
| HUGGINGFACE_TOKENIZER: "Salesforce/SFR-Embedding-Mistral" | ||
| run: poetry run python ./examples/python/simple_example.py | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Update the Python setup action version.
The
actions/setup-python@v4action used in thesetup-ollamajob is outdated. It is advisable to update this to a newer version (for example,actions/setup-python@v5) to ensure better compatibility and take advantage of recent improvements.📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.4)
22-22: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)