diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml index 183f9ec..3a7b84a 100644 --- a/.github/workflows/python.yaml +++ b/.github/workflows/python.yaml @@ -1,4 +1,4 @@ -name: Python checks +name: Check example files are linted and formatted on: push: @@ -15,11 +15,15 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" - - name: Install dependencies + - name: Install uv + uses: astral-sh/setup-uv@v6 + - name: Set up virtual environment and install dependencies run: | - python -m pip install --upgrade pip - pip install -r requirements-dev.txt + uv venv .venv + uv pip install -r requirements-dev.txt - name: Lint with ruff - run: ruff check . + run: | + uv run ruff check . - name: Check formatting with black - run: black . --check --verbose + run: | + uv run black . --check --verbose diff --git a/.github/workflows/test-github-models.yaml b/.github/workflows/test-github-models.yaml new file mode 100644 index 0000000..d8a5741 --- /dev/null +++ b/.github/workflows/test-github-models.yaml @@ -0,0 +1,48 @@ +name: Run example files with GitHub models + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + paths: + - 'requirements.txt' + - '.github/workflows/test-github-models.yaml' + - 'chat.py' + - 'spanish/chat.py' + +jobs: + test-github-models: + runs-on: ubuntu-latest + permissions: + contents: read + models: read + + steps: + - uses: actions/checkout@v5 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version-file: "pyproject.toml" + + - name: Install uv + uses: astral-sh/setup-uv@v6 + + - name: Install dependencies + run: | + uv venv .venv + uv pip install -r requirements.txt + + - name: Test chat files with GitHub Models + env: + API_HOST: github + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_MODEL: openai/gpt-4o-mini + run: | + source .venv/bin/activate + files=("chat.py" "spanish/chat.py") + for file in "${files[@]}"; do + echo "Testing $file..." + python "$file" || exit 1 + done diff --git a/reasoning.py b/reasoning.py index 5bb30ea..8a0e2bd 100644 --- a/reasoning.py +++ b/reasoning.py @@ -37,11 +37,19 @@ messages=[ { "role": "user", - "content": "Multiply together 1897234 and 12903812039.", + "content": "How many r's are in strawberry? Answer in a complete sentence with explanation.", }, ], - reasoning_effort="minimal", - verbosity="low", + reasoning_effort="low", ) + +# Reasoning contnet is only available for gpt-oss models running on Ollama +# To see reasoning traces with gpt-5 family, use the Responses API +if hasattr(response.choices[0].message, "reasoning"): + print("🤔 Thinking...") + print(response.choices[0].message.reasoning) + print("🛑 Done thinking.") +print("Response:") print(response.choices[0].message.content) +print("Usage:") print(response.usage)