Here is the code for a friendly AI bot that I made. How does the code look? Do you have any tips for me?
The code looks great! I personally don't see any problems with it.
It looks fine, I do not see anything wrong with it
do you have any tips
looks good
Its good, you should slide the tutorial though.
...
There's nothing wrong with this code, It's very well put together and it's a pretty good code, but the AI bot could have more responses you know? Maybe have it sound more friendly. You could have the bot say after someone finishes asking the AI bot finishes explaining the bot could say, "Well please have a nice day and please reach out if you .e help with anything else." It's just a suggestion though, you don't have to take it. I hope I could help a bit.
This bot should have a few more responses, other than just to the prompts "hi" and "thanks". If possible, you should try using the API of an AI (this is just a suggestion though, and may not yield the best possible results, therefore making your AI somewhat harmful).
what type of codng are u doing
Take this to DMs lmao
I wouldn’t consider this as “AI”, but it definitely is an input-based bot response. Still good either way though. As others said, definitely more than just one or two responses. Maybe use an array with a list of responses and randomly choose between those. ```python import random inputs = [ # inputs[0] ["hi", "hello", "hi there", "howdy", "hey",], # inputs[1] ["thanks", "thank you", "appreciated",] ] responses = [ # responses[0] ["Hi there! How can I help you today?", "Hello, how can I help?",], # responses[1] ["You’re welcome! Anything else you need help with?", "No problem! Need anything else?",] ] # fail response if input isn’t found fail_res = "I’m sorry, I didn’t understand what you said. Could you please rephrase that?" # Base example for getting inputs “hi” # “hello” etc and returning a random # response from responses[0] response = fail_res for inp in inputs[0]: if message.lower() == inp: # Get a random response from responses[0] response = random.choice(responses[0]) ```
You will need to implement Flask and the post responses into that code snippet, but that’s just an example of available usage in your script.
looks fine 2 me.
Join our real-time social learning platform and learn together with your friends!