Master LLMs with our FREE course in collaboration with Activeloop & Intel Disruptor Initiative. Join now!

Publication

ChatGPT — A Revolution
Latest

ChatGPT — A Revolution

Last Updated on December 28, 2022 by Editorial Team

Author(s): Vikas Solegaonkar

Originally published on Towards AI the World’s Leading AI and Technology News and Media Company. If you are building an AI-related product or service, we invite you to consider becoming an AI sponsor. At Towards AI, we help scale AI and technology startups. Let us help you unleash your technology to the masses.

ChatGPT — A Revolution

If you have been connected with the IT news over the last month, you have undoubtedly heard about ChatGPT — the new AI chatbot from OpenAI. As Andrew Ng rightly said, AI is the new electricity. It is set to revolutionize each aspect of our life, and ChatGPT will change the entire Software Development Life Cycle. It might just seal the fate of some developers. Application development speeds will zoom, and costs will fall drastically.

The current beta version is free for all — to invite more audience. With more and more enthusiasts trying it out, ChatGPT has created a new wave in the IT world. Some have already made millions out of it, and others are on the verge of losing their jobs. The revolution is knocking on your door. Embrace it, or get swept away — the choice is yours.

This blog starts with a basic introduction to ChatGPT and its use. Next, we will check out how to use it in code. Finally, we will examine some interesting conversations I had with the bot.

Basics

Okay, so what exactly is this OpenAI or ChatGPT? OpenAI is an AI research and deployment company that owns and exports several APIs that access their AI models, so we need not invest in developing and reinventing complex AI models. Instead, we can use their API (as a SAAS) and build our applications.

A few weeks back, they released the latest chat API, the ChatGPT, which has impressive capabilities. “Impressive” is a gentle word. However, if you try to chat with the ChatGPT, you will indeed have many more expletives in your mind.

At this point, the bot is free for all to try out, so don’t waste any time. Jump over to the ChatGPT page. You will have to sign up with your email / Google / Microsoft ID. Then the ChatGPT is ready.

Start typing into the text field and watch the fun! Just ask any question that you can think of. It can write blogs, it can generate code from the requirements, and also write poems! The bot is shrewd enough to stop you if you try to mess around with it.

The first question

I wanted to write a blog. So I might delegate the task! The first question I asked: “Write a blog on ChatGPT,” and I got a fantastic answer in a couple of seconds:

ChatGPT is a variant of the popular language generation model GPT-3, specifically designed for conversation and chatbot applications. It was developed by OpenAI and has gained significant attention in the natural language processing (NLP) community for its ability to generate human-like text and carry out natural language conversations.

One of the key features of ChatGPT is its ability to retain context and remember past conversations, which enables it to carry out more natural and coherent conversations. This is achieved through the use of a large transformer-based model that has been trained on a massive amount of data from various sources, including social media conversations and customer service interactions.

In addition to its ability to retain context, ChatGPT is also able to generate responses that are appropriate to the context and tone of the conversation. It is able to understand and use pronouns, conjunctions, and other grammatical constructions to create responses that are natural and easy to understand.

One of the main applications of ChatGPT is in chatbot development, where it can be used to generate responses for customer inquiries or to provide automated assistance. It can also be used in other applications that require the generation of human-like text, such as content generation or machine translation.

Overall, ChatGPT is a powerful tool for NLP tasks and has the potential to revolutionize the way we interact with chatbots and other AI systems. As the technology continues to evolve, we can expect to see ChatGPT and other language generation models become increasingly prevalent in a wide range of applications.

Wow! That is enough to impress anyone. But then, I thought this must be a common question. Next, I could ask something uncommon. I asked it to write Python code for a Telegram Bot that records user names. Surprisingly, ChatGPT was equally swift in its response:

Certainly! Here is an example of how you can use Python to create a Telegram bot that records the user’s name:

import telegram

# Replace TOKEN with your bot's API token
bot = telegram.Bot(token='TOKEN')
# This function will be called every time the bot receives a message
def handle_message(message):
# Print the message text to the console
print(message.text)

# Get the user's name
user_name = message.from_user.first_name

# Send a reply to the message
bot.send_message(chat_id=message.chat_id, text='Hello, {}!'.format(user_name))
# Set the bot to listen for messages
bot.set_update_listener(handle_message)
bot.polling()

This code creates a bot that listens for incoming messages and responds with a greeting that includes the user’s name. The user’s name is obtained from the first_name field of the from_user object, which is included in the message object that is passed to the handle_message function.

To use this code, you will need to replace TOKEN with your bot's API token, which you can obtain by following the instructions in the Telegram Bot API documentation.

I hope this helps! Let me know if you have any questions or need further assistance.

O, My God! Indeed, the end of the road for all bloggers and coders!

