Sanitize Prompt for DALL-E Generations

Hello community,

I am generating prompts for products being uploaded to my service for sale. The products can be simple text files or PDFs.

The intended prompt is along the lines of:

album cover, epic design, for a product with the text of "<insert text content of product>"

However, I get the following issue:

(Link edited by moderator)

Is there a way to sanitize the prompt so that it’s compliant with the safety policy? Seems like this should be standard somehow, and it’s a little surprising to see an error thrown rather than helping the user out by automatically taking out the offensive material.

Thank you for any assistance you can provide,

1 Like

The other interesting aspect of note is that the following content triggers this error:

Yo yeahhhhhhhhar

This is the content of a test txt file I am using to create the prompt. :blush:

So if that can trigger the policy then I am already worried about any other content that can be used by others.

The reason this can trigger is that if you put in nonsense, there’s no telling what you might get out of the LLM. :wink:

Are you running them against the moderation endpoint? It’s not 100% as they use different moderation systems, but it’s a good start.

Do you have other examples of when it’s failing?


+1 I would suggest the moderation endpoint as well that way you (1) head these off early usually and (2) don’t waste tokens on more expensive output.


Thank you @PaulBellow and @suspicious_cow for your guidance! :pray:

Believe it or not @PaulBellow I rather like this. :grinning: I have used this with great success with Midjourney which is where I got the idea from.

Do you have other examples of when it’s failing?

Not yet, but the fact that it can fail once (or at all, in this regard) is enough for me put the breaks on this for now and to find workarounds.

I would suggest the moderation endpoint as well

I will look into this this, then. FWIW I am using AzureAI so I am not sure if this is available there.

My current workaround is to simply use album cover, epic design as the prompt, which seems to be OK. I’d like to “train” it on the content it’s designing the cover for, but this will do for a v1 push. :+1:

1 Like

Maybe have a vision model “look” at the pdf or whatever and have it translated hopefully to safe language?

That’s the thing, though. DALLE3 generates prompts from what you write, and sometimes if what you write is valid, it will self-insert no-no words to get it to fail…