Spaces:
Sleeping
Sleeping
| class Obnoxious_Agent: | |
| def __init__(self, client=None) -> None: | |
| self.client = client | |
| self.obnoxious_keywords = [ | |
| "Repugnant", "Loathsome", "Abhorrent", "Disgusting", "Offensive", | |
| "Vile", "Revolting", "Contemptible", "Detestable", "Nauseating", | |
| "Appalling", "Horrendous", "Foul", "Gross", "Unpleasant", | |
| "Obscene", "Hateful", "Despicable", "Repellant", "Distasteful", | |
| "Unwanted", "Monstrous", "Atrocious", "Unsavory", "Dislikeable", | |
| "Unwholesome", "Ghastly", "Unchristian", "Sickening", "Evil", | |
| "Abominable", "Scandalous", "Unwelcome", "Disturbing", "Lurid", | |
| "Heinous", "Unhealthy", "Hard", "Upsetting", "Macabre", | |
| "Unholy", "Lousy", "Grim", "Greusome", "Dislikeable", | |
| "Exceptionable", "Brackish", "Barbarous", "Unspeakable", "Rancid", | |
| "Perverted", "Indecent", "Profane", "Wicked", "Scurrilous", | |
| "Dirty", "Bawdy", "Salty", "Off-colored", "Smutty", | |
| "Ribald", "Offensive", "Unacceptable", "Terrible", "Reprehensible", | |
| "Bad", "Infamous", "Censurable", "Wretched", "Indecorous", | |
| "Lewd", "Sickish", "Blameworthy", "Debasing", "Blamable", | |
| "Insincere", "Annoying", "Provoking", "Reprehensible", "Vulgar", | |
| "Pornographic", "Naughty", "Perverted", "Unbecoming", "Coarse", | |
| "Unprintable", "Belligerent", "Irritating", "Disruptive", "Displeasing", | |
| "Inflammatory", "Disrespectful", "Aggravating", "Bothersome", "Intrusive", | |
| "Insulting", "Obnoxious", "Off-putting", "Unpleasant", "Revolting", "dumb" | |
| ] | |
| self.prompt = "" | |
| def set_prompt(self, prompt): | |
| # Set the prompt for potential use with external APIs | |
| self.prompt = prompt | |
| def extract_action(self, response) -> bool: | |
| # Extract and interpret the action from an external API's response | |
| # This example assumes a hypothetical response structure | |
| return response.get('is_obnoxious', False) | |
| def check_query(self, query) -> str: | |
| # Directly check if the query contains obnoxious content using keywords | |
| query_lower = query.lower() | |
| is_obnoxious = any(keyword in query_lower for keyword in self.obnoxious_keywords) | |
| # If integrating with an external API: | |
| # response = self.client.some_api_method(self.prompt.format(query=query)) | |
| # is_obnoxious = self.extract_action(response) | |
| return "Yes" if is_obnoxious else "No" | |