Skip to content

Commit 42ce2f6

Browse files
Fix merge conflict
2 parents 6f28b67 + 0ab248d commit 42ce2f6

File tree

10 files changed

+1109
-515
lines changed

10 files changed

+1109
-515
lines changed

.github/workflows/ci.yml

Lines changed: 184 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -1,187 +1,189 @@
11
name: CI
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- dev
8-
pull_request:
9-
branches:
10-
- main
11-
- dev
12-
- '0.3.0'
13-
14-
# Allows you to run this workflow manually from the Actions tab
15-
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
pull_request:
9+
branches:
10+
- main
11+
- dev
12+
- "0.3.0"
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
1616

1717
jobs:
18-
19-
Linting:
20-
runs-on: ubuntu-latest
21-
strategy:
22-
matrix:
23-
python-version: ['3.8', '3.9', '3.10', '3.11']
24-
steps:
25-
- uses: actions/checkout@v2
26-
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v2
28-
with:
29-
python-version: ${{ matrix.python-version }}
30-
31-
- name: Poetry cache
32-
uses: actions/cache@v3
33-
with:
34-
path: ~/.cache/pypoetry
35-
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
36-
37-
- name: Install Poetry
38-
uses: snok/install-poetry@v1
39-
40-
- name: Install Dependencies
41-
# TODO: fix errors so that we can run `make dev` instead
42-
run: |
43-
make full
44-
45-
- name: Lint with isort, black, docformatter, flake8
46-
run: |
47-
make lint
48-
49-
Typing:
50-
runs-on: ubuntu-latest
51-
strategy:
52-
matrix:
53-
python-version: ['3.8', '3.9', '3.10', '3.11']
54-
pydantic-version: ['1.10.9', '2.4.2']
55-
openai-version: ['0.28.1', '1.2.4']
56-
steps:
57-
- uses: actions/checkout@v2
58-
- name: Set up Python ${{ matrix.python-version }}
59-
uses: actions/setup-python@v2
60-
with:
61-
python-version: ${{ matrix.python-version }}
62-
63-
- name: Poetry cache
64-
uses: actions/cache@v3
65-
with:
66-
path: ~/.cache/pypoetry
67-
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}-${{ matrix.pydantic-version }}
68-
69-
- name: Install Poetry
70-
uses: snok/install-poetry@v1
71-
72-
- name: Install Dependencies
73-
# TODO: fix errors so that we can run `make dev` instead
74-
run: |
75-
make full
76-
poetry run pip install pydantic==${{ matrix.pydantic-version }}
77-
poetry run pip install openai==${{ matrix.openai-version }}
78-
79-
- if: matrix.pydantic-version == '2.4.2' && matrix.openai-version == '0.28.1'
80-
name: Static analysis with pyright (ignoring pydantic v1 and openai v1)
81-
run: |
82-
make type-pydantic-v2-openai-v0
83-
84-
- if: matrix.pydantic-version == '1.10.9' && matrix.openai-version == '0.28.1'
85-
name: Static analysis with mypy (ignoring pydantic v2 and openai v1)
86-
run: |
87-
make type-pydantic-v1-openai-v0
88-
89-
- if: matrix.pydantic-version == '2.4.2' && matrix.openai-version == '1.2.4'
90-
name: Static analysis with pyright (ignoring pydantic v1 and openai v0)
91-
run: |
92-
make type-pydantic-v2-openai-v1
93-
94-
- if: matrix.pydantic-version == '1.10.9' && matrix.openai-version == '1.2.4'
95-
name: Static analysis with mypy (ignoring pydantic v2 and openai v0)
96-
run: |
97-
make type-pydantic-v1-openai-v1
98-
99-
Pytests:
100-
runs-on: ubuntu-latest
101-
strategy:
102-
matrix:
103-
python-version: ['3.8', '3.9', '3.10', '3.11']
104-
# TODO: fix errors so that we can run both `make dev` and `make full`
105-
# dependencies: ['dev', 'full']
106-
dependencies: ['full']
107-
pydantic-version: ['1.10.9', '2.4.2']
108-
openai-version: ['0.28.1', '1.2.4']
109-
steps:
110-
- uses: actions/checkout@v2
111-
- name: Set up Python ${{ matrix.python-version }}
112-
uses: actions/setup-python@v2
113-
with:
114-
python-version: ${{ matrix.python-version }}
115-
116-
- name: Poetry cache
117-
uses: actions/cache@v3
118-
with:
119-
path: ~/.cache/pypoetry
120-
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}-${{ matrix.pydantic-version }}-${{ matrix.openai-version }}
121-
122-
- name: Install Poetry
123-
uses: snok/install-poetry@v1
124-
125-
- name: Install Dependencies
126-
run: |
127-
make ${{ matrix.dependencies }}
128-
poetry run pip install pydantic==${{ matrix.pydantic-version }}
129-
poetry run pip install openai==${{ matrix.openai-version }}
130-
131-
- name: Run Pytests
132-
run: |
133-
make test-cov
134-
135-
- name: Upload to codecov.io
136-
uses: codecov/codecov-action@v3
137-
with:
138-
token: ${{ secrets.CODECOV_TOKEN }}
139-
file: ./coverage.xml
140-
flags: unittests
141-
name: codecov-umbrella
142-
fail_ci_if_error: true
143-
144-
Notebooks:
145-
runs-on: ubuntu-latest
146-
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
147-
needs: [Linting, Typing, Pytests]
148-
149-
env:
150-
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
151-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
152-
153-
154-
steps:
155-
- name: Checkout repository
156-
uses: actions/checkout@v2
157-
158-
- name: Set up Python
159-
uses: actions/setup-python@v2
160-
with:
161-
python-version: 3.11.x
162-
163-
- name: Poetry cache
164-
uses: actions/cache@v3
165-
with:
166-
path: ~/.cache/pypoetry
167-
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
168-
169-
- name: Install Poetry
170-
uses: snok/install-poetry@v1
171-
with:
172-
virtualenvs-create: true
173-
virtualenvs-in-project: true
174-
installer-parallel: true
175-
176-
- name: Install dependencies
177-
run: |
178-
make full;
179-
poetry add openai==0.28.1 jupyter nbconvert cohere;
180-
# pip install openai==0.28.1 jupyter nbconvert;
181-
# pip install .;
182-
183-
- name: Check for pypdfium2
184-
run: poetry run pip show pypdfium2
185-
186-
- name: Execute notebooks and check for errors
187-
run: ./.github/workflows/scripts/run_notebooks.sh
18+
Linting:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
python-version: ["3.8", "3.9", "3.10", "3.11"]
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Poetry cache
31+
uses: actions/cache@v3
32+
with:
33+
path: ~/.cache/pypoetry
34+
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
35+
36+
- name: Install Poetry
37+
uses: snok/install-poetry@v1
38+
39+
- name: Install Dependencies
40+
# TODO: fix errors so that we can run `make dev` instead
41+
run: |
42+
make full
43+
44+
- name: Lint with isort, black, docformatter, flake8
45+
run: |
46+
make lint
47+
48+
Typing:
49+
runs-on: ubuntu-latest
50+
strategy:
51+
matrix:
52+
python-version: ["3.8", "3.9", "3.10", "3.11"]
53+
pydantic-version: ["1.10.9", "2.4.2"]
54+
openai-version: ["0.28.1", "1.2.4"]
55+
steps:
56+
- uses: actions/checkout@v2
57+
- name: Set up Python ${{ matrix.python-version }}
58+
uses: actions/setup-python@v2
59+
with:
60+
python-version: ${{ matrix.python-version }}
61+
62+
- name: Poetry cache
63+
uses: actions/cache@v3
64+
with:
65+
path: ~/.cache/pypoetry
66+
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}-${{ matrix.pydantic-version }}
67+
68+
- name: Install Poetry
69+
uses: snok/install-poetry@v1
70+
71+
- name: Install Dependencies
72+
# TODO: fix errors so that we can run `make dev` instead
73+
run: |
74+
make full
75+
poetry run pip install pydantic==${{ matrix.pydantic-version }}
76+
poetry run pip install openai==${{ matrix.openai-version }}
77+
78+
- if: matrix.pydantic-version == '2.4.2' && matrix.openai-version == '0.28.1'
79+
name: Static analysis with pyright (ignoring pydantic v1 and openai v1)
80+
run: |
81+
make type-pydantic-v2-openai-v0
82+
83+
- if: matrix.pydantic-version == '1.10.9' && matrix.openai-version == '0.28.1'
84+
name: Static analysis with mypy (ignoring pydantic v2 and openai v1)
85+
run: |
86+
make type-pydantic-v1-openai-v0
87+
88+
- if: matrix.pydantic-version == '2.4.2' && matrix.openai-version == '1.2.4'
89+
name: Static analysis with pyright (ignoring pydantic v1 and openai v0)
90+
run: |
91+
make type-pydantic-v2-openai-v1
92+
93+
- if: matrix.pydantic-version == '1.10.9' && matrix.openai-version == '1.2.4'
94+
name: Static analysis with mypy (ignoring pydantic v2 and openai v0)
95+
run: |
96+
make type-pydantic-v1-openai-v1
97+
98+
Pytests:
99+
runs-on: ubuntu-latest
100+
strategy:
101+
matrix:
102+
python-version: ["3.8", "3.9", "3.10", "3.11"]
103+
# TODO: fix errors so that we can run both `make dev` and `make full`
104+
# dependencies: ['dev', 'full']
105+
dependencies: ["full"]
106+
pydantic-version: ["1.10.9", "2.4.2"]
107+
openai-version: ["0.28.1", "1.2.4"]
108+
steps:
109+
- uses: actions/checkout@v2
110+
- name: Set up Python ${{ matrix.python-version }}
111+
uses: actions/setup-python@v2
112+
with:
113+
python-version: ${{ matrix.python-version }}
114+
115+
- name: Poetry cache
116+
uses: actions/cache@v3
117+
with:
118+
path: ~/.cache/pypoetry
119+
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}-${{ matrix.pydantic-version }}-${{ matrix.openai-version }}
120+
121+
- name: Install Poetry
122+
uses: snok/install-poetry@v1
123+
124+
- name: Install Dependencies
125+
run: |
126+
make ${{ matrix.dependencies }}
127+
poetry run pip install pydantic==${{ matrix.pydantic-version }}
128+
poetry run pip install openai==${{ matrix.openai-version }}
129+
130+
- name: Run Pytests
131+
run: |
132+
make test-cov
133+
134+
- name: Upload to codecov.io
135+
uses: codecov/codecov-action@v3
136+
with:
137+
token: ${{ secrets.CODECOV_TOKEN }}
138+
file: ./coverage.xml
139+
flags: unittests
140+
name: codecov-umbrella
141+
fail_ci_if_error: true
142+
143+
Notebooks:
144+
runs-on: ubuntu-latest
145+
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
146+
needs: [Linting, Typing, Pytests]
147+
148+
env:
149+
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
150+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
151+
HUGGINGFACE_API_KEY: ${{ secrets.HUGGINGFACE_API_KEY }}
152+
153+
steps:
154+
- name: Checkout repository
155+
uses: actions/checkout@v2
156+
157+
- name: Set up Python
158+
uses: actions/setup-python@v2
159+
with:
160+
python-version: 3.11.x
161+
162+
- name: Poetry cache
163+
uses: actions/cache@v3
164+
with:
165+
path: ~/.cache/pypoetry
166+
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
167+
168+
- name: Install Poetry
169+
uses: snok/install-poetry@v1
170+
with:
171+
virtualenvs-create: true
172+
virtualenvs-in-project: true
173+
installer-parallel: true
174+
175+
- name: Install dependencies
176+
run: |
177+
make full;
178+
poetry add openai==0.28.1 jupyter nbconvert cohere;
179+
# pip install openai==0.28.1 jupyter nbconvert;
180+
# pip install .;
181+
182+
- name: Check for pypdfium2
183+
run: poetry run pip show pypdfium2
184+
185+
- name: Huggingface Hub Login
186+
run: poetry run huggingface-cli login --token $HUGGINGFACE_API_KEY
187+
188+
- name: Execute notebooks and check for errors
189+
run: ./.github/workflows/scripts/run_notebooks.sh

