Skip to content

Commit 4e414c4

Browse files
authored
Merge pull request #229 from codelion/fix-tests-add-batching
Fix tests add batching
2 parents 68ccd33 + 3473a3a commit 4e414c4

File tree

70 files changed

+1835
-528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1835
-528
lines changed

.github/workflows/test.yml

Lines changed: 70 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
test:
10+
unit-tests:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
@@ -34,53 +34,95 @@ jobs:
3434
python -m pip install --upgrade pip
3535
pip install -r requirements.txt
3636
pip install -r tests/requirements.txt
37+
pip install -e .
3738
38-
- name: Run unit tests
39+
- name: Run unit tests (no server required)
3940
run: |
40-
# Run quick CI tests
41-
python tests/test_ci_quick.py
41+
# Set up local inference environment
42+
export OPTILLM_API_KEY=optillm
4243
43-
# Run plugin tests with pytest if available
44+
# Run tests that don't need server - fast feedback!
45+
python tests/test_ci_quick.py
4446
python -m pytest tests/test_plugins.py -v --tb=short || python tests/test_plugins.py
45-
46-
# Run approach tests
4747
python tests/test_approaches.py
48+
python tests/test_reasoning_simple.py
49+
python tests/test_batching.py
50+
env:
51+
OPTILLM_API_KEY: optillm
52+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
4853

49-
integration-test:
54+
integration-tests:
5055
runs-on: ubuntu-latest
51-
needs: test
52-
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
53-
# Only run integration tests on PRs from the same repository (not forks)
54-
# This ensures secrets are available
56+
needs: unit-tests # Only run if unit tests pass
57+
strategy:
58+
matrix:
59+
python-version: ['3.12']
5560

5661
steps:
5762
- uses: actions/checkout@v4
5863

59-
- name: Set up Python
64+
- name: Set up Python ${{ matrix.python-version }}
6065
uses: actions/setup-python@v4
6166
with:
62-
python-version: '3.12'
67+
python-version: ${{ matrix.python-version }}
68+
69+
- name: Cache pip packages
70+
uses: actions/cache@v3
71+
with:
72+
path: ~/.cache/pip
73+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
74+
restore-keys: |
75+
${{ runner.os }}-pip-
6376
6477
- name: Install dependencies
6578
run: |
6679
python -m pip install --upgrade pip
6780
pip install -r requirements.txt
81+
pip install -r tests/requirements.txt
82+
pip install -e .
6883
69-
- name: Run integration test with OpenAI
70-
if: env.OPENAI_API_KEY != ''
84+
- name: Start optillm server
7185
run: |
72-
# Start OptILLM server
73-
python optillm.py &
74-
SERVER_PID=$!
86+
echo "Starting optillm server for integration tests..."
87+
OPTILLM_API_KEY=optillm python optillm.py --model google/gemma-3-270m-it --port 8000 &
88+
echo $! > server.pid
7589
76-
# Wait for server
77-
sleep 5
90+
# Wait for server to be ready
91+
echo "Waiting for server to start..."
92+
sleep 15
7893
79-
# Run simple integration test
80-
python tests/test.py --approaches none --single-test "Simple Math Problem" --base-url http://localhost:8000/v1 --model gpt-4o-mini || true
81-
82-
# Stop server
83-
kill $SERVER_PID || true
94+
# Test server health
95+
curl -s http://localhost:8000/health || echo "Server health check failed"
96+
env:
97+
OPTILLM_API_KEY: optillm
98+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
99+
100+
- name: Run integration tests (server required)
101+
run: |
102+
# Run tests that need the server
103+
echo "Running tests that require optillm server..."
104+
OPTILLM_API_KEY=optillm python tests/test_reasoning_tokens.py
105+
OPTILLM_API_KEY=optillm python tests/test_reasoning_integration.py
106+
OPTILLM_API_KEY=optillm python tests/test_json_plugin.py
107+
OPTILLM_API_KEY=optillm python tests/test_n_parameter.py
108+
OPTILLM_API_KEY=optillm python -m pytest tests/test_api_compatibility.py -v --tb=short || echo "API compatibility tests require pytest"
109+
OPTILLM_API_KEY=optillm python tests/test.py --approaches none --single-test "Simple Math Problem" || echo "Main test completed"
110+
echo "All integration tests completed successfully!"
111+
exit 0
84112
env:
85-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
86-
continue-on-error: true
113+
OPTILLM_API_KEY: optillm
114+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
115+
116+
- name: Stop optillm server
117+
if: always()
118+
run: |
119+
echo "Stopping optillm server..."
120+
if [ -f server.pid ]; then
121+
kill $(cat server.pid) 2>/dev/null || true
122+
rm -f server.pid
123+
fi
124+
# Kill any remaining python processes running optillm
125+
pkill -f "python.*optillm" 2>/dev/null || true
126+
sleep 2
127+
echo "Server shutdown completed"
128+
exit 0

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
OptILLM is an OpenAI API compatible optimizing inference proxy that implements state-of-the-art techniques to improve accuracy and performance of LLMs. It focuses on reasoning improvements for coding, logical, and mathematical queries through inference-time compute optimization.
7+
OptiLLM is an OpenAI API compatible optimizing inference proxy that implements state-of-the-art techniques to improve accuracy and performance of LLMs. It focuses on reasoning improvements for coding, logical, and mathematical queries through inference-time compute optimization.
88

99
## Core Architecture
1010

@@ -95,7 +95,7 @@ python scripts/eval_arena_hard_auto_rtc.py
9595
# FRAMES benchmark
9696
python scripts/eval_frames_benchmark.py
9797

98-
# OptILLM benchmark generation/evaluation
98+
# OptiLLM benchmark generation/evaluation
9999
python scripts/gen_optillmbench.py
100100
python scripts/eval_optillmbench.py
101101
```
@@ -120,6 +120,7 @@ python scripts/eval_optillmbench.py
120120
- MCP: `~/.optillm/mcp_config.json` for Model Context Protocol servers
121121
- SPL: Built-in system prompt learning for solving strategies
122122
- Memory: Automatic unbounded context via chunking and retrieval
123+
- GenSelect: Quality-based selection from multiple generated candidates
123124

124125
## Key Concepts
125126

0 commit comments

Comments
 (0)