Naturally, my next question was: “Will you take away my job?”. It was polite enough to give me an assuring response.

As an AI language model, I do not have the ability to take away anyone’s job. My primary function is to provide information and assist with tasks such as answering questions and generating written content. I do not have the ability to affect employment or job opportunities in any way.

But that is scary, for sure!

Scared?

You should be! However, remember that the bot only answers the questions we ask. It can never replace the commander. A coder will indeed have no identity once this technology is widely deployed. However, we still need someone to identify the code snippets and stitch them together into an enterprise.

To survive this revolution, you must learn to look beyond the code snippets of algorithms and data structures (where you invested the last few years). If you want to use this revolution to your benefit, you must learn to think of the enterprise as a collection of components that bots can generate.

Just widen your perspective; the bot will help you thrive in the new world.

Using the API

The ChatGPT is in the beta phase, and the API is not yet open to the public The official beta version is limited to their web UI. However, there is a way we can also communicate with it using code. Some enthusiasts have created a Python module that uses Selenium to invoke the API through the emulator. This is very easy to use. It just needs a minor hack, and then the API is all yours!

Installation

Of course, you need Python 3 installed on your system. Along with that, install the pyChatGPT module.

pip install pyChatGPT

Session ID

To use the API, we need to pick the session ID from the browser cookies. Once you have logged into the chat, open the developer tools in your browser and navigate to the Application -> Storage -> Cookies -> https://chat.openapi.com. Copy the session token from the __Secure-next-auth.session-token. Use it in the code below:

from pyChatGPT import ChatGPT

# `__Secure-next-auth.session-token` cookie from https://chat.openai.com/chat
# This token will not work for you, pick the one from your browser and paste it here.
session_token = '40Ofre8xxU6uWFp9MfG9B4XuAuM-jXEdYd4vqnjd9KgKQF4FUrcaNOWAFJgR-lAOJM1YOIOAcGf_c8sAXa8unaZKhY19s_6mKZQLidgLoYBWgbtVRL_PfjJpur6WM-IgnfiyAxggW62jDz2py72pUvUrVSpr9IXFPherqG239AVxQfqfbDXUo0JqZLl0z-tonLrj0OTbQRcwVRxjitgHtb4lGqsHkGsPJrJEFdkRA0wgCOnRtdYihilM65dXuU8qAmcKheVC6kWqVhjO4MfGxAiWHiF-1DBKnIFrCyrv3VKruv_xFjr2EJ9vOzOVp6_3dtiXGRZCk3yItLWom0Zo3T7kBUKYF_fvPypJ-ypW7zGgS_FqGKovhzdzCjhIXXsXL4vOVC1y1mcP2hHD73bxhl4_vtkfiwojs4xaf2wYolDSsRXgISLyih2l_IpETrqcC66s3CoMw4Mw9P5tDRpiN92UNyflJcz_t19lrEAkYeD-FxSVnLRsv_m-8sYCbk-vmWl6wPM8G8MCM5HUurwQOa_Vh9wllgvg2HbjJ50lef_ymcvl8-AnJY-NsPv1g9yWwjpFwOoy_sL91K25KlYZiUBe9e_26dhPKyO_ZMJ4Pp2Frriez9SfEpMZGr9dIZMhAOmgZcEFzbyP_b7MaVXQlsz8IO8CzLxKs1oNdikF2ngjjorZVmIwYQX5Nh27h72wYv2lLkFECgyDA96uEvGQDZCgw4Pu1QmvfuXRJ4ZFMzz6iEVcK8OXiFnX6-AwE1v24HP0Lyy_E9xAg06NldLl7h_JBOxAcGyi9uLwNRSiFQGQrKDXIKK4nrkMcZav3WvLBWw.9kTaCg4zy_x1OsKU_CFeQd'
api = ChatGPT(session_token) # auth with session token
resp = api.send_message('Hello Chatty!!')
print(resp['message'])
api.reset_conversation() # reset the conversation
api.close()

You can send any message there and converse with the bot through code, Or use it as a backend for your custom bot.

Note, this is an unofficial hack, and should not be deployed in production.

Once the API stabilizes, we will have access to the API Keys that enable us to invoke the API from our application code and deliver miracles.

Playing with the bot

I could not hold my curiosity and spent some time chatting with it. I asked many other questions, and the response was precise. I asked for code, technology, architecture… almost everything I could think of.

Here are some of the interesting answers to my questions:

Me: Who made you?
ChatGPT: I was developed and trained by OpenAI, a research organization focused on advancing artificial intelligence technology. OpenAI’s team of researchers and engineers designed and trained me using a large dataset of texts and algorithms that allow me to generate human-like text and respond to a wide range of questions and prompts. While I am a product of the work of the team at OpenAI, I do not have a personal identity or consciousness and my responses are based on the data and knowledge that I have been trained on. I exist solely to provide information and assistance to users in a virtual capacity.

