Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Guidance for building and deploying AI solutions on Azure using Azure AI services and Copilot for Azure
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/sdk/azure-ai-contentsafety-java.md
1# Azure AI Content Safety — Java SDK Quick Reference23> Condensed from **azure-ai-contentsafety-java**. Full patterns (blocklist management, image moderation, 8-severity)4> in the **azure-ai-contentsafety-java** plugin skill if installed.56## Install7```xml8<dependency>9<groupId>com.azure</groupId>10<artifactId>azure-ai-contentsafety</artifactId>11<version>1.1.0-beta.1</version>12</dependency>13```1415## Quick Start16```java17import com.azure.ai.contentsafety.ContentSafetyClient;18import com.azure.ai.contentsafety.ContentSafetyClientBuilder;19import com.azure.ai.contentsafety.BlocklistClient;20import com.azure.ai.contentsafety.BlocklistClientBuilder;21ContentSafetyClient client = new ContentSafetyClientBuilder()22.endpoint(endpoint).credential(credential).buildClient();23```2425## Non-Obvious Patterns26- Two separate builders: `ContentSafetyClientBuilder` and `BlocklistClientBuilder`27- Image from file: `new ContentSafetyImageData().setContent(BinaryData.fromBytes(bytes))`28- Image from URL: `new ContentSafetyImageData().setBlobUrl(url)`29- Blocklist create uses raw `BinaryData` + `RequestOptions` (not typed model)3031## Best Practices321. Blocklist changes take ~5 minutes to take effect332. Only request needed categories to reduce latency343. Typically block severity >= 4 for strict moderation354. Process multiple items in parallel for throughput365. Cache blocklist results where appropriate37