From 54f64875e2bd3d1c9d62555126a9898e10aa6d94 Mon Sep 17 00:00:00 2001 From: Producer Matt <58014742+ProducerMatt@users.noreply.github.com> Date: Tue, 19 Sep 2023 14:50:37 -0500 Subject: [PATCH] openai: dump flagged response --- api/openai.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/openai.py b/api/openai.py index 5e4b8ab..a598f32 100644 --- a/api/openai.py +++ b/api/openai.py @@ -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:" @@ -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")