[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FCWRP2J27G01FB0J20MMNW":3,"skill-same:01M6FCWRP2J27G01FB0J20MMNW":49},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":22,"linkOnly":23,"markdownContent":24,"markdownBody":24,"frontMatter":25,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M6FCWRP2J27G01FB0J20MMNW","azure-ai-contentsafety-java",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",66,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fmicrosoft\u002Fskills\u002Fazure-ai-contentsafety-java\u002FSKILL.md",[],[18,19,20,21],"azure ai","azure","azure ai contentsafety java","java","2026-11-10 10:12:30",false,"# Azure AI Content Safety SDK for Java\n\nBuild content moderation applications using the Azure AI Content Safety SDK for Java.\n\n## Installation\n\n```xml\n\u003Cdependency>\n    \u003CgroupId>com.azure\u003C\u002FgroupId>\n    \u003CartifactId>azure-ai-contentsafety\u003C\u002FartifactId>\n    \u003Cversion>1.1.0-beta.1\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\n## Client Creation\n\n### With API Key\n\n```java\nimport com.azure.ai.contentsafety.ContentSafetyClient;\nimport com.azure.ai.contentsafety.ContentSafetyClientBuilder;\nimport com.azure.ai.contentsafety.BlocklistClient;\nimport com.azure.ai.contentsafety.BlocklistClientBuilder;\nimport com.azure.core.credential.KeyCredential;\n\nString endpoint = System.getenv(\"CONTENT_SAFETY_ENDPOINT\");\nString key = System.getenv(\"CONTENT_SAFETY_KEY\");\n\nContentSafetyClient contentSafetyClient = new ContentSafetyClientBuilder()\n    .credential(new KeyCredential(key))\n    .endpoint(endpoint)\n    .buildClient();\n\nBlocklistClient blocklistClient = new BlocklistClientBuilder()\n    .credential(new KeyCredential(key))\n    .endpoint(endpoint)\n    .buildClient();\n```\n\n### With DefaultAzureCredential\n\n```java\nimport com.azure.identity.DefaultAzureCredentialBuilder;\n\nContentSafetyClient client = new ContentSafetyClientBuilder()\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .endpoint(endpoint)\n    .buildClient();\n```\n\n## Key Concepts\n\n### Harm Categories\n| Category | Description |\n|----------|-------------|\n| Hate | Discriminatory language based on identity groups |\n| Sexual | Sexual content, relationships, acts |\n| Violence | Physical harm, weapons, injury |\n| Self-harm | Self-injury, suicide-related content |\n\n### Severity Levels\n- Text: 0-7 scale (default outputs 0, 2, 4, 6)\n- Image: 0, 2, 4, 6 (trimmed scale)\n\n## Core Patterns\n\n### Analyze Text\n\n```java\nimport com.azure.ai.contentsafety.models.*;\n\nAnalyzeTextResult result = contentSafetyClient.analyzeText(\n    new AnalyzeTextOptions(\"This is text to analyze\"));\n\nfor (TextCategoriesAnalysis category : result.getCategoriesAnalysis()) {\n    System.out.printf(\"Category: %s, Severity: %d%n\",\n        category.getCategory(),\n        category.getSeverity());\n}\n```\n\n### Analyze Text with Options\n\n```java\nAnalyzeTextOptions options = new AnalyzeTextOptions(\"Text to analyze\")\n    .setCategories(Arrays.asList(\n        TextCategory.HATE,\n        TextCategory.VIOLENCE))\n    .setOutputType(AnalyzeTextOutputType.EIGHT_SEVERITY_LEVELS);\n\nAnalyzeTextResult result = contentSafetyClient.analyzeText(options);\n```\n\n### Analyze Text with Blocklist\n\n```java\nAnalyzeTextOptions options = new AnalyzeTextOptions(\"I h*te you and want to k*ll you\")\n    .setBlocklistNames(Arrays.asList(\"my-blocklist\"))\n    .setHaltOnBlocklistHit(true);\n\nAnalyzeTextResult result = contentSafetyClient.analyzeText(options);\n\nif (result.getBlocklistsMatch() != null) {\n    for (TextBlocklistMatch match : result.getBlocklistsMatch()) {\n        System.out.printf(\"Blocklist: %s, Item: %s, Text: %s%n\",\n            match.getBlocklistName(),\n            match.getBlocklistItemId(),\n            match.getBlocklistItemText());\n    }\n}\n```\n\n### Analyze Image\n\n```java\nimport com.azure.ai.contentsafety.models.*;\nimport com.azure.core.util.BinaryData;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\n\u002F\u002F From file\nbyte[] imageBytes = Files.readAllBytes(Paths.get(\"image.png\"));\nContentSafetyImageData imageData = new ContentSafetyImageData()\n    .setContent(BinaryData.fromBytes(imageBytes));\n\nAnalyzeImageResult result = contentSafetyClient.analyzeImage(\n    new AnalyzeImageOptions(imageData));\n\nfor (ImageCategoriesAnalysis category : result.getCategoriesAnalysis()) {\n    System.out.printf(\"Category: %s, Severity: %d%n\",\n        category.getCategory(),\n        category.getSeverity());\n}\n```\n\n### Analyze Image from URL\n\n```java\nContentSafetyImageData imageData = new ContentSafetyImageData()\n    .setBlobUrl(\"https:\u002F\u002Fexample.com\u002Fimage.jpg\");\n\nAnalyzeImageResult result = contentSafetyClient.analyzeImage(\n    new AnalyzeImageOptions(imageData));\n```\n\n## Blocklist Management\n\n### Create or Update Blocklist\n\n```java\nimport com.azure.core.http.rest.RequestOptions;\nimport com.azure.core.http.rest.Response;\nimport com.azure.core.util.BinaryData;\nimport java.util.Map;\n\nMap\u003CString, String> description = Map.of(\"description\", \"Custom blocklist\");\nBinaryData resource = BinaryData.fromObject(description);\n\nResponse\u003CBinaryData> response = blocklistClient.createOrUpdateTextBlocklistWithResponse(\n    \"my-blocklist\", resource, new RequestOptions());\n\nif (response.getStatusCode() == 201) {\n    System.out.println(\"Blocklist created\");\n} else if (response.getStatusCode() == 200) {\n    System.out.println(\"Blocklist updated\");\n}\n```\n\n### Add Block Items\n\n```java\nimport com.azure.ai.contentsafety.models.*;\nimport java.util.Arrays;\n\nList\u003CTextBlocklistItem> items = Arrays.asList(\n    new TextBlocklistItem(\"badword1\").setDescription(\"Offensive term\"),\n    new TextBlocklistItem(\"badword2\").setDescription(\"Another term\")\n);\n\nAddOrUpdateTextBlocklistItemsResult result = blocklistClient.addOrUpdateBlocklistItems(\n    \"my-blocklist\",\n    new AddOrUpdateTextBlocklistItemsOptions(items));\n\nfor (TextBlocklistItem item : result.getBlocklistItems()) {\n    System.out.printf(\"Added: %s (ID: %s)%n\",\n        item.getText(),\n        item.getBlocklistItemId());\n}\n```\n\n### List Blocklists\n\n```java\nPagedIterable\u003CTextBlocklist> blocklists = blocklistClient.listTextBlocklists();\n\nfor (TextBlocklist blocklist : blocklists) {\n    System.out.printf(\"Blocklist: %s, Description: %s%n\",\n        blocklist.getName(),\n        blocklist.getDescription());\n}\n```\n\n### Get Blocklist\n\n```java\nTextBlocklist blocklist = blocklistClient.getTextBlocklist(\"my-blocklist\");\nSystem.out.println(\"Name: \" + blocklist.getName());\n```\n\n### List Block Items\n\n```java\nPagedIterable\u003CTextBlocklistItem> items = \n    blocklistClient.listTextBlocklistItems(\"my-blocklist\");\n\nfor (TextBlocklistItem item : items) {\n    System.out.printf(\"ID: %s, Text: %s%n\",\n        item.getBlocklistItemId(),\n        item.getText());\n}\n```\n\n### Remove Block Items\n\n```java\nList\u003CString> itemIds = Arrays.asList(\"item-id-1\", \"item-id-2\");\n\nblocklistClient.removeBlocklistItems(\n    \"my-blocklist\",\n    new RemoveTextBlocklistItemsOptions(itemIds));\n```\n\n### Delete Blocklist\n\n```java\nblocklistClient.deleteTextBlocklist(\"my-blocklist\");\n```\n\n## Error Handling\n\n```java\nimport com.azure.core.exception.HttpResponseException;\n\ntry {\n    contentSafetyClient.analyzeText(new AnalyzeTextOptions(\"test\"));\n} catch (HttpResponseException e) {\n    System.out.println(\"Status: \" + e.getResponse().getStatusCode());\n    System.out.println(\"Error: \" + e.getMessage());\n    \u002F\u002F Common codes: InvalidRequestBody, ResourceNotFound, TooManyRequests\n}\n```\n\n## Environment Variables\n\n```bash\nCONTENT_SAFETY_ENDPOINT=https:\u002F\u002F\u003Cresource>.cognitiveservices.azure.com\u002F\nCONTENT_SAFETY_KEY=\u003Cyour-api-key>\n```\n\n## Best Practices\n\n1. **Blocklist Delay**: Changes take ~5 minutes to take effect\n2. **Category Selection**: Only request needed categories to reduce latency\n3. **Severity Thresholds**: Typically block severity >= 4 for strict moderation\n4. **Batch Processing**: Process multiple items in parallel for throughput\n5. **Caching**: Cache blocklist results where appropriate\n\n## Trigger Phrases\n\n- \"content safety Java\"\n- \"content moderation Azure\"\n- \"analyze text safety\"\n- \"image moderation Java\"\n- \"blocklist management\"\n- \"hate speech detection\"\n- \"harmful content filter\"\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fmicrosoft\u002Fskills\u002Fazure-ai-contentsafety-java",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill azure-ai-contentsafety-java",{"tool":41,"command":42},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill azure-ai-contentsafety-java",{"tool":44,"command":45},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill azure-ai-contentsafety-java","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fmicrosoft\u002Fskills\u002Fazure-ai-contentsafety-java\u002FSKILL.md",true,[],[50,64,74,83,89,96],{"skillNo":51,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":60,"publishedAt":22},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[55],{"categoryNo":56,"categoryName":57,"taxonomyType":58,"taxonomyTypeDesc":59},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[61,62,63],"model","model hierarchy","model hierarchy skill",{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":70,"publishedAt":22},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[69],{"categoryNo":56,"categoryName":57,"taxonomyType":58,"taxonomyTypeDesc":59},[71,72,73],"MCP","zoom","zoom mcp",{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":22},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[80,81,82,72],"sdk","zoom apps sdk","apps",{"skillNo":84,"name":85,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":22},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[85],{"skillNo":90,"name":91,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":95,"publishedAt":22},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[94],{"categoryNo":56,"categoryName":57,"taxonomyType":58,"taxonomyTypeDesc":59},[91],{"skillNo":97,"name":98,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":22},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[98]]