Skip to content

Commit 403f23c

Browse files
committed
fix streaming
1 parent 85858f3 commit 403f23c

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

docs/how_to_guides/streaming.ipynb

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@
2828
"### 1. For structured JSON output\n"
2929
]
3030
},
31+
{
32+
"cell_type": "markdown",
33+
"metadata": {},
34+
"source": [
35+
"### Install validators from Guardrails Hub\n",
36+
"\n",
37+
"We first have to install the necessary validators from Guardrails Hub: \n",
38+
"\n",
39+
"1. ValidRange: ```guardrails hub install hub://guardrails/valid_range```\n",
40+
"\n",
41+
"2. UpperCase: ```guardrails hub install hub://guardrails/uppercase```\n",
42+
"\n",
43+
"3. LowerCase: ```guardrails hub install hub://guardrails/lowercase```\n",
44+
"\n",
45+
"4. OneLine: ```guardrails hub install hub://guardrails/one_line```"
46+
]
47+
},
3148
{
3249
"cell_type": "markdown",
3350
"metadata": {},
@@ -42,13 +59,8 @@
4259
"outputs": [],
4360
"source": [
4461
"from pydantic import BaseModel, Field\n",
62+
"from guardrails.hub import LowerCase, UpperCase, ValidRange, OneLine\n",
4563
"from typing import List\n",
46-
"from guardrails.validators import (\n",
47-
" ValidRange,\n",
48-
" UpperCase,\n",
49-
" LowerCase,\n",
50-
" OneLine,\n",
51-
")\n",
5264
"\n",
5365
"prompt = \"\"\"\n",
5466
"Given the following doctor's notes about a patient, please extract a dictionary that contains the patient's information.\n",
@@ -982,6 +994,19 @@
982994
"### 2. For unstructured text output\n"
983995
]
984996
},
997+
{
998+
"cell_type": "markdown",
999+
"metadata": {},
1000+
"source": [
1001+
"### Install validators from Guardrails Hub\n",
1002+
"\n",
1003+
"We first have to install the necessary validators from Guardrails Hub: \n",
1004+
"\n",
1005+
"1. UpperCase: ```guardrails hub install hub://guardrails/uppercase```\n",
1006+
"\n",
1007+
"2. OneLine: ```guardrails hub install hub://guardrails/one_line```"
1008+
]
1009+
},
9851010
{
9861011
"cell_type": "markdown",
9871012
"metadata": {},
@@ -995,8 +1020,7 @@
9951020
"metadata": {},
9961021
"outputs": [],
9971022
"source": [
998-
"from guardrails.validators import UpperCase, OneLine\n",
999-
"\n",
1023+
"from guardrails.hub import UpperCase, OneLine\n",
10001024
"prompt = \"\"\"\n",
10011025
"Generate a short description of large language models. Each new sentence should be on another line.\n",
10021026
"\"\"\"\n",

0 commit comments

Comments
 (0)