Skip to content

Commit

Permalink
Convert private ai flow to Colang 2.x compatible version
Browse files Browse the repository at this point in the history
  • Loading branch information
letmerecall committed Oct 23, 2024
1 parent 2e64d1f commit ea7349d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions nemoguardrails/library/privateai/flows.co
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

0 comments on commit ea7349d

Please sign in to comment.