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

Migrate private ai flow to latest version of colang #4

Open
wants to merge 2 commits into
base: feature/privateai-integration
Choose a base branch
from
Open
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
31 changes: 31 additions & 0 deletions nemoguardrails/library/privateai/flows.co
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# INPUT RAILS

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


# OUTPUT RAILS

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

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
2 changes: 1 addition & 1 deletion nemoguardrails/library/privateai/flows.v1.co
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define subflow detect pii on input
stop


# INPUT RAILS
# OUTPUT RAILS

define subflow detect pii on output
"""Check if the bot output has PII."""
Expand Down