azure-ai-contentsafety-py

Featured

Azure AI Content Safety SDK for Python. Use for detecting harmful content in text and images with multi-severity classification.

AI & Automation 39,350 stars 6386 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Azure AI Content Safety SDK for Python Detect harmful user-generated and AI-generated content in applications. ## Installation ```bash pip install azure-ai-contentsafety ``` ## Environment Variables ```bash CONTENT_SAFETY_ENDPOINT=https://<resource>.cognitiveservices.azure.com CONTENT_SAFETY_KEY=<your-api-key> ``` ## Authentication ### API Key ```python from azure.ai.contentsafety import ContentSafetyClient from azure.core.credentials import AzureKeyCredential import os client = ContentSafetyClient( endpoint=os.environ["CONTENT_SAFETY_ENDPOINT"], credential=AzureKeyCredential(os.environ["CONTENT_SAFETY_KEY"]) ) ``` ### Entra ID ```python from azure.ai.contentsafety import ContentSafetyClient from azure.identity import DefaultAzureCredential client = ContentSafetyClient( endpoint=os.environ["CONTENT_SAFETY_ENDPOINT"], credential=DefaultAzureCredential() ) ``` ## Analyze Text ```python from azure.ai.contentsafety import ContentSafetyClient from azure.ai.contentsafety.models import AnalyzeTextOptions, TextCategory from azure.core.credentials import AzureKeyCredential client = ContentSafetyClient(endpoint, AzureKeyCredential(key)) request = AnalyzeTextOptions(text="Your text content to analyze") response = client.analyze_text(request) # Check each category for category in [TextCategory.HATE, TextCategory.SELF_HARM, TextCategory.SEXUAL, TextCategory.VIOLENCE]: result = next((r for r in response.categories_analysis ...

Details

Author
sickn33
Repository
sickn33/antigravity-awesome-skills
Created
4 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category