Skip to content

Commit b0541c9

Browse files
committed
update notebooks
1 parent 6aa716e commit b0541c9

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

docs/examples/extracting_entities.ipynb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,24 @@
1616
"\n",
1717
"We want to extract structured information about all fees and interest rates associated with the Chase credit card.\n",
1818
"\n",
19-
"## Step 0: Download PDF and load it as string\n",
19+
"## Step 0: Download PDF and load it as string and Install Validators from Guardrails Hub \n",
2020
"\n",
2121
"To get started, download the document from [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/data/chase_card_agreement.pdf) and save it in `data/chase_card_agreement.pdf`.\n",
2222
"\n",
23-
"Guardrails has some built-in functions to help with common tasks. Here, we will use the `read_pdf` function to load the PDF as a string."
23+
"Guardrails has some built-in functions to help with common tasks. Here, we will use the `read_pdf` function to load the PDF as a string.\n",
24+
"\n",
25+
"We also need to install the necessary validators from Guardrails Hub: \n",
26+
"\n",
27+
"1. LowerCase: ```guardrails hub install hub://guardrails/lowercase```\n",
28+
"\n",
29+
"2. TwoWords: ```guardrails hub install hub://guardrails/two_words```\n",
30+
"\n",
31+
"3. OneLine: ```guardrails hub install hub://guardrails/one_line```"
2432
]
2533
},
2634
{
2735
"cell_type": "code",
28-
"execution_count": 22,
36+
"execution_count": null,
2937
"metadata": {},
3038
"outputs": [
3139
{
@@ -143,7 +151,7 @@
143151
"metadata": {},
144152
"outputs": [],
145153
"source": [
146-
"from guardrails.validators import LowerCase, TwoWords, OneLine\n",
154+
"from guardrails.hub import LowerCase, TwoWords, OneLine\n",
147155
"from pydantic import BaseModel, Field\n",
148156
"from typing import List\n",
149157
"\n",

docs/examples/generate_structured_data.ipynb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
"3. The number of orders associated with each user should be between 0 and 50.\n",
2727
"4. Each user should have a most recent order date.\n",
2828
"\n",
29+
"## Step 0: Install the necessary validators from Guardrails Hub\n",
30+
"\n",
31+
"We first have to install the necessary validators from Guardrails Hub:\n",
32+
"\n",
33+
"1. ValidLength: ```guardrails hub install hub://reflex/valid_python```\n",
34+
"\n",
35+
"2. TwoWords: ```guardrails hub install hub://guardrails/two_words```\n",
36+
"\n",
37+
"3. ValidRange: ```guardrails hub install hub://guardrails/valid_range```\n",
2938
"\n",
3039
"## Step 1: Generating `RAIL` Spec\n",
3140
"\n",
@@ -83,7 +92,7 @@
8392
"outputs": [],
8493
"source": [
8594
"from pydantic import BaseModel, Field\n",
86-
"from guardrails.validators import ValidLength, TwoWords, ValidRange\n",
95+
"from guardrails.hub import ValidLength, TwoWords, ValidRange\n",
8796
"from datetime import date\n",
8897
"from typing import List\n",
8998
"\n",

docs/how_to_guides/telemetry.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Standard [open telemetry environment variables](https://opentelemetry-python.rea
114114
```python
115115
from guardrails import Guard
116116
from guardrails.utils.telemetry_utils import default_otel_collector_tracer
117-
from guardrails.validators import ValidLength
117+
from guardrails.hub import ValidLength
118118
import openai
119119

120120
guard = Guard.from_string(

0 commit comments

Comments
 (0)