OpenAIModerationGuardrail
Guardrail that flags or blocks input using OpenAI's moderation API.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
moderation_model | str | "omni-moderation-latest" | The model to use for moderation. |
raise_for_categories | Optional[List[str]] | None | The categories to raise for. When None, any flagged category raises. |
api_key | Optional[str] | None | The API key to use for moderation. Defaults to the OPENAI_API_KEY environment variable. |
Moderation categories
You can check the current list of moderation categories in OpenAI's docs.