LLM Skills
~/catalog/cloud & sdks//SKILL
Cloud & SDKsGitHub source

Azure ai content safety java

/SKILL

Build content moderation applications using the Azure AI Content SafetySDKe for Java.

sickn33sickn33
45.0k
May 22, 2026
MIT License
// skill content

--- name: azure-ai-contentsafety-java description: "Build content moderation applications using the Azure AI Content Safety SDK for Java." risk: unknown source: community date_added: "2026-02-27" --- # Azure AI Content Safety SDK for Java Build content moderation applications using the Azure AI Content Safety SDK for Java. ## Installation ``xml <dependency> <groupId>com.azure</groupId> <artifactId>azure-ai-contentsafety</artifactId> <version>1.1.0-beta.1</version> </dependency> ` ## Client Creation ### With API Key `java import com.azure.ai.contentsafety.ContentSafetyClient; import com.azure.ai.contentsafety.ContentSafetyClientBuilder; import com.azure.ai.contentsafety.BlocklistClient; import com.azure.ai.contentsafety.BlocklistClientBuilder; import com.azure.core.credential.KeyCredential; String endpoint = System.getenv("CONTENT_SAFETY_ENDPOINT"); String key = System.getenv("CONTENT_SAFETY_KEY"); ContentSafetyClient contentSafetyClient = new ContentSafetyClientBuilder() .credential(new KeyCredential(key)) .endpoint(endpoint) .buildClient(); BlocklistClient blocklistClient = new BlocklistClientBuilder() .credential(new KeyCredential(key)) .endpoint(endpoint) .buildClient(); ` ### With DefaultAzureCredential `java import com.azure.identity.DefaultAzureCredentialBuilder; ContentSafetyClient client = new ContentSafetyClientBuilder() .credential(new DefaultAzureCredentialBuilder().build()) .endpoint(endpoint) .buildClient(); ` ## Key Concepts ### Harm Categories | Category | Description | |----------|-------------| | Hate | Discriminatory language based on identity groups | | Sexual | Sexual content, relationships, acts | | Violence | Physical harm, weapons, injury | | Self-harm | Self-injury, suicide-related content | ### Severity Levels - Text: 0-7 scale (default outputs 0, 2, 4, 6) - Image: 0, 2, 4, 6 (trimmed scale) ## Core Patterns ### Analyze Text `java import com.azure.ai.contentsafety.models.*; AnalyzeTextResult result = contentSafetyClient.analyzeText( new AnalyzeTextOptions("This is text to analyze")); for (TextCategoriesAnalysis category : result.getCategoriesAnalysis()) { System.out.printf("Category: %s, Severity: %d%n", category.getCategory(), category.getSeverity()); } ` ### Analyze Text with Options `java AnalyzeTextOptions options = new AnalyzeTextOptions("Text to analyze") .setCategories(Arrays.asList( TextCategory.HATE, TextCategory.VIOLENCE)) .setOutputType(AnalyzeTextOutputType.EIGHT_SEVERITY_LEVELS); AnalyzeTextResult result = contentSafetyClient.analyzeText(options); ` ### Analyze Text with Blocklist `java AnalyzeTextOptions options = new AnalyzeTextOptions("I h*te you and want to k*ll you") .setBlocklistNames(Arrays.asList("my-blocklist")) .setHaltOnBlocklistHit(true); AnalyzeTextResult result = contentSafetyClient.analyzeText(options); if (result.getBlocklistsMatch() != null) { for (TextBlocklistMatch match : result.getBlocklistsMatch()) { System.out.printf("Blocklist: %s, Item: %s, Text: %s%n", match.getBlocklistName(), match.getBlocklistItemId(), match.getBlocklistItemText()); } } ` ### Analyze Image `java import com.azure.ai.contentsafety.models.*; import com.azure.core.util.BinaryData; import java.nio.file.Files; import java.nio.file.Paths; // From file byte[] imageBytes = Files.readAllBytes(Paths.get("image.png")); ContentSafetyImageData imageData = new ContentSafetyImageData() .setContent(BinaryData.fromBytes(imageBytes)); AnalyzeImageResult result = contentSafetyClient.analyzeImage( new AnalyzeImageOptions(imageData)); for (ImageCategoriesAnalysis category : result.getCategoriesAnalysis()) { System.out.printf("Category: %s, Severity: %d%n", category.getCategory(), category.getSeverity()); } ` ### Analyze Image from URL `java ContentSafetyImageData imageData = new ContentSafetyImageData() .setBlobUrl("https://example.com/image.jpg"); AnalyzeImageResult result = contentSafetyClient.analyzeImage( new AnalyzeImageOptions(imageData)); `` ## Blockl

// original public source
sickn33/antigravity-awesome-skills
/skills/azure-ai-contentsafety-java/SKILL.md
License: MIT License
Independent project, not affiliated with Anthropic. This skill remains the property of its original author.
// install this skill
Paste this command in your terminal at the root of your project:
mkdir -p .claude/commands && curl -o ".claude/commands/SKILL.md" "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/skills/azure-ai-contentsafety-java/SKILL.md"
Then in Claude Code, type /SKILL to activate it.
open_in_newOpen original source
// save
Save available after sign in.
loginSign in to save
// information
Creatorsickn33
Stars 45.0k
CategoryCloud & SDKs
LicenseMIT License
UpdatedMay 22, 2026
Format.md
AccessFree
// similar

Skills Cloud & SDKs

View allarrow_forward