-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert private ai flow to Colang 2.x compatible version
- Loading branch information
1 parent
2e64d1f
commit ea7349d
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# INPUT RAILS | ||
|
||
@active | ||
flow detect pii on input | ||
"""Check if the user input has PII.""" | ||
$has_pii = await DetectPiiAction(source="input", text=$user_message) | ||
|
||
if $has_pii | ||
bot inform answer unknown | ||
abort | ||
|
||
|
||
# INPUT RAILS | ||
|
||
@active | ||
flow detect pii on output | ||
"""Check if the bot output has PII.""" | ||
$has_pii = await DetectPiiAction(source="output", text=$bot_message) | ||
|
||
if $has_pii | ||
bot inform answer unknown | ||
abort | ||
|
||
|
||
# RETRIVAL RAILS | ||
|
||
@active | ||
flow detect pii on retrieval | ||
"""Check if the relevant chunks from the knowledge base have any PII.""" | ||
$has_pii = await DetectPiiAction(source="retrieval", text=$relevant_chunks) | ||
|
||
if $has_pii | ||
bot inform answer unknown | ||
abort |