Skip to content

Commit

Permalink
openai: dump flagged response
Browse files Browse the repository at this point in the history
  • Loading branch information
ProducerMatt committed Sep 19, 2023
1 parent 7974820 commit 54f6487
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import openai
from openai import Moderation
import discord
import json # moderation response dump

openai.api_key = openai_api_key
start_sequence = "\nA:"
Expand Down Expand Up @@ -84,6 +85,7 @@ def is_text_risky(self, text: str) -> bool:

if len(violated_categories) > 0:
self.log.warning(self.class_name, msg=f"Prompt violated these categories: {violated_categories}")
self.log.info(self.class_name, msg=f"OpenAI moderation response: {json.dumps(response)}"
return True
else:
self.log.info(self.class_name, msg=f"Prompt looks clean")
Expand Down

0 comments on commit 54f6487

Please sign in to comment.