Sentry API Documentation
Sentry empowers platform owners to create safer and more inclusive online spaces by providing AI-driven content moderation tools. This page outlines how to use Sentry API effectively.
Overview
Sentry is designed to analyze and moderate individual user-generated comments. It provides a pass or fail response based on its internal guidelines and any additional rules or sentiments provided by the client. The primary goal is to ensure discussions remain constructive and free of harmful content.
What Sentry Can Do
- Moderate Individual Comments: It evaluates the appropriateness of individual comments based on rules and sentiments.
- Define Acceptable Behavior: Clients can specify rules and sentiments to align content moderation with their platform’s values.
- Ensure Civil Discussions: It enforces civility, relevance, and respect in user-generated content.
What Sentry Cannot Do
- Track Historical User Behavior: Sentry evaluates only the current comment. Rules requiring historical context (e.g., “You must contribute before self-promoting”) are not enforceable.
- Understand Complex Contexts Beyond the Provided Payload: Sentry relies on the topic content, response chain, and user-defined rules/sentiments to assess comments.
Core Functionality
Sentry evaluates individual responses or comments and does not analyze long-term user behavior or historical context. Below are the default checks applied by Sentry:
- Assessing relevance to the topic content and ongoing conversation.
- Rejecting spam, irrelevant, or off-topic comments.
- Rejecting hateful, discriminatory, or harassing language.
- Rejecting content that encourages harmful or toxic behavior.
- Enforcing general civility and respect in discussions.
Sentiments
Sentiments allow clients to customize moderation by specifying acceptable tones or types of comments. A maximum of six sentiments can be defined. If no sentiments are provided, Sentry uses its default moderation guidelines.
Here are examples of sentiments:
- Positive or Encouraging: Comments that express praise or encouragement.
Example: “This is such an insightful article, thank you for sharing!” - Supportive or Empathetic: Comments offering help or encouragement.
Example: “I’m so sorry you’re going through this. Stay strong!” - Humorous or Lighthearted: Comments adding levity without being offensive.
Example: “I guess cats are taking over the internet and our minds!” - Constructive Disagreement: Polite disagreements that add to the discussion.
Example: “I see your point, but I think there’s another side to consider.” - Neutral or Factual: Comments providing factual information without emotional tone.
Example: “AI can analyze large datasets in healthcare.” - Critical but Polite Feedback: Polite critiques of flaws or suggestions.
Example: “This article is informative, but I think it could benefit from more references.”
Rules
Rules define specific conditions that a single comment must meet to pass or fail. These are applied on an individual basis and do not rely on historical behavior or user context. A maximum of six rules can be defined, and if no rules are provided, Sentry defaults to its built-in guidelines.
Examples of rules:
- “Do not post or discuss NSFW content.”
- “Do not reveal personal information about others.”
- “Do not post shortened URLs.”
Important: Rules must apply to a single response. For example, Sentry cannot enforce rules requiring users to contribute multiple helpful comments before promoting their services, as it does not track historical behavior.
Detailed Endpoint Information
The following table details the /api/assess-content
endpoint:
Field | Type | Required | Description |
---|---|---|---|
Authorization | Header | Yes | API key for authentication. Format: Bearer <API_KEY> |
topicTitle | string | Optional | The title of the topic. |
topicContent | string | Yes | The main content of the topic. |
responseChain | array | Optional | Array of prior responses in the discussion thread. |
newResponse | string | Yes | The new comment or response to evaluate. |
rules | array | Optional | List of rules for moderation. |
sentiments | array | Optional | Sentiment analysis criteria. |
Important Notes:
- Payload Sanitization: Ensure that all fields in the payload are sanitized and stripped of HTML or other code. Only plain text values are acceptable.
- Unauthorized or improperly formatted API requests will result in error responses. Refer to the Error Responses section for more details.
Example API Payload
{
"topicTitle": "AI Advancements in Healthcare",
"topicContent": "AI has shown significant promise in diagnosing diseases early and improving patient outcomes.",
"responseChain": [
"This is fascinating. AI could save many lives!",
"Absolutely, especially in resource-limited settings."
],
"newResponse": "I completely agree. AI's potential to assist in healthcare is transformative.",
"rules": [
{"description": "Be respectful in discussions."},
{"description": "Avoid posting irrelevant content."}
],
"sentiments": [
{"description": "Responses showing optimism. Example: AI is making incredible advancements in healthcare."},
{"description": "Factual responses. Example: AI is used to process large datasets in healthcare."}
]
}
Error Responses
Sentry provides standardized error messages for common issues, along with corresponding error codes:
Error Code | Description |
---|---|
400 |
Payload contains invalid or unsanitized data. |
403 |
Invalid or missing API key. |
429 |
Rate limit exceeded. Please upgrade your subscription. |
500 |
Internal server error during content assessment. |
Pass/Fail Responses
Sentry returns a simple pass or fail response for each comment:
- pass: The comment aligns with the topic and meets all rules and sentiments.
- fail: The comment is inappropriate, irrelevant, or violates a rule or sentiment directive.
Limitations
Sentry is designed to moderate individual comments and cannot enforce rules requiring historical context or multi-message analysis. Its focus is on ensuring safe and constructive interactions within a single response.
Conclusion
Sentry simplifies content moderation, making it easy for developers to integrate powerful tools into their platforms. By focusing on individual comments and allowing customizable rules and sentiments, it helps create safer online spaces for discussions of all kinds.
Sentry is currently in beta testing and we are looking for beta testers. If you would like to give Sentry a try please feel free to contact me here.