Quick Start
Enable content moderation by setting thecompliance option to true:
Configuration Options
Global Compliance Setting
Enable moderation for all chat interactions:Per-Message Compliance
Control moderation on a per-message basis:Violation Detection
When compliance checking is enabled, the response includes violation information that your application can use:Content Violation Categories
The system can detect and report the following categories of potentially harmful content:Streaming with Moderation
Content moderation works with both streaming and non-streaming responses. For streaming responses, compliance violations are available in the chunk data:Non-Streaming with Moderation
For non-streaming responses, compliance violations are available in the response object:Event-Driven Chat with Moderation
When usingchat.send(), compliance violations are available in the messageComplete event:
Application Examples
Flexible Violation Handling
Educational Approach
Moderation Queue
Error Handling
Handle moderation failures gracefully:Key Points
- Violation Detection: The system detects and reports violations, but doesn’t automatically block content
- Application Control: Your application decides how to handle each type of violation
- Flexible Policies: Implement content policies that match your application’s needs
- User Experience: Choose between blocking, warning, educating, or queuing for review
- Escalation: Decide which violations require immediate action vs. review
- Logging: Track violations for analysis and policy improvement
Next Steps
Event System
Learn about the SDK’s event system for chat and image generation
Chat Completions
Integrate moderation with chat features
Streaming Responses
Handle violations in real-time streaming
REST API Moderation
Direct API moderation implementation
