From b258ff1930765da9bd0761ad47b1401c246a595a Mon Sep 17 00:00:00 2001 From: Ahmad Elmalah Date: Fri, 3 Jan 2025 02:05:27 +0200 Subject: [PATCH] Docs: Add 'Optional' to installation section to fix an issue (#28902) Problem: "Optional" object is used in one example without importing, which raises the following error when copying the example into IDE or Jupyter Lab ![image](https://github.com/user-attachments/assets/3a6c48cc-937f-4774-979b-b3da64ced247) Solution: Just importing Optional from typing_extensions module, this solves the problem! --------- Co-authored-by: Erick Friis --- docs/docs/how_to/structured_output.ipynb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/docs/how_to/structured_output.ipynb b/docs/docs/how_to/structured_output.ipynb index c00755650c1..66d961491d2 100644 --- a/docs/docs/how_to/structured_output.ipynb +++ b/docs/docs/how_to/structured_output.ipynb @@ -165,6 +165,8 @@ } ], "source": [ + "from typing import Optional\n", + "\n", "from typing_extensions import Annotated, TypedDict\n", "\n", "\n", @@ -206,10 +208,10 @@ { "data": { "text/plain": [ - "{'setup': 'Why was the cat sitting on the computer?',\n", - " 'punchline': 'Because it wanted to keep an eye on the mouse!',\n", - " 'rating': 7}" - ] + "{'setup': 'Why was the cat sitting on the computer?',\n", + " 'punchline': 'Because it wanted to keep an eye on the mouse!',\n", + " 'rating': 7}" + ] }, "execution_count": 4, "metadata": {},