Skip to content

Commit

Permalink
Remove moderation inside message handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Flagro committed Nov 7, 2024
1 parent f9347c0 commit a436815
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
6 changes: 0 additions & 6 deletions bot/rp_bot/ai_agent/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,6 @@ async def generate_image(self, prompt: str) -> str:
def count_tokens(text: str) -> int:
return tiktoken.count(text)

async def is_content_acceptable(self, text: str) -> bool:
# TODO: implement this
# r = await openai.Moderation.acreate(input=text)
# return not all(r.results[0].categories.values())
return True

@staticmethod
def compose_messages_langchain(
openai_formatted_messages: List[Dict[str, str]]
Expand Down
11 changes: 0 additions & 11 deletions bot/rp_bot/messages/message_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,6 @@ async def get_response(
prompt = await self.get_prompt_from_transcribed_message(
person, context, transcribed_message
)
if not self.ai.is_content_acceptable(prompt):
return CommandResponse(
text="content_not_acceptable",
kwargs={"user_handle": person.user_handle},
)
system_prompt = self.prompt_manager.get_reply_system_prompt(context)
response_message = await self.ai.get_reply(prompt, system_prompt)
result = CommandResponse(
Expand All @@ -187,12 +182,6 @@ async def stream_get_response(
prompt = await self.get_prompt_from_transcribed_message(
person, context, transcribed_message
)
if not self.ai.is_content_acceptable(prompt):
return CommandResponse(
text="content_not_acceptable",
kwargs={"user_handle": person.user_handle},
)

response_message = ""
system_prompt = self.prompt_manager.get_reply_system_prompt(context)
async for response_message_chunk in self.ai.get_streaming_reply(
Expand Down

0 comments on commit a436815

Please sign in to comment.