-
-
Save KyMidd/8e09c2c466c194f5289cc6e73b3eca05 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Enrich Slack message with guardrail info | |
| if guardrail_action == "BLOCKED": | |
| blocked_text = response | |
| response = ( | |
| f"🛑 *Our security guardrail blocked this conversation*\n" | |
| f"> {blocked_text}\n\n" | |
| f"• *Guardrail blocked type:* {guardrail_type}\n" | |
| f"• *Strength our guardrail config is set to:* {guardrail_filter_strength}\n" | |
| f"• *Confidence this conversation breaks the rules:* {guardrail_confidence}\n\n" | |
| f"*You can try rephrasing your question, or open a ticket with DevOps to investigate*" | |
| ) | |
| print(f"🚀 Final update to Slack with: {response}") | |
| client.chat_update( | |
| text=response, | |
| channel=channel_id, | |
| ts=initial_response | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment