Implement computer vision solutions 3.3 Implement responsible AI for multimodal content
An image generation app sometimes gets an error with code contentFilter and the message…
Study guide skill: Implement filters to classify unsafe or disallowed visual content
Question B5-003
An image generation app sometimes gets an error with code contentFilter and the message "Generated image was filtered as a result of our safety system." Users say their prompts are harmless. What does this error indicate?
Select one answer.
Answer: B
Azure applies both input and output moderation to image generation, and a flagged prompt or image returns the contentFilter error code. This specific message means the generated image was filtered, whereas a flagged prompt returns the message 'Your task failed as a result of our safety system' instead. Rate limits show up as HTTP 429 and a missing role as HTTP 401, not as contentFilter.
Deep dive
How it works
The image APIs come with a content moderation filter that can act at two moments, and the error message tells you which one fired. In both cases the error code is contentFilter:
- Prompt filtered: if the service recognizes the prompt as harmful, it doesn't generate an image. The message is "Your task failed as a result of our safety system."
- Output filtered: the prompt was accepted and an image was generated, but the generated image itself was filtered. The message is "Generated image was filtered as a result of our safety system."
So this app's prompts passed, and the images they produced were blocked. That's consistent with users saying their prompts are harmless. Practical next steps: log which message you get, rephrase prompts that tend to produce borderline images, and if a legitimate use case keeps getting blocked, review the deployment's content filter configuration.
The other options, and when you'd use them
- Missing Cognitive Services OpenAI User role: Authentication and authorization failures come back as errors such as 401 Unauthorized, not as a contentFilter error with a safety message.
- The prompt was flagged by input moderation: That case has a different message: "Your task failed as a result of our safety system."
- The deployment exceeded its rate limit: Rate limiting shows up as 429 Too Many Requests, with retry and backoff as the fix.
Exam tip
contentFilter + "Generated image was filtered" = output moderation blocked the image. contentFilter + "Your task failed" = the prompt was blocked.
References
Last reviewed: