#Is it possible to ban words?
10 messages · Page 1 of 1 (latest)
Include in your prompt "If the input contains <nono words>, then say "Invalid input" or something like that
You have to do it yourself
var bannedWords = ["word", "word", "word"]
The use that to filter the user input
That's if you are using JavaScript!
I’m using Python, but it should work the same in Python, right?
I guess I could filter the AI so it can’t submit if it contains a bad word, but I want it to still post, just without the bad words. That not possible?
banned_words = ['banned', 'banned1', 'banned2']
input_string = 'This is a banned word'
Check if any of the banned words are present in the string
has_banned_word = any(word in input_string.lower() for word in banned_words)
Returns True
Check out the openai moderations endpoint
An API for accessing new AI models developed by OpenAI
It can detect profanity and whatnot fairly accurately