nemoguardrails.library.policyai.actions
PolicyAI Integration for NeMo Guardrails.
PolicyAI provides content moderation and policy enforcement capabilities for LLM applications. This integration allows using PolicyAI as an input and output rail for content moderation.
For more information, see: https://musubilabs.ai
Module Contents
Functions
Data
API
async
Call the PolicyAI API to evaluate content.
Parameters:
text
The text content to evaluate.
tag_name
Optional tag name for the PolicyAI evaluation. If not provided, uses POLICYAI_TAG_NAME env var or “prod”.
Returns:
dict with:
- assessment: “SAFE” or “UNSAFE”
- category: the violation category (if UNSAFE)
- severity: severity level 0-3
- reason: explanation for the decision
Mapping for call_policyai_api.
Block (return True) if:
- Assessment is “UNSAFE”