File size: 2,526 Bytes
2702698
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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"