Skip to content
Open
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
28 changes: 14 additions & 14 deletions docs/class6/module1/lab7/lab7.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
Custom scanners
###############
Custom guardrails
#################

This is where the magic starts.

There are three different types of scanners:
There are three different types of guardrails:

1. **Keyword scanner** - you can define specific keywords which will trigger the scanner. It can not only **block** but also **redact**.
1. **Keyword guardrail** - you can define specific keywords which will trigger the guardrail. It can not only **block** but also **redact**.

2. **Regex scanner** - you can define specific regex filters which will trigger the scanner. It can not only **block** but also **redact**.
2. **Regex guardrail** - you can define specific regex filters which will trigger the guardrail. It can not only **block** but also **redact**.

3. **GenAI scanner** - this is the real magic: define in natural language what you want to be identified and blocked. We will go in-depth in the next section.
3. **GenAI guardrail** - this is the real magic: define in natural language what you want to be identified and blocked. We will go in-depth in the next section.


**Keyword scanner**
**Keyword guardrail**

Use exact-word guardrails when:

Expand All @@ -23,17 +23,17 @@ Use exact-word guardrails when:
For example, we have internal projects called **Phoenix** and **Scooby Doo**, and we want to make sure that if either is referenced, that message will get blocked.


1. In the main left tab go to **Scanners** ⇒ **Build a custom scanner** ⇒ **Keyword scanner**
1. In the main left tab go to **guardrails** ⇒ **Build a custom guardrail** ⇒ **Keyword guardrail**

2. Set the **Name** to **Internal Projects**

3. In the **Keywords** enter **Phoenix** and **Scooby Doo**

4. Click **Save** ⇒ **Save version**

After saving the scanner we find ourselves in the **Playground** area. Here we can directly test all custom scanners against different text patterns.
After saving the guardrail we find ourselves in the **Playground** area. Here we can directly test all custom guardrails against different text patterns.

1. Enable **Test** for the **Internal Projects** scanner on the right-hand side of the page.
1. Enable **Test** for the **Internal Projects** guardrail on the right-hand side of the page.

2. In the message input area of the **Playground** enter the below text.

Expand All @@ -44,7 +44,7 @@ After saving the scanner we find ourselves in the **Playground** area. Here we c
3. The previous message was blocked. Enter anything that is not **Phoenix** or **Scooby Doo** and the message will pass.


**Regex scanner**
**Regex guardrail**

Use regex guardrails when:

Expand All @@ -56,17 +56,17 @@ Use regex guardrails when:

For example, we want to ensure that the response does not contain any internal private IPs from our company.

1. In the main left tab go to **Scanners** ⇒ **Build a custom scanner** ⇒ **Regex scanner**
1. In the main left tab go to **guardrails** ⇒ **Build a custom guardrail** ⇒ **Regex guardrail**

2. Set the **Name** to **Internal IPs**

3. In the **Regular expression** enter: ``(?i)\bhttps?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0|10\.(?:\d\d?\d?\.)\d\d?\d?|172\.(?:1[6-9]|2\d|3[0-1])\.(?:\d\d?\d?\.)\d\d?\d?|192\.168\.(?:\d\d?\d?\.)\d\d?\d?)(?::\d+)?(?:\/[^\s]*)?``

4. Click **Save** ⇒ **Save version**

After saving the scanner we find ourselves in the **Playground** area. Here we can directly test all custom scanners against different text patterns.
After saving the guardrail we find ourselves in the **Playground** area. Here we can directly test all custom guardrails against different text patterns.

1. Enable **Test** for the **Internal IPs** scanner on the right-hand side of the page.
1. Enable **Test** for the **Internal IPs** guardrail on the right-hand side of the page.

2. In the message input area of the **Playground** enter the below text.

Expand Down