Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 12 additions & 2 deletions tutorials/notebooks/hello_mellea.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -204,7 +214,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",
Expand All @@ -213,7 +223,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"
]
},
Expand Down
3 changes: 2 additions & 1 deletion tutorials/notebooks/rag_101.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion tutorials/notebooks/rag_flow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand Down