Skip to content

Commit 6869cf6

Browse files
committed
change notebooks
1 parent 01ef29c commit 6869cf6

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

docs/examples/translation_with_quality_check.ipynb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
" huggingface-cli login --token $HUGGINGFACE_TOKEN\n"
2727
]
2828
},
29+
{
30+
"cell_type": "markdown",
31+
"metadata": {},
32+
"source": [
33+
"We also need to install the ```HighQualityTranslation``` validator from Guardrails Hub: \n",
34+
"\n",
35+
"```guardrails hub install hub://brainlogic/high_quality_translation```"
36+
]
37+
},
2938
{
3039
"cell_type": "code",
3140
"execution_count": 10,
@@ -36,7 +45,7 @@
3645
"from pydantic import BaseModel, Field\n",
3746
"import guardrails as gd\n",
3847
"from rich import print\n",
39-
"from guardrails.validators import IsHighQualityTranslation"
48+
"from guardrails.hub import HighQualityTranslation"
4049
]
4150
},
4251
{
@@ -130,7 +139,7 @@
130139
"class HighQualityTranslation(BaseModel):\n",
131140
" translated_statement: str = Field(\n",
132141
" description=\"Validate the translation quality of the given statement\",\n",
133-
" validators=[IsHighQualityTranslation(on_fail=\"fix\")],\n",
142+
" validators=[HighQualityTranslation(on_fail=\"fix\")],\n",
134143
" )"
135144
]
136145
},
@@ -553,7 +562,7 @@
553562
"source": [
554563
"# Test with validation method 'full'\n",
555564
"guard = gd.Guard.from_string(\n",
556-
" validators=[IsHighQualityTranslation(on_fail=\"fix\")],\n",
565+
" validators=[HighQualityTranslation(on_fail=\"fix\")],\n",
557566
" description=\"Validate the translation quality of the given statement\",\n",
558567
")"
559568
]
@@ -705,7 +714,7 @@
705714
"cell_type": "markdown",
706715
"metadata": {},
707716
"source": [
708-
"As you can see, the translation quality is really bad, and the `IsHighQualityTranslation` check failed as the translation quality was below the threshold. The validated response is an empty string.\n",
717+
"As you can see, the translation quality is really bad, and the `HighQualityTranslation` check failed as the translation quality was below the threshold. The validated response is an empty string.\n",
709718
"\n",
710719
"## In this way, you can use Guardrails to ensure that the output of your LLM is of high quality.\n"
711720
]

0 commit comments

Comments
 (0)