← ClaudeAtlas

azure-ai-contentsafety-pylisted

Azure AI Content Safety SDK for Python. Use for detecting harmful content in text and images with multi-severity classification. Triggers: "azure-ai-contentsafety", "ContentSafetyClient", "content moderation", "harmful content", "text analysis", "image analysis".
aiskillstore/marketplace · ★ 329 · AI & Automation · score 82
Install: claude install-skill aiskillstore/marketplace
# 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