.github/workflows/examples_check.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
env:
1313
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
1414
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
15+
HUGGINGFACE_API_KEY: ${{ secrets.HUGGINGFACE_API_KEY }}
1516

1617

1718
steps:
@@ -46,6 +47,9 @@ jobs:
4647
- name: Check for pypdfium2
4748
run: poetry run pip show pypdfium2
4849

50+
- name: Huggingface Hub Login
51+
run: huggingface-cli login --token $HUGGINGFACE_API_KEY
52+
4953
- name: Execute notebooks and check for errors
5054
run: ./.github/workflows/scripts/run_notebooks.sh
5155

.github/workflows/scripts/run_notebooks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cd docs/examples
99
# Function to process a notebook
1010
process_notebook() {
1111
notebook="$1"
12-
invalid_notebooks=("valid_chess_moves.ipynb" "translation_with_quality_check.ipynb" "llamaindex-output-parsing.ipynb" "competitors_check.ipynb")
12+
invalid_notebooks=("valid_chess_moves.ipynb" "llamaindex-output-parsing.ipynb" "competitors_check.ipynb")
1313
if [[ ! " ${invalid_notebooks[@]} " =~ " ${notebook} " ]]; then
1414
echo "Processing $notebook..."
1515
poetry run jupyter nbconvert --to notebook --execute "$notebook"

0 commit comments

Comments
 (0)