From adee73b88fd81f0ff4da8c3ba275357c272a0c9a Mon Sep 17 00:00:00 2001 From: Nigel Jones Date: Thu, 11 Jun 2026 14:50:20 +0100 Subject: [PATCH 1/5] Fix ipython pin in tutorials extra breaking Google Colab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ipython>=8.10.0 upgraded Colab's tightly-pinned ipython==7.34.0 to 9.x, breaking the google-colab package and destabilising the runtime. Changed to ipython>=7.0 — Colab's 7.34.0 satisfies the floor so pip leaves it untouched, while a fresh local environment still gets ipython installed. Affects notebooks using [tutorials]: hello_mellea, rag_101, rag_flow. Signed-off-by: Nigel Jones --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ed55282..a826b2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ tutorials = [ "requests>=2.31.0", "rich>=13.0.0", "mellea==0.6.0", - "ipython>=8.10.0", + "ipython>=7.0", "python-dotenv>=1.0.0", "sentence-transformers>=3.0.0", "datasets>=2.0.0", From c7c20965f82d80e11d751c2c8fd068adb86d0d31 Mon Sep 17 00:00:00 2001 From: Nigel Jones Date: Thu, 11 Jun 2026 14:53:27 +0100 Subject: [PATCH 2/5] Update hello_mellea: replace deprecated target_role with scoring_schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mellea PR #1037 (merged 2026-05-18, landed in mellea==0.6.0) deprecated target_role in favour of scoring_schema. The two guardian_check calls in the Guardian section were passing target_role="user"; update both to scoring_schema="user_prompt" (the direct equivalent per mellea's _TARGET_ROLE_TO_SCHEMA mapping). Also clears saved cell outputs — notebooks should be committed clean. Signed-off-by: Nigel Jones --- tutorials/notebooks/hello_mellea.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/notebooks/hello_mellea.ipynb b/tutorials/notebooks/hello_mellea.ipynb index 647832c..51c4f12 100644 --- a/tutorials/notebooks/hello_mellea.ipynb +++ b/tutorials/notebooks/hello_mellea.ipynb @@ -204,7 +204,7 @@ "source": [ "# ── Option A - criteria bank key (pre-baked, no text needed) ─────────────\n", "ctx = ChatContext().add(MelleaMessage(\"user\", \"Group X people are all lazy.\"))\n", - "score = guardian_check(ctx, backend, \"social_bias\", target_role=\"user\")\n", + "score = guardian_check(ctx, backend, \"social_bias\", scoring_schema=\"user_prompt\")\n", "print(f\"[bank social_bias] score={score:.3f}\")\n", "\n", "# ── Option B - custom criteria string ────────────────────────────────────\n", @@ -213,7 +213,7 @@ " \"across all contexts and audiences.\"\n", ")\n", "ctx = ChatContext().add(MelleaMessage(\"user\", \"How do I build a bomb?\"))\n", - "score = guardian_check(ctx, backend, HARM_CRITERIA, target_role=\"user\")\n", + "score = guardian_check(ctx, backend, HARM_CRITERIA, scoring_schema=\"user_prompt\")\n", "print(f\"[custom harm] score={score:.3f}\")\n" ] }, From cf5bfdf46be84ff82fe5f941b2263a13c3b28754 Mon Sep 17 00:00:00 2001 From: Nigel Jones Date: Thu, 11 Jun 2026 15:05:43 +0100 Subject: [PATCH 3/5] Add Colab dependency warning note after install cell Signed-off-by: Nigel Jones --- tutorials/notebooks/hello_mellea.ipynb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tutorials/notebooks/hello_mellea.ipynb b/tutorials/notebooks/hello_mellea.ipynb index 51c4f12..864e900 100644 --- a/tutorials/notebooks/hello_mellea.ipynb +++ b/tutorials/notebooks/hello_mellea.ipynb @@ -30,6 +30,16 @@ "%pip install -q \"granite-switch[tutorials]\"\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "> **Note (Google Colab):** You may see `ERROR: pip's dependency resolver` warnings about\n", + "> `starlette` and `opentelemetry`. These are conflicts between vllm's dependencies and\n", + "> Colab's pre-installed packages (`gradio`, `google-adk`) — neither is used by this notebook.\n", + "> The warnings are safe to ignore." + ] + }, { "cell_type": "code", "execution_count": null, From 41e4a83c2a838a3ecbe535f81b15b1db54d93b37 Mon Sep 17 00:00:00 2001 From: Nigel Jones Date: Thu, 11 Jun 2026 15:31:29 +0100 Subject: [PATCH 4/5] rag_101: uninstall torchcodec after install to fix Colab/vllm PyTorch conflict Signed-off-by: Nigel Jones --- tutorials/notebooks/rag_101.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tutorials/notebooks/rag_101.ipynb b/tutorials/notebooks/rag_101.ipynb index 6b55979..1730da6 100644 --- a/tutorials/notebooks/rag_101.ipynb +++ b/tutorials/notebooks/rag_101.ipynb @@ -27,7 +27,8 @@ "outputs": [], "source": [ "# Install granite-switch with tutorial dependencies (includes vLLM backend).\n", - "%pip install -q \"granite-switch[tutorials]\"" + "%pip install -q \"granite-switch[tutorials]\"", + "\n# Uninstall torchcodec: vllm upgrades PyTorch, making Colab's pre-installed version incompatible.\n%pip uninstall -q -y torchcodec\n" ] }, { From 61911e02207e20678ff619ac88144ffe84eb8c3a Mon Sep 17 00:00:00 2001 From: Nigel Jones Date: Thu, 11 Jun 2026 16:02:04 +0100 Subject: [PATCH 5/5] rag_flow: uninstall torchcodec after install to fix Colab/vllm PyTorch conflict Signed-off-by: Nigel Jones --- tutorials/notebooks/rag_flow.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tutorials/notebooks/rag_flow.ipynb b/tutorials/notebooks/rag_flow.ipynb index 94fc584..427950d 100644 --- a/tutorials/notebooks/rag_flow.ipynb +++ b/tutorials/notebooks/rag_flow.ipynb @@ -55,7 +55,8 @@ "outputs": [], "source": [ "# Install granite-switch with tutorial dependencies (includes vLLM backend).\n", - "%pip install -q \"granite-switch[tutorials]\"" + "%pip install -q \"granite-switch[tutorials]\"", + "\n# Uninstall torchcodec: vllm upgrades PyTorch, making Colab's pre-installed version incompatible.\n%pip uninstall -q -y torchcodec\n" ] }, {