gpt-3.5-turbo-0613· OpenAI
Arena Human Preference 55K
Write a python script for a simple chatbot.
- User
Write a python script for a simple chatbot.
- Assistant
Sure! Here's a simple Python script for a chatbot:
import random # List of possible user inputs and corresponding bot responses responses = { "hello": ["Hello!", "Hi there!", "Hey!"], "how are you": ["I'm good, thanks!", "I'm doing great!", "All good!"], "goodbye": ["Goodbye!", "See you later!", "Take care!"], "default": ["Sorry, I don't understand.", "Can you please rephrase?", "I'm still learning!"] } # Function to generate a random response from the bot def get_response(input_text): # Convert user input to lowercase input_text = input_text.lower() # Check if user input matches any key in the responses dictionary if input_text in responses: return random.choice(responses[input_text]) else: return random.choice(responses["default"]) # Main function for running the chatbot def main(): print("Bot: Hello! How can I help you today?") while True: # Get user input user_input = input("User: ") # Check if user wants to exit if user_input == "exit": print("Bot: Goodbye!") break # Get bot response bot_response = get_response(user_input) # Print bot response print("Bot:", bot_response) # Run the chatbot if __name__ == "__main__": main()
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.