Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Last active May 2, 2025 18:13
Show Gist options
  • Select an option

  • Save KyMidd/3c26c1450f1fc46a8e2c899da8b39503 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/3c26c1450f1fc46a8e2c899da8b39503 to your computer and use it in GitHub Desktop.
if guardrailIdentifier in input_assessment:
assessment = input_assessment[guardrailIdentifier]
filters = assessment.get("contentPolicy", {}).get("filters", [])
if filters:
first_filter = filters[0]
guardrail_type = first_filter.get("type")
guardrail_confidence = first_filter.get("confidence")
guardrail_filter_strength = first_filter.get("filterStrength")
guardrail_action = first_filter.get("action")
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment