You are on page 1of 30

MINI PROJECT

A report submitted in partial fulfilment of the requirements of the award of degree of

DIPLOMA IN COMPUTER ENGINEERING

Submitted by
P.HEMANTH REDDY
(20280-CM-046)
UNDER THE GUIDENCE OF

Dr.N.PENCHALAIAH,Ph.D

DEPARTMENT OF COMPUTER ENGINEERING


AUDISANKARA COLLEGE OF ENGINEERING &TECHNOLOGY
2nd SHIFT POLYTECHNIC, GUDUR
(Approved By ACITE, SBTET VIJYAWADA)
NH-5 ROAD, GUDUR-524101.
2020-2023

1
DEPARTMENT OF COMPUTER ENGINEERING
AUDISANKARA COLLEGE OF ENGINEERING & TECHNOLOGY

CERTIFICATE

This is to certify that the “MINI PROJECT” was submitted by P.HEMANTH REDDY
( 2 0 2 8 0 - C M - 0 4 6 ) is abonafide record of work done by him and submitted during
2021-2022 academic year, in partial fulfilment of the requirements for the award of the
degree of DIPLOMA IN COMPUTER ENGINEERING.

Signature of the Guide Signature of the H.O.D Signature of the principal

External Examiner

2
CHATGPT(MODEL)
submitted by
P.HEMANTH REDDY
(20280-CM-046)

UNDER THE GUIDENCE OF


Dr.N.PENCHALIAH,Ph.D

DEPARTMENT OF COMPUTER ENGINEERING

AUDISANKARA COLLEGE OF ENGINEERING&TECHNOLOGY

2nd SHIFT POLYTECHNIC, GUDUR,

(Approved By ACITE, SBTET GUNTUR)

NH-5 ROAD, GUDUR-524101.

2020-2023

3
DECLARATION

I hereby declare that the MINI PROJECT titled CHATGPT(MODEL) is my


own work, based on my personal study and/or research and that I have acknowledged all material and
sources used in its preparation, whether they be books, articles, reports, lecture notes, and any other kind
of document, electronic or personal communication. I also certify that this project has not previously been
submitted for assessment in any academic capacity, and that I have not copied in part or whole or
otherwise plagiarised the work of other persons.

I confirm that I have identified and declared all possible conflicts that I may have.

P.HEMANTH REDDY

20280-CM-046

4
ACKNOWLEDGEMENT

I Consider it our privilege to express our gratitude to all those who guided and inspired us in the
completion of this Project. We express our sincere thanks to our beloved Chairman
Dr.VANKI.PENCHALAIAH,Ph.D Garu for providing support and stimulating environment
for developing the project.
I am highly indebted to Director Dr.A.MOHAN ,Ph.D Garu for the facilities provided to
accomplish this internship.
I would like to Thank our Principal Dr.N.PENCHALAIAH,Ph.D for his constructive criticism
throughout my internship
I would like to Thank our Project Guide DR.N.PENCHALAIAH, Ph.D for her help throughout
my internship.
I would like to Thank our H.O.D Ms.K.NISHITHA, M.Tech for his constructive criticism
throughout my internship.
I would like to Thank the internship coordinator Dr.G.RAJESH for his support and advice to
complete the internship in Aacharya
I feel great to Thank Project Manager Dr.G.RAJESH sir who are our project guides and created
interest in us to work day and night for the project
I feel great to thank all the department TEACHING AND NON-TEACHING staff who helped us
for the successful completion of this internship.
I would like to thank my Family Members and friends who supported me throughout this journey for
completing the industrial training.

P.HEMANTH REDDY
20280-CM-046

5
CHATGPT(MODEL)

ABSTRACT

Name:P.HEMANTH REDDY Mail:hemanthreddypothala1@gmail.com


Pin no:20280-CM-046 Branch:CME

A Chatbot system is implemented to meet the requirements of the users. simulation / generating
response from a chatbot is whenever the user context is matched. When a user begins asking queries in
the chatbot GUI. the query is searched in the database. If the response is found in the database it is
displayed to the user or else the system notifies the admin about the missing response in the database and
gives a predefined response to the user.

A chatbot is an AI program that copy human discussions including content and communication in
natural language utilizing artificial intelligence method for example, Natural Language Processing is a
picture and video processing and voice analysis. chatbot for college management system has been created
utilizing AI algorithms that examine the user queries. This chatbot system is an internet application that
gives an answer to the broken down queries of a user.

Users simply need to choose the classification for inquiries and afterward they can ask the
question to the bot that utilizes for noting it. AI has been incorporated to respond to the users inquiries
then the user can procure the fitting solutions to their inquiries.

P.HEMANTH REDDY
20280-CM-046

6
INDEX

S.NO PAGE NO

1. INTRODUCTION………………………………………………………....8
2. PROBLEM SPECIFICATION OF CHAT GPT…………..………………9
3. NEED OF CHATGPT…………………………………………..…………9
4. SCOPE OF CHATGPT……………………………………………………10
5. BASIC FLOW PROCESS OF CHATGPT …………………..………..….10
6. DIFFERENCE BETWEEN CHATGPT AND CHATBOT…….................12
7. UNDERSTANDING OF CHATGPT …………………………………….12
8. CHATGPT VS SEARCH ENGINE …….………………………...………14
9. FEATURES OF CHATGPT ………………………………………………16
10. LIMITATIONS OF CHATGPT……………………………………..........16
11. IMPLICATIONS …………………………………………………….........17
12. REQUIREMENTS ……………………………………………………….18
13. HOW TO USE IT WITH PYTHON……………….……………………...19
14. IMPLEMENTATION OF CODE ………………………………………...23
15. ADVANTAGES AND DISADVANTAGES OF CHAT GPT ……….….25
16. PROJECT INFO AND OVERVIEW …………………………………….36
17. CONCLUSION…………………………………………………………....30

7
1.INTRODUCTION

ABOUT CHATGPT:
ChatGPT is an artificial intelligence (AI) chatbot developed by OpenAI and
released in November 2022. It is built on top of OpenAI's GPT-3.5 and GPT-4 foundational large
language models (LLMs) and has been fine-tuned (an approach to transfer learning) using both
supervised and reinforcement learning techniques.
You might have already used or heard about ChatGPT when you are reading
this. It is a chatbot language model developed by OpenAI. And from my personal experience, I was
quite amazed by many of its functionalities. It is a variant of the GPT-3 language model,
specifically designed for conversational language generation. ChatGPT is a natural language
processing tool driven by AI technology that allows you to have human-like conversations and
much more with the chatbot. The language model can answer questions and assist you with tasks,
such as composing emails, essays, and code.

ChatGPT, in full Chat Generative Pre-training Transformer, software that allows


a user to ask it questions using conversational, or natural, language. ChatGPT is capable of admitting its
mistakes, challenging incorrect premises, and rejecting requests considered inappropriate. The chatbot is
similar to another OpenAI model, InstructGPT, which is trained to follow instructions and provide a
detailed response.

WHAT IS THE USE OF CHATGPT?


People are learning how to use ChatGPT to ask it questions in search of funny answers, see how well it
can create content, improve their writing or Excel skills, find and correct a bug in code, or summarize a
book.
➢ GPT-based chat can be used to assist customer service representatives in responding to customer
inquiries quickly and accurately.
➢ It can be used to generate personalized messages for email marketing campaigns, based on customer
data and behavior.
➢ GPT chat can be used in language learning apps to provide users with conversational practice and
feedback.
➢ It can be used to create chatbots for virtual assistants, providing users with an intelligent and
engaging interface.
➢ GPT chat can be used in mental health apps to provide users with a supportive and understanding
conversation partner.
➢ It can be used to generate creative writing prompts for authors and writers.
➢ It can be used to provide real-time language translation in messaging apps, facilitating
communication between users who speak different languages.
➢ GPT chat can be used in gaming applications to create realistic and engaging non-playable
characters (NPCs).
➢ It can be used to generate personalized news and event updates in news and media apps, based
on user preferences and behavior.

8
2.PROBLEM SPECIFICATIONS OF CHAT GPT
The problem that ChatGPT aims to solve is the need for automated chat services that can
provide quick and efficient responses to customer inquiries, generate personalized messages, support
mental health, and provide conversational practice. By using GPT-based chat, individuals and businesses
can save time and resources by automating routine tasks and providing personalized experiences for their
customers and users.
➢ Language learning challenges: Language learners may struggle to find practice partners or may need
additional support outside of traditional language learning programs. ChatGPT can provide
conversational practice and feedback in a safe and non-judgmental environment.
➢ Mental health stigma: Mental health issues may be stigmatized in certain cultures or communities,
making it difficult for individuals to seek help. ChatGPT can provide a discreet and anonymous way
for individuals to access mental health support and guidance.
➢ Time-consuming content creation: Businesses may struggle to keep up with the demand for fresh and
engaging content. ChatGPT can generate social media posts, blog articles, and other types of content
based on user preferences and marketing goals.
➢ Language barriers in customer service: Customer service teams may struggle to communicate
effectively with customers who speak different languages. ChatGPT can facilitate language
translation to improve communication and customer satisfaction.
➢ Lack of conversational AI expertise: Businesses may lack the resources or expertise to develop
conversational AI solutions in-house. ChatGPT can be used to create chatbots and other
conversational AI solutions with minimal technical expertise required.

3.NEED OF CHATGPT

The need for ChatGPT arises from the increasing demand for efficient and personalized communication
experiences. With the growth of digital communication channels, customers expect prompt and
personalized responses to their inquiries, while businesses require scalable and cost-effective solutions to
address this demand.
ChatGPT addresses this need by providing a conversational AI solution that can understand and respond
to natural language input, generating personalized messages, and providing conversational practice and
support. It can also assist in automating routine tasks, such as customer support and content creation,
freeing up time and resources for businesses.
Additionally, ChatGPT can support mental health by providing a discreet and anonymous way for
individuals to access emotional support and guidance. Overall, ChatGPT serves as a tool for businesses
and individuals to enhance their communication experiences and achieve their goals in a more efficient
and personalized way.

• ChatGPT fulfills the need for personalized and efficient communication experiences, by generating
tailored messages and providing tailored support to users.
• ChatGPT addresses the need for cost-effective and scalable communication solutions, by automating
routine tasks and freeing up resources for businesses.

9
• ChatGPT meets the need for mental health support, by providing a discreet and anonymous platform
for individuals to access emotional support and guidance.

4.SCOPE OF CHAT GPT


ChatGPT-3 is a state-of-the-art natural language processing model developed by
OpenAI. It is capable of generating human-like responses to natural language inputs and can be used for a
variety of applications, including chatbots, question-answering systems, language translation, and more.
Using Python, weu can create your own ChatGPT-3 models for your specific use case.
The scope of your ChatGPT-3 project depends on your goals and requirements. You can train your model
on a specific set of data to generate responses tailored to your niche or use case. You can also fine-tune
existing models to improve their performance on specific tasks or domains.
In general, the scope of a ChatGPT-3 project using Python can range from creating a
simple chatbot to developing a sophisticated question-answering system for a specific domain. With the
right data and training, the possibilities are endless.
The scope of ChatGPT-3 using Python with images is vast and varied. With the help
of image recognition APIs, ChatGPT-3 can generate text descriptions of images. This can be useful in
various applications such as social media, e-commerce, and healthcare. For example, in e-commerce, the
chatbot can assist customers in finding products by providing them with image descriptions. In
healthcare, ChatGPT-3 can be used to generate text descriptions of medical images such as X-rays and
CT scans. The possibilities are endless, and the scope of the project can range from creating a simple
chatbot to developing a sophisticated question-answering system or an image description generator.

5.BASIC FLOW PROCESS OF CHATGPT


Here is a basic flow process for building a ChatGPT3 chatbot using Python:
1. Import the necessary libraries and dependencies, including the OpenAI API key, the requests library,
and any other modules you need.
2. Define your API key as a variable, and set up the necessary authorization headers.
3. Define a function that takes the user's input or message as an argument and sends it to the GPT-3 API
for processing.
4. In the function, specify the GPT-3 parameters you want to use, such as the language model,
temperature, max tokens, and stop words.
5. Use the requests library to send the API request with the user's input and parameters.
6. Parse the API response to extract the generated text or message.
7. Return the generated message to the user or display it in the chat interface.
8. Set up a loop or event listener to continuously prompt the user for input and call the API function to
generate a response.
9. Add any additional logic or functionality to the chatbot, such as handling specific user inputs or
integrating with other APIs or services.

10
10. Test the chatbot and refine as needed based on user feedback and performance.
This is just a basic overview of the flow diagram for building a ChatGPT3 chatbot using Python. The
specific implementation and structure of the chatbot will depend on the requirements of your use case and
the specific tools and libraries you are using.

THE DATA FLOW IN CHATGPT CAN BE DESCRIBED IN THE FOLLOWING


STEPS:
USER INPUT: The conversation starts when the user inputs a message or a question into the chatbot.
TEXT PREPROCESSING: The input text is preprocessed to clean and normalize the text data. This
may include removing special characters, converting to lowercase, and tokenization.
TEXT ENCODING: The preprocessed text is then encoded into a numerical representation that can be
understood by the neural network. This is typically done using techniques such as word embedding or
byte pair encoding.
NEURAL NETWORK PROCESSING: The encoded text is passed through the neural network, which
is a deep learning model that has been pre-trained on a large dataset. The model uses its pre-existing
knowledge to generate a response based on the input.
TEXT DECODING: The response generated by the neural network is in the form of numerical
representation, which needs to be decoded back into natural language.
RESPONSE GENERATION: The decoded response is then generated in the form of natural language
text that can be understood by the user.
OUTPUT: The generated response is presented to the user through the chatbot interface.
This process is repeated for every user input, creating a continuous conversation between the user and the
chatbot. The chatbot may also store user data, such as preferences or past interactions, to personalize the
conversation and provide more relevant responses.
In ChatGPT, data is fed into the neural network as input, which then generates a response based on the
patterns it has learned from the data it has been trained on. The data is typically preprocessed to remove
noise and convert it into a format that the model can understand, such as numerical vectors.
During training, the model uses a large dataset of text data to learn the patterns and relationships between
words, phrases, and sentences. This allows the model to understand the meaning of different types of text
and generate appropriate responses to user input.
During inference or prediction, when a user inputs text, the preprocessed input data is passed through the
neural network, which generates a response based on the learned patterns and relationships in the training
data. This response is then returned to the user as output.
Overall, the data flow in ChatGPT involves feeding input data into a neural network that has been trained
on a large dataset of text, and generating a response based on the patterns and relationships learned during
training.

11
6.DIFFERENCE BETWEEN CHATGPT AND CHATBOT
ChatGPT Chatbot
A language model that uses deep learning to A computer program designed to simulate
generate human-like text responses based on the conversation with human users, typically through
context of the input. text or voice interactions.
Can understand and generate responses based on Can only respond based on pre-programmed rules
the context of the input. or algorithms.
Limited by the pre-programmed rules and
Can be trained on a large amount of data to
algorithms, and may not always provide accurate
improve the quality of responses.
or relevant responses.
Can generate creative and original responses. Limited to the responses programmed into it.
Can be used for a wide range of applications,
Typically used for customer service and basic
including customer service, personal assistants,
information retrieval.
and language translation.
Requires advanced machine learning techniques Can be developed with basic programming
and expertise to develop and train. knowledge and tools.
Rule-based system that follows a pre-defined set AI model that generates responses based on
of instructions or decision trees machine learning algorithms
Limited to the specific rules programmed into it, Can generate natural and creative responses based
unable to improvise or respond creatively on context and previous messages
Often requires human intervention to improve and Can improve and learn on its own through
update its responses continuous training and exposure to new data
May not be able to understand complex language Can understand and respond to complex language
nuances or idioms nuances and idioms
Typically used for simple tasks such as customer Can be used for a wide range of tasks, from
service inquiries or basic information retrieval customer service to creative writing
May require more resources and expertise to
Generally less expensive and easier to implement
develop and implement

The main difference between chatbots and ChatGPT is that chatbots follow pre-defined
rules and have a limited range of responses, while ChatGPT uses machine learning to generate more
varied and natural responses, can self-improve and understand context, but is primarily used for
conversational purposes.

7.UNDERSTANDING OF CHATGPT
OpenAI's ChatGPT(Generative Pre-trained Transformer 3) is a state-of-the-art AI model that can generate
human-like text, answer questions, and even perform certain tasks. It is an advanced version of its
predecessor, GPT-2, which was released in 2019.

How Does ChatGPT-Work?

12
ChatGPT-3 is based on the transformer architecture, which is a deep learning model that
uses attention mechanisms to process sequential data such as text. The model is pre-trained on a massive
corpus of text data using unsupervised learning techniques, which means it is trained to learn patterns and
relationships in the data without explicit human supervision.
Once the model is pre-trained, it can be fine-tuned on specific tasks such as language
translation, text completion, and question-answering. This allows the model to adapt to the specific
requirements of the task and generate more accurate and relevant responses.

WHAT CAN YOU DO WITH CHATGPT?


ChatGPT-3 has a wide range of applications, some of which include the following

1. LANGUAGE TRANSLATION:
ChatGPT-3 can translate text from one language to another with a high degree of accuracy. This feature
can be useful for businesses that operate in multiple countries and need to communicate with customers in
different languages.

2. TEXT COMPLETION:
ChatGPT-3 can complete text based on a given prompt or context. This feature can be useful fr content
creators who need help generating ideas or filling in gaps in their writing.

3. QUESTION-ANSWERING:
ChatGPT-3 can answer questions based on a given context or knowledge base. This featurecan be useful
for customer service chatbots or virtual assistants that need to provide information to users.

4. CONTENT CREATION:
ChatGPT-3 can generate high-quality content such as articles, blog posts, and product descriptions. This
feature can be useful for businesses that need to create large amounts of content quickly and efficiently.
➢ Language learning can be enhanced by using ChatGPT as a language tutor, providing learners with
natural language conversations to improve their skills.
➢ Mental health support can be provided by ChatGPT through empathetic and understanding
conversation, offering support to those who need it.
➢ ChatGPT can also assist in data analysis, providing insights and predictions based on natural
language input.
➢ ChatGPT can be used for customer service, providing quick and efficient responses to customers'
inquiries and concerns.
➢ Email marketing can benefit from ChatGPT's ability to generate personalized and engaging
messages that resonate with the recipient.
➢ Assist with customer service by answering frequently asked questions and providing quick
responses to inquiries.
➢ Generate personalized messages based on user input, such as marketing or promotional content.
➢ Provide conversational practice for language learners or individuals with social communication
difficulties.
➢ Support mental health by providing a discreet and anonymous way for individuals to access
emotional support and guidance.
➢ Generate writing prompts for authors or content creators.
➢ Create social media content based on user input and preferences.

13
8.CHATGPT VS SEARCH ENGINE

HOW IS CHATGPT DIFFERENT FROM SEARCH ENGINES?


WHAT IS A SEARCH ENGINE:
A search engine is software accessible on the internet to assist the user in searching its query on
the world wide web. However, the search engine is useful and helpful as it carries out systematic searches
on the web and displays the results that match the best with a user’s query.
However, the results are retrieved from a list often called Search Engine Result Pages. Hence,
these results may be the link to articles, research papers, web pages, etc. Multiple search engines are
available, and Google is the most popular. All these search engines can search because of their faster web
crawler.

14
1. INTERACTIVE EXPERIENCE:
ChatGPT is engaged in conversation with a user, providing follow-up information and answering
more questions. In contrast, search engines give a one-time response to a user’s query.

2. WRITING ASSISTANCE:
ChatGPT assists you with writing assignments by giving coherent and grammatically perfect
sentences and paragraphs. Search engines will deliver the information but cannot generate written
content. It also helps the business to take content marketing it an advanced level.

3. HUMAN-LIKE RESPONSES:
ChatGPT is trained on the vast amount of text data and is giving human-like responses and will get
the understanding of idiomatic expressions and natural language. Search engines sometimes return
automatic or irrelevant responses.

4. UNDERSTANDING COMPLICATED QUERIES:


ChatGPT can understand difficult queries and give detailed responses. In comparison, search
engines may struggle with understanding complicated queries and will return the not accurate
answer.

5.LANGUAGE TRANSLATION:
ChatGPT can translate text from one language to another, making it useful for students who want to
learn a new language. Search engines give translation services but are not accurate or sophisticated
as ChatGPT.

6. GENERATE SUMMARIES:
ChatGPT will summarise the long text and make it useful for students to rapidly understand the
significant points of articles or books. In comparison, search engines do not possess this
functionality.

7. COMPLETE TEXT:
ChatGPT will finish the text dependent on the given context or prompt and help the students with
their writing assignments. On the other hand, search engines can not do this.

8. CORRECT THE BUGS:


ChatGPT will fix the issues with the grammar and help the students to improve their language
skills. Search engines are not capable of doing this task.

9. CUSTOMIZABLE:
ChatGPT is fine-tuned and trained, which suits particular needs and industries and makes it more
flexible and versatile than search engines.

15
10.PERSONALIZED RESPONSES:
ChatGPT uses natural language processing to know the context and intent of a user’s query, giving
personalized and accurate responses. On the other hand, search engines will return the list of
relevant websites dependent on keywords, leaving the user to shift through the information and find
what they require.
9.FEATURES OF CHATGPT

ChatGPT is a cutting-edge AI language model that offers a wide range of features. Some of its
features include:

1. Natural language processing: It can understand and generate human-like language text.
2. Multilingual support: ChatGPT can understand and generate text in multiple languages.
3. Personalization: It can learn from previous interactions and personalize responses.
4. Sentiment analysis: It can understand the sentiment of a piece of text and respond accordingly.
5. Contextual understanding: ChatGPT can understand the context of a conversation and respond
appropriately.
6. Summarization: It can summarize long pieces of text into shorter, more concise versions.
7. Question-answering: It can answer questions with accurate and relevant information.
8. Creative writing: It can generate creative and unique pieces of writing such as stories, poems, and
essays.
9. Task Completion: ChatGPT-3 can complete a wide range of tasks, such as scheduling
appointments, making reservations, and answering complex questions.
10.Contextual Understanding: ChatGPT-3 can understand and respond to user input based on the
context of the conversation, making it a more effective communication tool.
11.Human-like Responses: ChatGPT-3's advanced language models allow it to generate responses
that are similar to those of a human, providing a more natural and engaging conversation
experience.

10. LIMITATIONS OF CHATGPT

1. Based Responses: ChatGPT is trained on large datasets that may contain biased information,
which can result in biased responses.
2. Incoherent Responses: ChatGPT may generate incoherent or nonsensical responses, especially
when asked to generate creative content.
3. Lack of Common Sense: ChatGPT may lack common sense and may not be able to understand
certain concepts or situations.
4. Limited Knowledge: ChatGPT's knowledge is limited to what it has been trained on, which may
not include all relevant or up-to-date information.
5. Limited Understanding of Context: ChatGPT may struggle to understand the context of a
conversation, especially when there are multiple topics being discussed.
6. Limited Emotional Intelligence: ChatGPT may not be able to understand or respond
appropriately to emotions expressed by the user.
7. Lack of Personalization: ChatGPT's responses may not be personalized to the user's preferences
or history.

16
8. Limited Multilingual Support: ChatGPT's multilingual support is limited to the languages it has
been trained on.
9. Limited Ability to Learn: ChatGPT's ability to learn is limited to the data it has been trained on,
and it may struggle to adapt to new information.

11.IMPLICATIONS

IN CYBERSECURITY
Check Point Research and others noted that ChatGPT was capable of writing
phishing emails and malware, especially when combined with OpenAI Codex.[107]

IN ACADEMIA
ChatGPT can write introduction and abstract sections of scientific articles. Several
papers have already listed ChatGPT as a co-author. Scientific journals have different reactions to
ChatGPT, some "require that authors disclose use of text-generating tools and ban listing a large language
model (LLM) such as ChatGPT as a co-author". For example Nature and JAMA Network. Science
"completely banned" usage of LLM-generated text in all its journals.
Spanish chemist Rafael Luque published a paper every 37 hours in 2023, and
admitted using ChatGPT for it. His papers have a large number of unusual phrases, characteristic for
LLMs. Luque was suspended for 13 years from the University of Cordoba, though not for the use of
ChatGPT.
California high school teacher and author Daniel Herman wrote that ChatGPT would
usher in "the end of high school English". In the Nature journal, Chris Stokel-Walker pointed out that
teachers should be concerned about students using ChatGPT to outsource their writing, but that education
providers will adapt to enhance critical thinking or reasoning. Emma Bowman with NPR wrote of the
danger of students plagiarizing through an AI tool that may output biased or nonsensical text with an
authoritative tone.
Joanna Stern in The Wall Street Journal described cheating in American high school
English with the tool by submitting a generated essay.Professor Darren Hick of Furman University
described noticing ChatGPT's "style" in a paper submitted by a student. He suggested a policy of giving
an ad-hoc individual oral exam on the paper topic if a student is strongly suspected of submitting an AI-
generated paper.
The New York City Department of Education reportedly blocked access to ChatGPT
in December 2022 and officially announced a ban around January 4, 2023.
In a blinded test, ChatGPT was judged to have passed graduate-level exams at the
University of Minnesota at the level of a C+ student and at Wharton School of the University of
Pennsylvania with a B to B− grade. The performance of ChatGPT for computer programming of
numerical methods was assessed by a Stanford University student and faculty in March 2023 through a
variety of computational mathematics examples. Assessment psychologist Eka Roivainen administered a
partial IQ test to ChatGPT and estimated its Verbal IQ to be 155, which would put it in the top 0.1% of
test-takers.

17
Mathematician Terence Tao experimented with ChatGPT and found it useful in
daily work, writing "I am finding that while these AI tools do not directly assist me in core tasks such as
trying to attack an unsolved mathematical problem, they are quite useful for a wide variety of peripheral
(but still work-related) tasks (though often with some manual tweaking afterwards)."

IN MEDICINE
In the field of health care, possible uses and concerns are under scrutiny by
professional associations and practitioners. An April 2023 study published in JAMA Internal Medicine
found that ChatGPT often outperformed human doctors at answering patient questions. The study authors
suggest that the tool could be integrated with medical systems to help doctors draft responses to patient
questions.

IN LAW
On April 11, 2023, a judge of a session court in Pakistan used ChatGPT to decide the bail of a 13 year old
accused in a matter. The court quoted the use of ChatGPT assistance in its verdict:
"Can a juvenile suspect in Pakistan, who is 13 years old, be granted bail after arrest?"
The AI language model replied:
"Under the Juvenile Justice System Act 2018, according to section 12, the court can grant bail on certain
conditions. However, it is up to the court to decide whether or not a 13-year-old suspect will be granted
bail after arrest."
The judge further asked questions regarding the case from AI Chatbot and formulated his final decision in
the light of ChatGPT's answers.

12.REQUIREMENTS

SOFTWARE REQUIREMENTS:

To use ChatGPT in Python, you will need the following:


➢ Python environment: You will need to have a working Python environment installed on
your system, such as Anaconda or Python 3.
➢ OpenAI API key: You will need an API key to access the OpenAI GPT-3 API. You can
sign up for the API on the OpenAI website.
➢ OpenAI API client: You will need to install the OpenAI API client library for Python. You
can install it using pip with the following command: `pip install openai`
➢ Development IDE: You will need a development environment for Python, such as
PyCharm ,python IDLE or Jupyter Notebook, to create and run your ChatGPT scripts.
➢ Operating system: Atleast windows 10 or windows 11 and mac OS etc…

18
HARDWARE REQUIREMENTS:
The hardware requirements for running ChatGPT on a
laptop depend on the size and complexity of the models you are using, as well as the amount of data
you are processing. However, as a general rule, you will need a laptop with the following
specifications:

1. PROCESSOR: A modern multi-core processor, such as an ryzen 5,Intel i5 or i7, is


recommended for running ChatGPT. The more cores your processor has, the better.

2. MEMORY: ChatGPT requires a significant amount of memory to run effectively, so you will
need at least 4GB of RAM, and preferably 32 GB or more, depending on the size of the models you
are using.

3. STORAGE: ChatGPT also requires a large amount of storage, as the models can be several
gigabytes in size. You will need at least 256 GB of storage, and preferably 512 GB or more.

4. GPU: While not strictly required, a dedicated GPU, such as an NVIDIA GeForce or AMD
Radeon, can significantly speed up the processing of the models, especially for larger models.

Overall, the more powerful your laptop's hardware, the better performance you will get when using
ChatGPT. However, even with modest hardware, you can still use ChatGPT to generate
personalized messages, provide conversational practice, and support mental health, albeit with
slightly slower performance.

NOTE:During the execution of this project an internet connection is required for the device inorder to
run and show the desired results.

13.HOW TO USE IT WITH PYTHON

19
REGISTER OPENAI ACCOUNT:
To use ChatGPT with Python, first you need an OpenAI account, you can easily register one at
https://auth0.openai.com/

+
GENERATE API KEY:
API keys are used to authenticate and track API requests, and they help ensure that only authorized users
have access to the API.
➢ Once registered and login, you can generate an API key by going to “Personal” -> “View API keys”:

20
An API key is a unique code that is used to authenticate and identify a user of an API (Application
Programming Interface). APIs are used to allow different software applications to interact with each
other, and API keys are used to ensure that only authorized users can access the API. By providing an
API key, the user can access the API's functionality and data. API keys can also be used to track usage
and to enforce access limits. They are often used by developers who build software applications that need
to access data or services from other systems.

21
CREATE PYTHON CHATGPT PROJECT
Now you have the API key, next step is to create an ChatGPT project:

INSTALL OPENAPI PYTHON CLIENT LIBRARY:


The OpenAI Python library provides convenient access to the OpenAI API from applications written in
the Python language. It includes a pre-defined set of classes for API resources that initialize themselves
dynamically from API responses which makes it compatible with a wide range of versions of the OpenAI
API.

INSTALL OPENAI
Requirements
• Python 3.7.1+
• openai 0.27.0+

Now you have all the requirements,lets proceed much further to know more.

22
14. IMPLEMENTATION OF CODE
Now, we are implementing the code step by step for better understanding and these are the following
steps :

STEP-1: IMPORTING MODULE


After the installation of modules, we need to import the required modules into the program. along with
that, we need an OpenAI key.

STEP-2: CREATING A FUNCTION TO GENERATE A RESPONSE FROM


OPENAI GPT-3 MODEL
Before creating the response we must know the parameters to deal with it.and these parameters play a
vital role in our project

USING THE PARAMETERS IN PYTHON:


In the below example, more parameters are added to openai.ChatCompletion.create() to generate a
response. Here’s what each means:
The engine parameter specifies which language model to use (“text-davinci-002” is the most powerful
GPT-3 model at the time of writing)
➢ The prompt parameter is the text prompt to generate a response to
➢ The max_tokens parameter sets the maximum number of tokens (words) that the model should
generate
➢ The temperature parameter controls the level of randomness in the generated text
➢ The stop parameter can be used to specify one or more strings that should be used to indicate the
end of the generated text
➢ If you want to generate multiple responses, you can set n to the number of responses you want
returned
➢ The strip() method removes any leading and trailing spaces from the text.
➢ The presence_penalty and frequency_penalty parameter will control the API's preference for
repeating or avoiding certain words or phrases in the generated response.
These are just a few examples of the parameters that can be used with the GPT-3 API in Python. The
specific parameters and values you use will depend on the requirements of your chatbot and the
specific use case you are working on.

23
The generate_response the function used to take an input and returns a response
generated by the OpenAI GPT-3 model. The openai.Completion.create method is used to generate the
response.

STAGE-3: FUNCTION TO DISPLAY THE RESPONSE IN A GUI INTERFACE


In these stage we are creating a fuction called display_response in the graphical user-
interface.and also we are using the widgets.

The tkinter library is used to create the GUI interface. the window is created using the
tk.Tk() method and named as root. The root.title method use to sets the title of the window, and the
root.geometry method sets the size (width, height) of the window.
tk.Entry method use to create input, and a submit button is created using the tk.Button
method. The command parameter of the tk.Button the method is set to, which is the function that retrieves
the input text and displays the response.

24
An output field is created using the tk.Text method. The state='disabled' parameter
makes the output field read-only.
Finally, the root.mainloop() method starts the main loop of the GUI interface.

15. ADVANTAGES AND DISADVANTAGES OF CHAT GPT


ADVANTAGES:
1. Improved efficiency: Automating repetitive and time-consuming tasks can free up human employees
to focus on more important and value-adding activities. For example, using ChatGPT to handle
customer service inquiries can help businesses respond to customer needs more quickly and
effectively.
2. Reduced costs: Automation can help reduce labour costs, as well as improve accuracy and reduce
errors. This can be particularly beneficial for businesses operating in competitive industries.
3. Improved customer experience: With ChatGPT, companies can create more natural and human-like
interactions with customers. This can help improve customer satisfaction and loyalty.
4. Better decision making: Automation can help companies access, process and analyse large amounts of
data in real time. This can improve decision-making abilities, enabling companies to make better use
of the data to make more informed business decisions.
5. Market Differentiation: By having the ability to use Intelligent automation system using ChatGPT
gives you a competitive edge over the other players in the market. It can help you in providing better
customer service, effective decision making and efficient automation of repetitive tasks.

DISADVANTAGES:
There are a few disadvantages to using chatgpt:
1. You may not be able to find a group that meets your interests.
2. The groups may be too large or too small for you.
3. You may not be able to find a group that is active.
4. lack of concentration and human effort
5. It effects the mental and critical thinking of a person
6 .Hghly dependent upon the internet
7. When answering a question that requires professional knowledge from a particular field, ChatGPT may
fabricate facts in order to give an answer.

25
16.PROJECT INFO AND OVERVIEW
PROJECT DEATAILS:

Title Chatgpt (model) using python

Software/IDE Python idle

Programming language python

Abstract This is the GUI based program which


includes the openai library and openai
module,tkinter
Technology used Openai module,API key

Python version 3.10 + version required

Type/categeory Final year mini project

SOURCE CODE:
#mini project
#Importing the required libaries
from tkinter import *
from tkinter import messagebox
import tkinter as tk
import openai
#Connecing to our API key Key
openai.api_key = "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"
# function for checking the input
def Exit():
root.destroy()
#checking
def check():
if input_field.get()=="":
messagebox.showwarning("Feild is Empty","Enter A Question")
messagebox.showinfo("Question is Empty"," Programmed Stopped Running")
26
messagebox.showinfo("Please Enter a Question","Please Run Once Again The Code ")
root.destroy()
else:
pass

# Generate a response using OpenAI GPT-3


def generate_response(prompt):
check()
completions = openai.Completion.create(
engine="text-davinci-002",
prompt=prompt,
max_tokens=1024,
n=1,
stop=None,
temperature=0.5,
)

message = completions.choices[0].text
return message
# GUI interface
def display_response():
input_text = input_field.get()
response = generate_response(input_text)
output_field.config(state='normal')
output_field.delete(1.0, tk.END)
output_field.insert(tk.END, response)
output_field.config(state='disabled')
# Create the main window
root = tk.Tk()
root.title("MY MINI PROJECT")
root.geometry("1000x1000")
root.configure(bg="light blue")
# Create the input field
27
input_field = tk.Entry(root, font=("Arial", 14))
input_field.pack(pady=10)
#label
label1= tk.Label(root, text="Enter Your Question Here----->", font=("Arial", 14))
label1.place(x=100,y=10)
# Creating the submit button
submit_button = tk.Button(root, text="Submit", font=("Arial", 14), command=display_response)
submit_button.pack(pady=10)
#destroy button
exit_button = tk.Button(root, text="Exit", font=("Arial", 14), command=Exit)
exit_button.place(x=600,y=57)
# Create the output field
output_field = tk.Text(root, font=("Arial", 14), state='disabled')
output_field.pack(pady=10)
# Start the GUI event loop
root.mainloop()

OUTPUT INTERFACE:

28
GIVING INPUT:

OUTPUT:

29
17.CONCLUSION

First you should install openai library, then copy code given above, and
run the program that’s it. This way you can easily use ChatGPT with Python program. You can even
create a GUI App just like ChatGPT. I recommend you to try more on ChatGPT as it’s another magical
invention that we are seeing nowdays.OpenAI's ChatGPT-3 is an advanced AI model that has the
potential to revolutionize the way we interact with machines.

Its ability to generate human-like text, answer questions, and perform


tasks opens up a wide range of possibilities for businesses and developers. With access to the OpenAI
API, anyone can start experimenting with ChatGPT-3 and explore its capabilities.ChatGPT is a powerful
tool that provides efficient and personalized communication experiences for businesses and individuals.
By using natural language processing and machine learning algorithms, ChatGPT can generate
personalized messages, assist in automating routine tasks, support mental health, and provide
conversational practice and support.

However, like any technology, ChatGPT has its limitations and


potential drawbacks, including the risk of over-reliance and potential ethical concerns around the use of
AI-powered chatbots.

THANK YOU

30

You might also like