OpenAI GPT-4 Python ChatBot Code

preview_player
Показать описание
#gpt4 #gpt4api #gpt3 #chatbot #chatgptapi #pythonchatbot #gpt4python #gptpython #openai #openaichat
The video contains GPT-4 OpenAI API-based Python coding for a Chatbot.

I just received access to GPT-4 models via the existing OpenAI API. GPT-4 API is cool, but the responses are quite slow compared to GPT-3.5. I was expecting that Image input will be available with this release of GPT-4, but image input is yet to come in future.

The video shows how we can use GPT-4 for a ChatBot written in Python programming language.

You might recall from one of my previous videos where I wrote a Python program using the GPT 3.5 Turbo model, using which someone could repeatedly query OpenAI and get answers.

That is excellent. Note again, I used the gpt-3.5-turbo model in the previous code. After I receieved the access to OpenAI GPT-4 model, all I have to do is -- change the parameter called model to "gpt-4". That's it, my program now speaks with OpenAI using the GPT 4 model.

The response time received from OpenAI is longer with GPT-4 compared to gpt-3.5. However, the responses from the gpt-4 model are cooler and more accurate.

I should mention that this API Key will not work anymore because, by the time I will upload this video, I have removed this api key from my OpenAI account. You will need to use your own OpenAI API here. In an earlier video, I demonstrated how you can get an API-key from OpenAI.

Ideally, a programmer should not directly write the API key in the code. Rather the API-key should be written somewhere else, such as, it can be written in a file, and this program should read the API key from that file. Or, the key can be written in a database and the program should use some authentication to access the API key from the database.

Anyway, for this Python program, it does not matter much because it is just a prototype written for educational purposes.

One drawback of the program is that the conversations are lost once the program terminates, and you close the terminal or the command prompt. In the next video, I will show you how to save the Chat history automatically in a text file from this program so that the conversation exchanges are not lost.

Other relevant videos are in this playlist:

Happy learning!

Dr. Shahriar Hossain

#PythonOpenAI
Рекомендации по теме
Комментарии
Автор

What Was your wait time to get The Access?

pedrocavaglieri
visit shbcf.ru