The logic in the content filter is such that the openai content filter is always called even if use_content_filter is false (and then is disregarded). I think a better logic would be:
if not use_content_filter:
response_safe = True
else:
response_safe = OpenAIGPT3LanguageModel.content_safe(completion_text)
if not response_safe:
print(f"Completion flagged unsafe: {completion_text}")
logging.info(f"Completion flagged unsafe: {completion_text}")
The logic in the content filter is such that the openai content filter is always called even if
use_content_filteris false (and then is disregarded). I think a better logic would be: