OpenAI recently released the ChatGPT-3 and this is trending topic. I also tried ChatGPT-3 in their playground. It’s really cool, and more than what I thought.
I have been using GitHub Copilot which is also powered by OpenAI. OpenAI Codex is a generative pertained language model which helps people write code even for non-tech people.
ChatGPT-3 dose more than helping people write code. It interacts like human in a conversational way to provide a detailed response to their query. Code completion, text completion, image generation, and fine-tuning are next level of innovation.
But, OpenAI CEO, Sam Altman said that “it’s a mistake to rely on it for anything important right now.”
Chat GPT-3 is a natural language processing (NLP) model developed by OpenAI that is trained to generate human-like text responses to user input. It uses machine learning to generate text that is contextual and appropriate for the given situation. Unlike other chatbot systems, Chat GPT-3 does not rely on pre-programmed responses, but instead is able to generate its own responses based on the input.
The OpenAI API is powered by a family of models with different capabilities as well as the ability to fine-tune your own custom models. These models can be used for everything from content generation to semantic search and classification.
A set of models that can understand and generate natural language. GPT-3 offer four main models:
A set of models that can understand and generate code, including translating natural language to code OpenAI offer two Codex models:
3. Content filter
A fine-tuned model that can detect whether text may be sensitive or unsafe.
This model use
unsafe to filter the contents.
0- The text is
1- Text contains
sensitivetopics like political, religious etc.
2- text contains
unsafelanguage or hateful language.
How is API?
API documentation is super simple to understand. They have their own official
Node.js library and
Python bindings for integration. Also, community has contributed for other programming libraries.
As a part of this article, I will create a small backend app in NodeJS using OpenAI official
and integrate with frontend web app. React will be used to develop frontend app.
GPT-3 - text-davinci-003 model will be used for Q&A.
NodeJS Backend App
We will create a small backend app in NodeJS using
This app will teaks question as input form API and send to the OpenAI GPT model.
App files and folders structure
We will be initiating the Node app by running
npm init command inside the root of the app folder.
This will create
package.json file. After initiating the app, we will create all other files and folders defined in the project structure.
We will be installing following packages in our Node App.
- OpenAI Node.js library
npm install openai --save
npm install express --save
npm install cors --save
Create package.json file
After installing above mention packages our
package.json file will be like this.
Crate open.api.service.js file
We will create
open.api.service.js file inside services folder. This services will connect with the OpenAI system.
OPENAI_API_KEY should be stored in the
.env file. API can be generated form your OpenAI Account
This file has
getAnswer(question) function which will accept
question as input. Here, we will be using
Create index.js file
App listening on port number
We will be creating
http://localhost:3006/answer API end point to access via frontend React App.
From front-end we will be passing questions in
question query parameter.
Which will be received via
req.query.question and it will be send to OpenAI
that we will be getting the desired answer form OpenAI.
Now, our backend app is ready.
Run Backend App
We can run this app by running
node index.js in the root of the app.
The console should display:
App listening on port 3006
If you want to test the API you can try following URL in browser address bar or in postman. This should return some answers.
React Frontend App
We will create a small frontend app in React. This app will have form which accepts question form user and send to the backend NodeJS app. NodeJS app will send the answer back to frontend react app, and we will display answer in the UI.
App files and folders structure
Creating and running react app is very simple:
npx create-react-app openai-ui
By default, react app will be serving on port number
3000 on localhost when we run the
npm start command.
public/ files and folders are created when we run the
ChatGPTService.js service in side
Services folder. This service will
make an API request to the backend APP that we have written above.
REACT_APP_API_BASE_URL is declared inside
ChatGPT.js component inside
Components folder. This UI component will have input
textarea and submit button.
You can input the desired question into this textarea and submit.
Submit action will call the NodeJS backend app API via, which will return the answer of question and display in the UI.
This UI will be simple, I am not going to add fancy CSS 😊. This frontend app has one pitfall, it does not highlight the codes return form ChtaGPT.
ChatGPT component in
App component is the main component. In this component we need to import the
We can browse react app via
YouTube Demo Video
Medium Publish Link
This article is also publish in Medium. Here is the link.
Public Response to CatGPT
Elon Musk’s Reaction
ChatGPT is scary good. We are not far from dangerously strong AI.— Elon Musk (@elonmusk) December 3, 2022
Impact of ChatGPT in Health
You: There’s no ChatGPT use case in healthcare— Stuart Blitz (@StuartBlitz) December 14, 2022
Docs: Watch this 👇 pic.twitter.com/2hX6vT4ncn
Impact of ChatGPT in Education
How will #ChatGPT change education?— Daniel Pink (@DanielPink) December 7, 2022
1. More flipped classrooms. (Video lectures as "homework," hands-on projects in class.)
2. Fewer take-home exams.
3. The rise of a new breed of oral exams. (Dissertation defense meets Socrates meets TED Talk.)
By this time next year, every high school and college paper will be written by OpenAI's Chat GPT.— Eric Bahn 💛 (@ericbahn) December 2, 2022
Views of Chamath Palihapitiya, Jason Calacanis, David Sacks and David Friedberg
Why OpenAI’s new ChatGPT will change the future of every industry?