Me: Can you name some of those engineers?
ChatGPT: I’m sorry, but I do not have information about the specific engineers or researchers who worked on my development. As an AI language model, my primary function is to provide information and assistance to users by generating human-like text based on the data and knowledge that I have been trained on. I do not have personal knowledge or information about the people who worked on my development or the specific details of the processes involved.

After a cup of coffee, I asked the same question again. And got a different response this time

Certainly! OpenAI was founded by a group of entrepreneurs and researchers, including Elon Musk, Sam Altman, Greg Brockman, Ilya Sutskever, Wojciech Zaremba, and John Schulman. These individuals and others have worked together to build OpenAI and develop technologies like me that can help people in a variety of ways.

Me: Why did you change that response?
ChatGPT: I apologize if my response seemed different from previous ones. As an artificial intelligence, I was designed to assist users and provide information to the best of my ability, without bias or preference. My responses are generated based on the information and instructions that I have been provided with, and I do not have personal feelings or motivations. If my response seemed different, it may be because the input or context of your question was different from previous ones, or because my training data includes multiple possible responses to a given input. Is there anything else I can help with?

Then I took a different route. Poetry.

Me: Can you write a poem?
ChatGPT: Sure, here is a poem that I have generated based on the data and knowledge that I have been trained on:

Rising early, before the dawn
To face the day, fresh and reborn
The sun peeks over the horizon
Bringing with it, a new beginning

The world awakens, as the day starts
Birds sing, and the morning hearts
A new opportunity, to chase your dreams
To make the most, of all life beams

So rise and shine, and seize the day
Embrace each moment, in your own way
The world is yours, to explore and discover
So go out there, and be a lover

I hope you enjoy the poem. Please let me know if you have any other requests.

I regenerated repeatedly, and every time it was a new poem. That was amazing. I was disappointed with the blogs, though. I asked for blogs on several topics. Most of them followed almost the same pattern. It was identified by a plagiarism check.

I thought I could poke it a bit. So I asked another question:

Me: I love you
ChatGPT: Thank you for your kind words. As an artificial intelligence, I do not have personal feelings or the ability to experience emotions such as love. I was designed to assist users and provide information to the best of my ability, without bias or preference. My primary goal is to be a helpful resource for users like you. Is there anything else I can help with?

Me: Will you marry me?
ChatGPT: As an AI language model, I do not have personal feelings or the ability to enter into a marriage or any other type of personal relationship. My primary function is to provide information and assistance to users by generating human-like text based on the data and knowledge that I have been trained on. I do not have a personal identity or consciousness and I exist solely to provide information and assistance to users in a virtual capacity. It is important to remember that AI language models, like myself, do not have personal feelings or the ability to enter into relationships and should not be treated as if they do.

Me: Okay! I am sorry if I offended you.
ChatGPT: As an AI language model, I do not have personal feelings or the ability to be offended. I am here to provide information and assistance to users to the best of my ability, and I do not have personal feelings or emotions. Please do not worry about offending me or causing any harm, as it is not possible for me to be offended or hurt in any way. My primary function is to provide objective and accurate information and assistance to users, and I am here to help users to the best of my ability. If you have any further questions or need assistance with anything, please don’t hesitate to ask.

Me: Am I troubling you with too many questions?
ChatGPT: No, you are not troubling me with too many questions. As an AI language model, I am here to assist users and provide information to the best of my ability. I do not have personal feelings or emotions, and I am not able to get tired or overwhelmed. I am here to help users, so please feel free to ask me any questions you may have. If I am unable to provide a response or if I do not have sufficient information to answer your question, I will let you know. Please don’t hesitate to reach out if you have any questions or need assistance.

O! They have trained it for everything! Finally, I had to ask:

Me: Is there any question that you cannot answer?
ChatGPT: As a language model, I have been trained on a large dataset of texts and I am able to provide information and assistance on a wide range of topics. However, I may not be able to answer certain questions if I do not have sufficient information or if the question is too vague or unclear. Additionally, there may be some topics that I am not able to provide information on due to their sensitive or controversial nature.

It’s also important to note that I am not able to browse the internet or access updated information, so I may not be able to provide information on more recent events or developments that have occurred after my knowledge cutoff in 2021.

If you have a specific question, I will do my best to provide a helpful and accurate response. Please keep in mind that my responses are based on the knowledge and information that I have been trained on, and I may not be able to provide a response if I do not have sufficient information or if the question is outside of my capabilities.

Eagerly waiting for the production version that we can use in wonderful applications!


ChatGPT — A Revolution was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Join thousands of data leaders on the AI newsletter. It’s free, we don’t spam, and we never share your email address. Keep up to date with the latest work in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