Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created May 2, 2025 18:15
Show Gist options
  • Select an option

  • Save KyMidd/8e09c2c466c194f5289cc6e73b3eca05 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/8e09c2c466c194f5289cc6e73b3eca05 to your computer and use it in GitHub Desktop.
# 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