Replace llama-cpp-python with OpenAI SDK client for llama.cpp server … #289
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| paths: | |
| - "chatbot/**" | |
| - "backend/**" | |
| - "tests/**" | |
| - ".github/workflows/**" | |
| - "pyproject.toml" | |
| - "poetry.lock" | |
| - "!.gitignore" | |
| - "!notes/**" | |
| - "!README.md" | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| paths: | |
| - "chatbot/**" | |
| - "backend/**" | |
| - "tests/**" | |
| - ".github/workflows/**" | |
| - "pyproject.toml" | |
| - "poetry.lock" | |
| - "!.gitignore" | |
| - "!notes/**" | |
| - "!README.md" | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| - name: Set up Docker Compose | |
| uses: docker/setup-compose-action@v2 | |
| with: | |
| version: v5.0.2 | |
| - name: Run llama.cpp server with CPU-only configuration | |
| run: | | |
| docker compose -f docker-compose.ci.yml up -d | |
| - name: Wait for llama.cpp server to be ready | |
| run: | | |
| echo "Waiting for llama.cpp server to be healthy..." | |
| timeout 120 bash -c 'until docker inspect --format="{{.State.Health.Status}}" rag-chatbot-llama-server | grep -q "healthy"; do sleep 2; done' | |
| echo "Server is healthy!" | |
| # Verify server is accessible from host | |
| echo "Verifying server is accessible from host..." | |
| timeout 60 bash -c 'until curl -f http://localhost:8080/health; do echo "Waiting for server to be accessible from host..."; sleep 2; done' | |
| echo "Server is accessible!" | |
| # Verify model endpoint | |
| echo "Checking if model is loaded..." | |
| curl -s http://localhost:8080/v1/models | jq . | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12.10' | |
| - name: Get poetry version | |
| id: poetry-version | |
| run: echo "poetry-version=$(cat version/poetry)" >> "$GITHUB_OUTPUT" | |
| - name: Install poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: ${{ steps.poetry-version.outputs.poetry-version }} | |
| virtualenvs-in-project: true | |
| - name: Setup environment | |
| run: | | |
| poetry check --lock | |
| poetry install --no-root --no-ansi | |
| - name: Run tests | |
| run: | | |
| poetry run python -m pytest --durations=5 --log-cli-level=DEBUG --capture=tee-sys -v --cov=chatbot --cov-report=term-missing --cov-fail-under=60 |