Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scripts/run_notebooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export NLTK_DATA=/tmp/nltk_data;
rm -rf ./guardrails

# Navigate to notebooks
cd docs/examples
cd docs/src/examples

# Get the notebook name from the matrix variable
notebook="$1"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/update_notebook_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
notebook_names="["

# Compile list of file names
for file in $(ls docs/examples/*.ipynb); do
for file in $(ls docs/src/examples/*.ipynb); do
# Add the full filename with extension
filename=$(basename "$file")

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/bug_free_python_code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"# Generating Bug Free Leetcode Solutions\n",
"\n",
":::note\n",
"To download this tutorial as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/bug_free_python_code.ipynb).\n",
"To download this tutorial as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/bug_free_python_code.ipynb).\n",
":::\n",
"\n",
"In this example, we want to solve String Manipulation leetcode problems such that the code is bug free.\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/bug_free_python_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CodeOutputBlock from '../../code-output-block.jsx';
# Generating Bug Free Leetcode Solutions

:::note
To download this tutorial as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/bug_free_python_code.ipynb).
To download this tutorial as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/bug_free_python_code.ipynb).
:::

In this example, we want to solve String Manipulation leetcode problems such that the code is bug free.
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/chatbot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"source": [
"### Step 0 Download PDF and load it as string\n",
":::note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/chatbots.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/chatbots.ipynb).\n",
":::\n",
"\n",
"In this example, we will set up Guardrails with a chat model that can answer questions about the card agreement."
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/chatbot.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ guardrails hub install hub://guardrails/profanity_free --quiet

### Step 0 Download PDF and load it as string
:::note
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/chatbots.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/chatbots.ipynb).
:::

In this example, we will set up Guardrails with a chat model that can answer questions about the card agreement.
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/competitors_check.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"# Check if a competitor is named\n",
"\n",
"!!! note\n",
"To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/competitors_check.ipynb).\n"
"To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/competitors_check.ipynb).\n"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/competitors_check.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CodeOutputBlock from '../../code-output-block.jsx';
# Check if a competitor is named

!!! note
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/competitors_check.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/competitors_check.ipynb).


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! Instead, edit the notebook w/the location & name as this file. -->
Expand Down
4 changes: 2 additions & 2 deletions docs/dist/examples/extracting_entities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"# Extracting entities from a Terms of Service document\n",
"\n",
"!!! note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/extracting_entities.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/extracting_entities.ipynb).\n",
"\n",
"In this example, we will use Guardrails to extract key information from a Terms-of-Service document.\n",
"\n",
Expand All @@ -62,7 +62,7 @@
"\n",
"## Step 0: Download PDF and load it as string\n",
"\n",
"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",
"To get started, download the document from [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/data/chase_card_agreement.pdf) and save it in `data/chase_card_agreement.pdf`.\n",
"\n",
"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."
]
Expand Down
4 changes: 2 additions & 2 deletions docs/dist/examples/extracting_entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ guardrails hub install hub://guardrails/one_line --quiet
# Extracting entities from a Terms of Service document

!!! note
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/extracting_entities.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/extracting_entities.ipynb).

In this example, we will use Guardrails to extract key information from a Terms-of-Service document.

Expand All @@ -54,7 +54,7 @@ We want to extract structured information about all fees and interest rates asso

## Step 0: Download PDF and load it as string

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`.
To get started, download the document from [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/data/chase_card_agreement.pdf) and save it in `data/chase_card_agreement.pdf`.

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.

Expand Down
4 changes: 2 additions & 2 deletions docs/dist/examples/guardrails_with_chat_models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"# Using Guardrails with Chat Models\n",
"\n",
"!!! note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/extracting_entities.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/extracting_entities.ipynb).\n",
"\n",
"In this example, we will set up Guardrails with a chat model.\n",
"\n",
Expand All @@ -52,7 +52,7 @@
"\n",
"## Step 0: Download PDF and load it as string\n",
"\n",
"To get started, download the document from [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/data/chase_card_agreement.pdf) and save it in `data/chase_card_agreement.pdf`.\n",
"To get started, download the document from [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/data/chase_card_agreement.pdf) and save it in `data/chase_card_agreement.pdf`.\n",
"\n",
"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."
]
Expand Down
4 changes: 2 additions & 2 deletions docs/dist/examples/guardrails_with_chat_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ guardrails hub install hub://guardrails/one_line --quiet
# Using Guardrails with Chat Models

!!! note
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/extracting_entities.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/extracting_entities.ipynb).

In this example, we will set up Guardrails with a chat model.

Expand All @@ -46,7 +46,7 @@ We retry the [entity extraction example](./extracting_entities.ipynb) using a ch

## Step 0: Download PDF and load it as string

To get started, download the document from [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/data/chase_card_agreement.pdf) and save it in `data/chase_card_agreement.pdf`.
To get started, download the document from [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/data/chase_card_agreement.pdf) and save it in `data/chase_card_agreement.pdf`.

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.

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/no_secrets_in_generated_text.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"# Generating strings that don't have any secrets\n",
"\n",
"!!! note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/no_secrets_in_generated_text.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/no_secrets_in_generated_text.ipynb).\n",
"\n",
"In this example, we will use Guardrails to generate strings that don't have any secrets.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/no_secrets_in_generated_text.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CodeOutputBlock from '../../code-output-block.jsx';
# Generating strings that don't have any secrets

!!! note
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/no_secrets_in_generated_text.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/no_secrets_in_generated_text.ipynb).

In this example, we will use Guardrails to generate strings that don't have any secrets.

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/recipe_generation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"# Generating Vegan Recipes\n",
"\n",
"!!! note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/recipe_generation.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/recipe_generation.ipynb).\n",
"\n",
"In this example, we will use Guardrails to generate vegan mac and cheese recipe.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/recipe_generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CodeOutputBlock from '../../code-output-block.jsx';
# Generating Vegan Recipes

!!! note
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/recipe_generation.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/recipe_generation.ipynb).

In this example, we will use Guardrails to generate vegan mac and cheese recipe.

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/select_choice_based_on_action.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"# Enforcing Guardrails on Choice Selection\n",
"\n",
"!!! note\n",
" To download this tutorial as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/select_choice_based_on_action.ipynb).\n",
" To download this tutorial as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/select_choice_based_on_action.ipynb).\n",
"\n",
"In this example, we want the LLM to pick an action (e.g. `fight` or `flight`), and based on that action we want to return different JSON objects. For example, if the action is `fight`, we want to return a JSON object that contains the `weapon` field. If the action is `flight`, we want to return a JSON object that contains the `direction` and `distance` fields.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/select_choice_based_on_action.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ guardrails hub install hub://guardrails/valid_choices --quiet
# Enforcing Guardrails on Choice Selection

!!! note
To download this tutorial as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/select_choice_based_on_action.ipynb).
To download this tutorial as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/select_choice_based_on_action.ipynb).

In this example, we want the LLM to pick an action (e.g. `fight` or `flight`), and based on that action we want to return different JSON objects. For example, if the action is `fight`, we want to return a JSON object that contains the `weapon` field. If the action is `flight`, we want to return a JSON object that contains the `direction` and `distance` fields.

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/summarizer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"In this example we will use Guardrails to summarize text in terms of length, quality and output read time.\n",
"\n",
"!!! note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/summarization.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/summarization.ipynb).\n",
"\n",
"In this example, we will use Guardrails in the summarization of a text document. We will check whether the summarized document has a high semantic similarity with the original document. We will ensure the ouptput meets a certain range of length and read time.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/summarizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CodeOutputBlock from '../../code-output-block.jsx';
In this example we will use Guardrails to summarize text in terms of length, quality and output read time.

!!! note
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/summarization.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/summarization.ipynb).

In this example, we will use Guardrails in the summarization of a text document. We will check whether the summarized document has a high semantic similarity with the original document. We will ensure the ouptput meets a certain range of length and read time.

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/syntax_error_free_sql.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"# Natural Language to Bug Free SQL\n",
"\n",
"!!! note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/syntax_error_free_sql.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/syntax_error_free_sql.ipynb).\n",
"\n",
"In this example, we will use Guardrails to generate SQL queries from natural language. We will check that the SQL is free of any syntax errors.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/syntax_error_free_sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ guardrails hub install hub://guardrails/valid_sql --quiet
# Natural Language to Bug Free SQL

!!! note
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/syntax_error_free_sql.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/syntax_error_free_sql.ipynb).

In this example, we will use Guardrails to generate SQL queries from natural language. We will check that the SQL is free of any syntax errors.

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/text_summarization_quality.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"# Summarize text accurately\n",
"\n",
":::note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/text_summarization_quality.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/text_summarization_quality.ipynb).\n",
":::\n",
"\n",
"In this example, we will use Guardrails in the summarization of a text document. We will check whether the summarized document has a high semantic similarity with the original document.\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/text_summarization_quality.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ guardrails hub install hub://guardrails/similar_to_document --quiet
# Summarize text accurately

:::note
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/text_summarization_quality.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/text_summarization_quality.ipynb).
:::

In this example, we will use Guardrails in the summarization of a text document. We will check whether the summarized document has a high semantic similarity with the original document.
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/translation_to_specific_language.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"# Translate text without profanities\n",
"\n",
"!!! note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/translation_to_specific_language.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/translation_to_specific_language.ipynb).\n",
"\n",
"In this example, we will use Guardrails during the translation of a statement from another language to english. We will check whether the translated statement passes the profanity check or not.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/translation_to_specific_language.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CodeOutputBlock from '../../code-output-block.jsx';
# Translate text without profanities

!!! note
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/examples/translation_to_specific_language.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/ShreyaR/guardrails/blob/main/docs/src/examples/translation_to_specific_language.ipynb).

In this example, we will use Guardrails during the translation of a statement from another language to english. We will check whether the translated statement passes the profanity check or not.

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/translation_with_quality_check.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"# Translate text with quality checks\n",
"\n",
"**Note:**\n",
"To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/translation_with_quality_check.ipynb).\n",
"To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/translation_with_quality_check.ipynb).\n",
"\n",
"In this example, we will use Guardrails during the translation of a statement from another language to English. We will check whether the translated statement is likely of high quality.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/translation_with_quality_check.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ guardrails hub install hub://brainlogic/high_quality_translation -q
# Translate text with quality checks

**Note:**
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/translation_with_quality_check.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/translation_with_quality_check.ipynb).

In this example, we will use Guardrails during the translation of a statement from another language to English. We will check whether the translated statement is likely of high quality.

Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/valid_chess_moves.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"# Playing Valid Chess Moves\n",
"\n",
"!!! note\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/valid_chess_moves.ipynb).\n",
" To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/valid_chess_moves.ipynb).\n",
"\n",
"!!! warning\n",
" This example is currently under development (it cannot be used to play a full chess game yet).\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/dist/examples/valid_chess_moves.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CodeOutputBlock from '../../code-output-block.jsx';
# Playing Valid Chess Moves

!!! note
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/valid_chess_moves.ipynb).
To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/src/examples/valid_chess_moves.ipynb).

!!! warning
This example is currently under development (it cannot be used to play a full chess game yet).
Expand Down
Loading