Skip to content

Commit 816ef5f

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/litellm_cleanup
2 parents a1f7893 + 9b7cfc3 commit 816ef5f

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

.github/workflows/install_from_hub.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
install_from_hub:
1111
runs-on: ubuntu-latest
12+
env:
13+
GUARDRAILS_API_KEY: ${{ secrets.GUARDRAILS_API_KEY }}
1214
steps:
1315
- name: Set up Python
1416
uses: actions/setup-python@v5
@@ -17,6 +19,8 @@ jobs:
1719
- name: pip install from main
1820
run: pip install git+https://github.com/guardrails-ai/guardrails.git@main
1921
- name: Install PII validator
20-
run: guardrails hub install hub://guardrails/detect_pii
22+
run: |
23+
guardrails configure --token $GUARDRAILS_API_KEY --disable-metrics --enable-remote-inferencing;
24+
guardrails hub install hub://guardrails/detect_pii;
2125
- name: Verify PII validator is addressable
2226
run: echo 'from guardrails.hub import DetectPII' | python

guardrails/cli/hub/install.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010
from guardrails.cli.version import version_warnings_if_applicable
1111

1212

13-
@hub_command.command()
13+
# Quick note: This is the command for `guardrails hub install`. We change the name of
14+
# the function def to prevent confusion, lest people import it directly and calling it
15+
# with a string for package_uris instead of a list, which behaves oddly. If you need to
16+
# call install from a script, please consider importing install from guardrails,
17+
# not guardrails.cli.hub.install.
18+
@hub_command.command(name="install")
1419
@trace(name="guardrails-cli/hub/install")
15-
def install(
20+
def install_cli(
1621
package_uris: List[str] = typer.Argument(
1722
...,
1823
help="URIs to the packages to install. Example: hub://guardrails/regex_match hub://guardrails/toxic_language",
@@ -33,6 +38,17 @@ def install(
3338
),
3439
):
3540
try:
41+
if isinstance(package_uris, str):
42+
logger.error(
43+
f"`install` in {__file__} was called with a string instead of "
44+
"a list! This can happen if it is invoked directly instead of "
45+
"being run via the CLI. Did you mean to import `from guardrails import "
46+
"install` instead? Recovering..."
47+
)
48+
package_uris = [
49+
package_uris,
50+
]
51+
3652
from guardrails.hub.install import install_multiple
3753

3854
def confirm():

guardrails/hub/install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def install(
5353
Examples:
5454
>>> RegexMatch = install("hub://guardrails/regex_match").RegexMatch
5555
56-
>>> install("hub://guardrails/regex_match);
56+
>>> install("hub://guardrails/regex_match")
5757
>>> import guardrails.hub.regex_match as regex_match
5858
"""
5959

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "guardrails-ai"
3-
version = "0.5.10"
3+
version = "0.5.11"
44
description = "Adding guardrails to large language models."
55
authors = ["Guardrails AI <[email protected]>"]
66
license = "Apache License 2.0"

0 commit comments

Comments
 (0)