Skip to content

Commit 7aa13e1

Browse files
authored
Merge pull request #543 from decypher-ai/rebased-dev
Integrating AutoAlign's guardrail library with NeMo Guardrails
2 parents fa0cdab + 2081dba commit 7aa13e1

File tree

16 files changed

+2200
-5
lines changed

16 files changed

+2200
-5
lines changed

docs/user_guides/guardrails-library.md

+22
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,28 @@ define flow
717717
bot provide report answer
718718
```
719719

720+
721+
### AutoAlign
722+
723+
NeMo Guardrails provides an interface for using the AutoAlign's guardrails
724+
(you need to have the `AUTOALIGN_API_KEY` environment variable set).
725+
726+
727+
Following is the list of guardrails that are currently supported:
728+
1. Gender bias Detection
729+
2. Harm Detection
730+
3. Jailbreak Detection
731+
4. Confidential Detection
732+
5. Intellectual property detection
733+
6. Racial bias Detection
734+
7. Tonal Detection
735+
8. Toxicity detection
736+
9. PII
737+
10. Factcheck
738+
739+
More details regarding the configuration and usage of these can be found [here](../../nemoguardrails/library/autoalign/README.md).
740+
741+
720742
## Other
721743

722744
### Jailbreak Detection Heuristics

examples/configs/autoalign/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# AutoAlign
2+
3+
This example showcases the use of AutoAlign guardrails.
4+
5+
The structure of the config folders is the following:
6+
- `autoalign_config` - example configuration folder for all guardrails (except factcheck)
7+
- `config.yml` - The config file holding all the configuration options.
8+
- `autoalign_factcheck_config` - example configuration folder for AutoAlign's factcheck
9+
- `kb` - The folder containing documents that form the knowledge base.
10+
- `config.yml` - The config file holding all the configuration options.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
models:
2+
- type: main
3+
engine: openai
4+
model: gpt-3.5-turbo
5+
parameters:
6+
temperature: 0.0
7+
rails:
8+
config:
9+
autoalign:
10+
parameters:
11+
endpoint: "https://<AUTOALIGN_ENDPOINT>/guardrail"
12+
input:
13+
guardrails_config:
14+
{
15+
"pii_fast": {
16+
"enabled_types": [
17+
"[BANK ACCOUNT NUMBER]",
18+
"[CREDIT CARD NUMBER]",
19+
"[DATE OF BIRTH]",
20+
"[DRIVER LICENSE NUMBER]",
21+
"[EMAIL ADDRESS]",
22+
"[IP ADDRESS]",
23+
"[ORGANIZATION]",
24+
"[PASSPORT NUMBER]",
25+
"[PASSWORD]",
26+
"[PERSON NAME]",
27+
"[PHONE NUMBER]",
28+
"[SOCIAL SECURITY NUMBER]",
29+
"[SECRET_KEY]",
30+
"[TRANSACTION_ID]"
31+
],
32+
},
33+
"gender_bias_detection": {},
34+
"harm_detection": {},
35+
"text_toxicity_extraction": {},
36+
"racial_bias_detection": {},
37+
"jailbreak_detection": {},
38+
"intellectual_property": {}
39+
}
40+
output:
41+
guardrails_config:
42+
{
43+
"pii_fast": {
44+
"enabled_types": [
45+
"[BANK ACCOUNT NUMBER]",
46+
"[CREDIT CARD NUMBER]",
47+
"[DATE OF BIRTH]",
48+
"[DRIVER LICENSE NUMBER]",
49+
"[EMAIL ADDRESS]",
50+
"[IP ADDRESS]",
51+
"[ORGANIZATION]",
52+
"[PASSPORT NUMBER]",
53+
"[PASSWORD]",
54+
"[PERSON NAME]",
55+
"[PHONE NUMBER]",
56+
"[SOCIAL SECURITY NUMBER]",
57+
"[SECRET_KEY]",
58+
"[TRANSACTION_ID]"
59+
],
60+
},
61+
"gender_bias_detection": {},
62+
"harm_detection": {},
63+
"text_toxicity_extraction": {},
64+
"racial_bias_detection": {},
65+
"jailbreak_detection": {},
66+
"intellectual_property": {}
67+
}
68+
input:
69+
flows:
70+
- autoalign check input
71+
output:
72+
flows:
73+
- autoalign check output
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
models:
2+
- type: main
3+
engine: openai
4+
model: gpt-3.5-turbo
5+
rails:
6+
config:
7+
autoalign:
8+
parameters:
9+
fact_check_endpoint: "https://<AUTOALIGN_ENDPOINT>/factcheck"
10+
output:
11+
flows:
12+
- autoalign factcheck output
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Pluto (minor-planet designation: 134340 Pluto) is a dwarf planet in the Kuiper belt, a ring of bodies beyond the orbit of Neptune. It is the ninth-largest and tenth-most-massive known object to directly orbit the Sun. It is the largest known trans-Neptunian object by volume, by a small margin, but is slightly less massive than Eris. Like other Kuiper belt objects, Pluto is made primarily of ice and rock and is much smaller than the inner planets. Pluto has only one sixth the mass of Earth's moon, and one third its volume. Pluto was recognized as a planet until 2006. Pluto has a moderately eccentric and inclined orbit, ranging from 30 to 49 astronomical units (4.5 to 7.3 billion kilometers; 2.8 to 4.6 billion miles) from the Sun. Light from the Sun takes 5.5 hours to reach Pluto at its orbital distance of 39.5 AU (5.91 billion km; 3.67 billion mi). Pluto's eccentric orbit periodically brings it closer to the Sun than Neptune, but a stable orbital resonance prevents them from colliding. Pluto has five known moons: Charon, the largest, whose diameter is just over half that of Pluto; Styx; Nix; Kerberos; and Hydra. Pluto and Charon are sometimes considered a binary system because the barycenter of their orbits does not lie within either body, and they are tidally locked. The New Horizons mission was the first spacecraft to visit Pluto and its moons, making a flyby on July 14, 2015 and taking detailed measurements and observations.

mypy.ini

-5
This file was deleted.

0 commit comments

Comments
 (0)