From 5d2321aef0ba02571dd65b508a93d52549b1e9af Mon Sep 17 00:00:00 2001 From: zsimjee Date: Fri, 3 Nov 2023 10:13:52 -0700 Subject: [PATCH] Cron nb (#425) * install deps + pkg for nb runs * lock nb runner to 3.11.x * use cohere api key from environ * ref env vars for cohere + openai --- .github/workflows/examples_check.yml | 9 +++++++-- docs/examples/provenance.ipynb | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/examples_check.yml b/.github/workflows/examples_check.yml index f01651382..de4c9a31c 100644 --- a/.github/workflows/examples_check.yml +++ b/.github/workflows/examples_check.yml @@ -9,6 +9,11 @@ jobs: execute_notebooks: runs-on: ubuntu-latest + env: + COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + + steps: - name: Checkout repository uses: actions/checkout@v2 @@ -16,11 +21,11 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.x + python-version: 3.11.x - name: Install dependencies run: | - pip install jupyter nbconvert + make full; pip install jupyter nbconvert; pip install . - name: Execute notebooks and check for errors run: | diff --git a/docs/examples/provenance.ipynb b/docs/examples/provenance.ipynb index 92256efc6..460bf1a32 100644 --- a/docs/examples/provenance.ipynb +++ b/docs/examples/provenance.ipynb @@ -298,9 +298,12 @@ "from guardrails import Guard\n", "from guardrails.validators import ProvenanceV0\n", "from typing import List, Union\n", + "import os\n", + "\n", + "api_key = os.environ[\"COHERE_API_KEY\"]\n", "\n", "# Create a cohere client\n", - "cohere_client = cohere.Client(api_key=\"\")\n", + "cohere_client = cohere.Client(api_key=api_key)\n", "\n", "\n", "def embed_function(text: Union[str, List[str]]) -> np.ndarray:\n",