I didn't even imagine building a Chatbot, however simple it is, is so easy. Thanks Tim for opening up my mind.
So it's not a conversation, every time it's just a prompt and a response, because the chat doesn't remember previous posts. So I added a few lines of code to upgrade this: " import openai openai.api_key = "paste your key" def chat_with_gpt(chat_log): response = openai.ChatCompletion.create(model='gpt-3.5-turbo', messages=chat_log ) return response.choices[0].message.content.strip() chat_log = [] # Remembering more posts is more expensive n_remembered_post = 2 if _name_ == "__main__": while True: user_input = input("You: ") if user_input.lower() in ['quit', "exit", "bye"]: break chat_log.append({'role': 'user', 'content': user_input}) if len(chat_log) > n_remembered_post: del chat_log[:len(chat_log)-n_remembered_post] response = chat_with_gpt(chat_log) print("Chatbot:", response) chat_log.append({'role': "assistant", 'content': response}) "
As beginner who has been struggling with different methods of having a user exit a program or loop, and having used various ways of doing so, I really loved the idea of defining options in a list like that. It might be super obvious now that I have seen it, but what a great little snippet of code - I am definitly bringing it with me going forwards.
Thanks for breaking it down in under 4 minutes. This tutorial is incredibly helpful!
WE NEED TO PAY MANNNNNN, SAY THIS IS NOT FREE FROM THE BEGINNING
Love this! Would love to see more in-depth vids about function calling, deployment and chatbot use-cases for businesses. Keep it up!
You gotta love it when only outdated youtube tutorials are your only source of doing something and the creator never says it outdated
But this requires a paid plan. Probably worth mentioning.
I've searched for stuff like this when I've discovered chatGPT and thinking that I can improve my virtual assistant. Now I can give my virtual assistant some new neurons to provide some information directly. Thanks a lot!!
Thank you very much for this video. It will make my work much easier. I am making a script that will take your voice, convert it to text, run it through ChatGPT, and then throw it into Text To Speech.
Hello, I have a problem because I have the key but it shows me that I have exceeded my current amount of available resources on OpenAI and I haven't even used it. Is it possible to have this without providing a credit card?
I really enjoyed this. Iām just starting to learn about coding and this was a nice simple video about what you could do quickly with coding ā¤
This was awesome I would love to see some content about deploying the ai's on different platforms
Really appreciate this video! The only problem I ran into is that the chatbot doesn't remember the context of the conversation. Its like creating a new chat every time you input something
Great tutorial! After downgrading open ai's package version to be compatible with the code and updating the model it worked flawlessly.
Why I get an exceeded quota limit if I have got just errors? Moreover it seemd ChatCompletion doesn't exist and I should turn back to openai version o.28. How I sort it?
Once you build this chatbot, how to make it accessible to everyone as an application, just like ChatGPT?
amazing video Tim, you always create the best and most useful python content online! Thank you so much! can you please make the same video but based on 2024. because now its not free, and you could be the first one to show us how to make this tech in 2024!!
Yooo dude this is sick š
@TechWithTim