Skip to content

Commit

Permalink
Docs: Add 'Optional' to installation section to fix an issue (#28902)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ahmadelmalah and efriis authored Jan 3, 2025
1 parent 97dc906 commit b258ff1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/docs/how_to/structured_output.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
}
],
"source": [
"from typing import Optional\n",
"\n",
"from typing_extensions import Annotated, TypedDict\n",
"\n",
"\n",
Expand Down Expand Up @@ -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": {},
Expand Down

0 comments on commit b258ff1

Please sign in to comment.