Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Conflicts:
#	instructor/patch.py
#	tests/test_patch.py
  • Loading branch information
joschkabraun committed May 16, 2024
2 parents 55d491a + cd5169e commit 901c58c
Show file tree
Hide file tree
Showing 263 changed files with 10,644 additions and 3,366 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bug report
about: Create a report to help us improve
---

- [ ] This is an actually a bug report.
- [ ] This is actually a bug report.
- [ ] I am not getting good LLM Results
- [ ] I have tried asking for help in the community on discord or discussions and have not received a response.
- [ ] I have tried searching the documentation and have not found an answer.
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/evals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Weekly Tests
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # Runs at 00:00 UTC every Sunday
- cron: "0 0 * * 0" # Runs at 00:00 UTC every Sunday
push:
branches: [ main ]
branches: [main]
paths-ignore:
- '**' # Ignore all paths to ensure it only triggers on schedule
- "**" # Ignore all paths to ensure it only triggers on schedule

jobs:
weekly-tests:
Expand All @@ -20,15 +20,15 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: 'poetry'
cache: "poetry"

- name: Install Poetry
uses: snok/[email protected]

- name: Install dependencies
run: poetry install --with dev
run: poetry install --with dev,anthropic

- name: Run all tests
run: poetry run pytest tests/
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
40 changes: 0 additions & 40 deletions .github/workflows/mkdocs.yml

This file was deleted.

62 changes: 0 additions & 62 deletions .github/workflows/mypy.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Pyright

on:
push:
pull_request:
branches: [ main ]

env:
WORKING_DIRECTORY: "."
PYRIGHT_OUTPUT_FILENAME: "pyright.log"

jobs:
Pyright:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache Poetry virtualenv
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install Poetry
uses: snok/[email protected]

- name: Install dependencies
run: poetry install --with dev,anthropic

- name: Run Static Type Checking with Pyright
run: |
set -e -o pipefail
poetry run pyright > ${{ env.WORKING_DIRECTORY }}/${{ env.PYRIGHT_OUTPUT_FILENAME }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: pyright-log
path: ${{ env.WORKING_DIRECTORY }}/${{ env.PYRIGHT_OUTPUT_FILENAME }}
4 changes: 2 additions & 2 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Ruff
on:
push:
pull_request:
branches: [ main ]
branches: [main]

env:
WORKING_DIRECTORY: "."
Expand Down Expand Up @@ -42,4 +42,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: ruff-log
path: ${{ env.WORKING_DIRECTORY }}/${{ env.RUFF_OUTPUT_FILENAME }}
path: ${{ env.WORKING_DIRECTORY }}/${{ env.RUFF_OUTPUT_FILENAME }}
21 changes: 9 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ on:
pull_request:
push:
branches:
- main
- main

jobs:
release:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ['3.10', '3.11']
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -33,24 +33,21 @@ jobs:
uses: snok/[email protected]

- name: Install dependencies
run: poetry install --with dev
run: poetry install --with dev,anthropic

- name: Run tests
run: poetry run pytest tests/ -k "not openai"
if: matrix.python-version != '3.11'
run: poetry run pytest tests/ -k "not openai and not anthropic and not evals and not docs"
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

- name: Generate coverage report
if: matrix.python-version == '3.11'
run: |
poetry run coverage run -m pytest tests/ -k "not openai"
poetry run coverage run -m pytest tests/ -k "not docs"
poetry run coverage report
poetry run coverage html
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

- name: Coveralls GitHub Action
if: matrix.python-version == '3.11'
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
12 changes: 6 additions & 6 deletions .github/workflows/test_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
python-version: ['3.11']
python-version: ["3.11"]

steps:
- uses: actions/checkout@v2
Expand All @@ -22,8 +22,8 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
cache: "poetry"

- name: Cache Poetry virtualenv
uses: actions/cache@v2
with:
Expand All @@ -33,9 +33,9 @@ jobs:
${{ runner.os }}-poetry-
- name: Install dependencies
run: poetry install --with dev,docs,test-docs
run: poetry install --with dev,docs,test-docs,anthropic

- name: Run tests
run: poetry run pytest tests/openai/docs
run: poetry run pytest tests/llm/test_openai/docs
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

.vscode/

examples/citation_with_extraction/fly.toml
my_cache_directory/
tutorials/wandb/*
Expand Down
29 changes: 0 additions & 29 deletions .mypy.ini

This file was deleted.

15 changes: 3 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,7 @@ repos:
files: ^(instructor|tests|examples)/
- id: ruff-format # Run the formatter.
name: Run Formatter (Ruff)
- repo: local
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.360
hooks:
- id: ci_type_mypy
name: Run Type Check (Mypy)
entry: >
bash -c 'set -o pipefail;
export CUSTOM_PACKAGES="instructor/_types/_alias.py instructor/cli/cli.py instructor/cli/files.py instructor/cli/usage.py instructor/exceptions.py" &&
export CUSTOM_FLAGS="--python-version=3.9 --color-output --no-pretty --follow-imports=skip" &&
curl -sSL https://raw.githubusercontent.com/gao-hongnan/omniverse/2fd5de1b8103e955cd5f022ab016b72fa901fa8f/scripts/devops/continuous-integration/type_mypy.sh |
bash'
language: system
types: [python]
pass_filenames: false
- id: pyright
5 changes: 3 additions & 2 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ select = [
"E722",
# unused arguments
"ARG",
# pyupgrade
"UP",
]
ignore = [
# mutable defaults
Expand All @@ -53,10 +55,9 @@ unfixable = [
]
ignore-init-module-imports = true

[extend-per-file-ignores]
[lint.extend-per-file-ignores]
"instructor/distil.py" = ["ARG002"]
"tests/test_distil.py" = ["ARG001"]
"tests/test_patch.py" = ["ARG001"]
"examples/task_planner/task_planner_topological_sort.py" = ["ARG002"]
"examples/citation_with_extraction/main.py" = ["ARG001"]

Loading

0 comments on commit 901c58c

Please sign in to comment.