What does it do?
This feature adds a new mode to Shappie called the "Socratic Method" mode. When activated, Shappie will analyze messages for logical fallacies and respond with Socratic questions to encourage critical thinking. The bot will take on a Socratic persona, emulating the questioning style of the philosopher Socrates.
What does it look like?
When a user in the Discord channel activates the Socratic Method mode (e.g., by typing a command like !socratic, BS, or bullshit), Shappie will start analyzing messages in the conversation. If it detects a logical fallacy in a message, it will respond with a question or statement in the style of Socrates, guiding the user to think critically about what they've said.
Example:
User: "Everyone I know hates this, so it must be bad!"
Shappie: "You used an Appeal to Popularity fallacy. Just because something is popular or unpopular does not necessarily make it good or bad. Can you provide more concrete evidence to support your claim?"
How do you know it's done?
The feature is done when:
Shappie can be put into a Socratic Method mode through a command or keyword.
While in this mode, Shappie detects logical fallacies in messages.
Shappie responds with Socratic questions that are relevant to the detected fallacies.
Shappie has a persona that emulates Socrates in this mode.
There is proper error handling and rate limiting to ensure stability.
The feature has been tested in various scenarios for accuracy and reliability.
I've provide some foundational code below. Hopefully, you find it helpful:
import requests
import random
class Mode:
def __init__(self, name):
self.name = name
class Persona:
def __init__(self, name, description):
self.name = name
self.description = description
class Message:
def __init__(self, content):
self.content = content
class SocraticMethodTool:
def __init__(self):
self.OPENAI_API_KEY = 'YOUR_OPENAI_API_KEY'
self.fallacy_explanations = {
"Ad Hominem": {
"explanation": "This is when an argument is directed at a person rather than the position they are maintaining.",
"socratic_question": "Can you provide evidence that addresses the argument instead of the individual?"
},
"Slippery Slope": {
"explanation": "This is an assertion that a particular event will trigger a series of catastrophic events, without evidence.",
"socratic_question": "What evidence is there that these consequences will happen as a direct result of the initial action?"
},
"Appeal to Authority": {
"explanation": "Appeal to Authority involves using the opinion of an authority figure as evidence, without critically evaluating the quality of the argument.",
"socratic_question": "Is the authority figure cited an expert in the relevant field? Are there other experts who hold different opinions?"
},
"Hasty Generalization": {
"explanation": "Hasty Generalization involves making a broad conclusion based on a small or unrepresentative sample size.",
"socratic_question": "Is the sample size used to make the generalization representative and sufficiently large?"
},
"Circular Reasoning": {
"explanation": "Circular Reasoning involves using the conclusion of an argument as a premise within the same argument.",
"socratic_question": "Can the argument be supported without relying on its own conclusion as evidence?"
},
"Red Herring": {
"explanation": "Red Herring involves introducing irrelevant information into an argument in an attempt to distract from the real issue.",
"socratic_question": "How is the information you provided relevant to the argument at hand?"
},
"Straw Man": {
"explanation": "Straw Man involves misrepresenting someone's argument to make it easier to attack.",
"socratic_question": "Have you accurately represented the other person's argument? Can you address their actual position?"
},
"False Dilemma": {
"explanation": "False Dilemma involves presenting two options as if they are the only possibilities, when in fact there may be other options.",
"socratic_question": "Are there other options or possibilities that have not been considered?"
},
"Appeal to Ignorance": {
"explanation": "Appeal to Ignorance involves asserting that something must be true because it has not been proven false, or vice versa.",
"socratic_question": "Is there evidence to support the claim, or is the argument relying on a lack of evidence to the contrary?"
},
"Bandwagon Fallacy": {
"explanation": "Bandwagon Fallacy involves accepting an argument as true simply because it is popular.",
"socratic_question": "Is the popularity of an idea necessarily indicative of its validity? Are there logical reasons to support the claim?"
},
"Tu Quoque": {
"explanation": "Tu Quoque involves accusing someone of hypocrisy as a way to dismiss their argument, rather than addressing the argument itself.",
"socratic_question": "Even if someone is being hypocritical, does that necessarily invalidate their argument?"
},
"Genetic Fallacy": {
"explanation": "Genetic Fallacy involves judging something as good or bad based on where it comes from, or from whom it comes.",
"socratic_question": "Is the origin of the information the only factor that determines its validity?"
},
"Black-or-White Fallacy": {
"explanation": "Black-or-White Fallacy involves presenting two options as if they are the only possibilities, when in fact there may be other options. This is similar to False Dilemma.",
"socratic_question": "Are there other options or possibilities that have not been considered?"
},
"Begging the Question": {
"explanation": "Begging the Question involves making an argument that assumes the conclusion as one of the premises, making it circular.",
"socratic_question": "Can the argument be supported without assuming the conclusion is true?"
},
"Appeal to Emotion": {
"explanation": "Appeal to Emotion involves manipulating emotions in order to win an argument, especially in the absence of factual evidence.",
"socratic_question": "What factual evidence supports the argument, aside from emotional appeals?"
},
"Gambler’s Fallacy": {
"explanation": "Gambler’s Fallacy involves believing that past events can influence the probability of future events in random processes.",
"socratic_question": "Is there a logical reason to believe that past events should affect the likelihood of what will happen in the future in this case?"
},
"Composition Fallacy": {
"explanation": "Composition Fallacy involves assuming that what is true for a part is also true for the whole.",
"socratic_question": "Is it necessarily the case that what applies to the part must apply to the whole?"
},
"Division Fallacy": {
"explanation": "Division Fallacy involves assuming that what is true for the whole is also true for the parts.",
"socratic_question": "Is it necessarily the case that what applies to the whole must apply to each part?"
},
"No True Scotsman": {
"explanation": "No True Scotsman involves making an appeal to purity as a way to dismiss relevant criticisms or flaws in an argument.",
"socratic_question": "Is the definition being used to exclude counterexamples too narrow or unrealistic?"
},
"Post Hoc Ergo Propter Hoc": {
"explanation": "Post Hoc Ergo Propter Hoc involves claiming that because one event happened after another, the first event caused the second.",
"socratic_question": "Is there evidence to support the claim that the first event caused the second, beyond just the order in which they occurred?"
}
}
def detect_fallacies(self, statement):
response = requests.post(
'https://api.openai.com/v1/engines/davinci-codex/completions',
headers={'Authorization': f'Bearer {self.OPENAI_API_KEY}'},
json={
'prompt': f'Analyze the following statement for logical fallacies: "{statement}"\n\nAnalysis:',
'max_tokens': 100
}
)
analysis = response.json()['choices'][0]['text']
fallacies = list(self.fallacy_explanations.keys())
detected_fallacies = [fallacy for fallacy in fallacies if fallacy.lower() in analysis.lower()]
return detected_fallacies
def ask_socratic_question(self, fallacy):
info = self.fallacy_explanations.get(fallacy, {"explanation": "Unknown fallacy", "socratic_question": ""})
return f"You used a {fallacy} fallacy. {info['explanation']} {info['socratic_question']}"
class ShappieBot:
def __init__(self):
self.mode = None
self.persona = None
self.socratic_tool = SocraticMethodTool()
def set_mode(self, mode):
self.mode = mode
def set_persona(self, persona):
self.persona = persona
def respond_to_message(self, message):
if self.mode and self.mode.name == "Socratic Method":
fallacies = self.socratic_tool.detect_fallacies(message.content)
responses = [self.socratic_tool.ask_socratic_question(fallacy) for fallacy in fallacies]
return responses
else:
pass
# Example usage
shappie = ShappieBot()
socratic_mode = Mode(name="Socratic Method")
shappie.set_mode(socratic_mode)
socrates_persona = Persona(name="Socrates", description="Wise and inquisitive, asking probing questions.")
shappie.set_persona(socrates_persona)
message = Message(content="You are wrong because you are not an expert.")
responses = shappie.respond_to_message(message)
for response in responses:
print(response)
What does it do? This feature adds a new mode to Shappie called the "Socratic Method" mode. When activated, Shappie will analyze messages for logical fallacies and respond with Socratic questions to encourage critical thinking. The bot will take on a Socratic persona, emulating the questioning style of the philosopher Socrates.
What does it look like? When a user in the Discord channel activates the Socratic Method mode (e.g., by typing a command like !socratic, BS, or bullshit), Shappie will start analyzing messages in the conversation. If it detects a logical fallacy in a message, it will respond with a question or statement in the style of Socrates, guiding the user to think critically about what they've said.
Example:
How do you know it's done? The feature is done when:
I've provide some foundational code below. Hopefully, you find it helpful: