Posted on Leave a comment

ChatGPT — A Revolution

 December 28, 2022

Author(s): Vikas Solegaonkar

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!

Link

Posted on Leave a comment

Demanding identity systems on our terms

There is a growing push towards identity systems around the world – leading to some of the world’s largest biometric databases, as well as other technologies that can be used to track and profile individuals and communities.

There is a growing push towards identity systems around the world. There is a growth in both the requirement for us to identify ourselves and the development of identity systems to do so. This has led to some of the world’s largest biometric databases, as well as other technologies that can be used to track and profile individuals and communities. Despite this growth, the challenge to the autonomy and dignity of individuals that come from identity systems is rarely fully addressed. There is a need to understand the lived reality of those who both have and do not have access to these systems, to understand their true impact.

What is the problem

More and more states are pushing for identity systems – often involving giant biometric databases of almost the entire population. These systems are supposed to solve a multitude of problems, from security and fraud-prevention, to meeting the Know Your Customer requirements of financial institutions. However, the challenges of these systems have only just begun to be addressed.

Identity systems create risks for those who have access to an ID, as well as those who don’t. These systems can exclude: for all the claims fo universality, there will be some people who do not have access to an ID, or those who cannot use their ID, and are denied access to goods and services. ID systems can exploit: they link together diverse sets of information about an individual, and allow tracking and profiling. ID systems can surveil: giving the state and private sector a 360-degree view of the person. All three of these are made worse by function creep – the spread of an identity system to more and more aspects of people’s lives.

What is the solution

The first step is recognising that identification systems are not the silver bullet for society’s ills. The creation of identification systems have begun to be seen as an end in themselves, rather than as a tool for achieving other socially-desirable goals. The notion that there must be a ‘foundational’ ID system, lying beneath all an individual’s interactions with the state, needs to be challenged. The only way that a system can be legitimate is through its purpose. That purpose must be reflected in the design of a system. The danger is that the world is defaulting to biometric systems with unique identifiers, which leaves the systems open to abuse and causing harm. 

One of the most important solutions is to find ways of removing ID requirements. At the very least, having one single identification system necessary for all purposes must be challenged.  When a system is to be introduced, we need a proper legal and regulatory framework in place, including a strong data protection regime. But this is not a enough. The fact that ID touches on so many aspects of people’s lives means that the protections must be equally as broad: from the financial sector to the rights of trans people.  It’s also essential to limit function creep as much as possible, through legal and technological means.  Finally, we need more transparency in what is often a murky world of back-room deals between governments and multinational companies.

What PI is doing

Privacy International is working with a global network of partners to critically engage with national, state-provided identification systems, research their impacts, and to advocate for change.

We are engaging with international actors who promote identity systems, including leading funders in this field and international institutions, with the goal of creating a more positive vision for the development of identification systems around the globe.

We are documenting and exposing the companies involved in providing tech solutions to governments and other third parties with the aim of creating a future free from intrusive technologies.

Link

Posted on Leave a comment

Understanding Identity Systems – Part 3: The Risks of ID

  • Biometrics are the physiological and behavioural characteristics of individuals. This could be fingerprints, voice, face, retina and iris patterns, hand geometry, gait or DNA profiles. However, the legal definition of ‘biometrics’ may differ – in some contexts, it may be defined by law, whereas in others it may not have, or only have a vague, legal definition.
  • Biometrics used in ID systems are most commonly facial photographs, fingerprints, and iris scans.
  • If data like photographs are collected in the enrolment or data collection of an ID scheme, even if it is not immediately used for purposes like facial recognition, the existence of the dataset means that it can be used for such in the future, as in the case of India adding facial recognition to its biometric systems.

Read on

Posted on Leave a comment

Identity Systems – Part 2: Discrimination and Identity.

Here is the second part on Identity Systems.

  • Every country has an existing landscape of ways in which people can identify themselves. This can include an existing ID card system, but also a range from birth registration, to passports, to driver licenses. The effectiveness of these systems may be unevenly distributed, or otherwise problematic.
  • The nature of the existing ID landscape varies greatly from place-to-place. For example, in India, the number of existing forms of documentation for identity is massive, compared to a country such as Kenya where many lack documentation.
  • Similarly, it’s important to recognise that the spread of factors like birth registration across a country might be uneven. This could have consequences, for example, in making it hard for certain groups to gain access to a new ID.

    Read on in our Knowledge Base (Wiki): Part 2: Discrimination and Identity.