Skip to content

Add ability for instructlab-knowledge notebook to take multiple source and qna files #51

Add ability for instructlab-knowledge notebook to take multiple source and qna files

Add ability for instructlab-knowledge notebook to take multiple source and qna files #51

# This workflow is designed to test the notebooks in "notebooks/instructlab-knowledge"
# This job can be coppied for end to end tests of notebooks in other working directories
name: Instructlab Knowledge End to End Tests
# trigger on open pull requests only
on:
pull_request:
branches:
- "main"
env:
# dependencies that need to be installed using pip for testing to work
TESTING_PIP_DEPENDENCIES: "papermill nbformat ipykernel"
jobs:
end_to_end:
strategy:
matrix:
# add notebooks within the "notebooks/instructlab-knowledge" repo to end to end test here
notebooks_to_test: ["instructlab-knowledge.ipynb"]
runs-on: ubuntu-latest
env:
# customize the workflow here
API_URL: "http://127.0.0.1:11434/v1"
MODEL_ID: "Mixtral-8x7B" # must be open-AI compatible when using inference mock
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
- name: Install Testing Tools
run: |
pip install ${{ env.TESTING_PIP_DEPENDENCIES }}
ipython kernel install --name "python3" --user
- name: Validate The Notebook
working-directory: ./notebooks/instructlab-knowledge
run: |
git clone https://github.com/instructlab/instructlab.git
python3 instructlab/scripts/validate_notebook.py ${{ matrix.notebooks_to_test }}
- name: Start Inference Mock Server
working-directory: ./tests/inference-mock
run: |
pip install -r requirements.txt
nohup python app.py &
sleep 1
echo "Inference mock server started on port 11434"
- name: Run End To End Tests
working-directory: ./notebooks/instructlab-knowledge
# NOTE: for this to work, cells with parameters need to be tagged as parameters in the target notebooks
run: papermill ${{ matrix.notebooks_to_test }} ${{ matrix.notebooks_to_test }}.tmp -p API_URL $API_URL -p MODEL_ID $MODEL_ID