Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quickstart Hub Install Details #1172

Merged
merged 3 commits into from
Nov 19, 2024
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
33 changes: 25 additions & 8 deletions docs/getting_started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,40 @@ First, install Guardrails for your desired language:
pip install guardrails-ai
```

### Generate an API Key (required)
Next, get a free API key from [Guardrails Hub](https://hub.guardrailsai.com/keys). Copy and keep track of this API key because you'll use it in the next step to configure the CLI.

### Configure the Guardrails CLI (required)

First, get a free auth key from [Guardrails Hub](https://hub.guardrailsai.com/keys). Then, configure the Guardrails CLI with the auth key.
Configure the Guardrails CLI with the command:

```bash
guardrails configure
```

## Usage
The configuration process will ask you three questions:

1. Whether you want to enable metrics reporting.
2. Whether you want to use our hosted remote inference endpoints for validators that utilize large ML models.
3. To enter the API key you generated in the previous step. This is required in order to install validators in the next step.

1. Install a guardrail from [Guardrails Hub](https://hub.guardrailsai.com).

### Install a Validator from the Guardrails Hub
In order to perform any validation on LLM output with Guardrails, you will need to install an appropriate validator for your use case from the [Guardrails Hub](https://hub.guardrailsai.com). Each validator has a unique and identifying Hub URI that can be used in the Guardrails CLI to install it into your current environment. You can find the exact install command for a validator on it's details page in the [Guardrails Hub](https://hub.guardrailsai.com). For example, the [Detect PII](https://hub.guardrailsai.com/validator/guardrails/detect_pii) validator can be installed via:

```bash
guardrails hub install hub://guardrails/detect_pii
```

## Usage
1. Create a Guard with an installed validator.
First, install the validator you want to use from the Guardrails Hub:

```bash
guardrails hub install hub://guardrails/regex_match --quiet
```
2. Create a Guard from the installed guardrail.

Next, you can import this validator from the `guardrails.hub` module and use it to construct a Guard.
```python
# Import Guard and Validator
from guardrails.hub import RegexMatch
Expand All @@ -49,14 +66,14 @@ guardrails configure
.validation_passed
) # Guardrail Fails
```
3. Run multiple guardrails within a Guard.
First, install the necessary guardrails from Guardrails Hub.
2. Run multiple validators within a Guard.
First, install the necessary validators from Guardrails Hub.

```bash
guardrails hub install hub://guardrails/valid_length --quiet
guardrails hub install hub://guardrails/regex_match hub://guardrails/valid_length --quiet
```

Then, create a Guard from the installed guardrails.
Then, create a Guard from the installed validators.

```python
from guardrails.hub import RegexMatch, ValidLength
Expand Down
22 changes: 1 addition & 21 deletions docs/integrations/llama_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,14 @@
"Install LlamaIndex and a version of Guardrails with LlamaIndex support."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Found existing installation: guardrails-ai 0.6.0\n",
"Uninstalling guardrails-ai-0.6.0:\n",
" Successfully uninstalled guardrails-ai-0.6.0\n"
]
}
],
"source": [
"! pip uninstall guardrails-ai -y"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"! pip install llama-index -q\n",
"# ! pip install \"guardrails-ai>=0.6.1\"\n",
"! pip install /Users/calebcourier/Projects/guardrails -q"
"! pip install \"guardrails-ai>=0.6.1\" -q"
]
},
{
Expand Down
Loading