AI - Node - ChatGPˇ
AI was first mentioned as a concept in 1956 and has progressed massively since then due to increased data volumes, improved algorithms and advances in computer power and storage. Early research was focused on problem solving and symbolic approach it wasn’t until the 1960s when the US Department of Defense took an interest and taught computers to mimic basic human reasoning. Narrow AI(responsible for the working of Siri, Google Search, Image Recognition Software, etc), Machine Learning and Deep Learning are some of the different aspects of Artificial Intelligence.
OpenAI, one of the world’s most ambitious artificial intelligence labs, is an AI research and deployment company with a mission to ensuring that artificial general intelligence benefits all of humanity. OpenAI conducts fundamental, long-term research towards the creation of safe AGI(Artificial General Intelligence). This research tend to focus on reinforcement learning and their effort has yielded the following milestone launches:
Large language models are powerful tools for processing natural language data quickly and accurately with minimal human intervention, and can be used for a variety of tasks such as sentiment analysis, question answering systems, automatic summarization, machine translation, document classification and more.
Stanford University in their article titled ”How Large Language Models Will Transform Science, Society, and AI” reported that in July 2020, OpenAI unveiled GPT-3, a language model that was easily the largest known at the time.
ChatGPT (Generative Pre-trained Transformer) is a chatbot launched by OpenAI in November 2022. It is built on top of OpenAI’s GPT-3.5 family of large language models, and is fine-tuned with both supervised and reinforcement learning techniques. It is essentially a variant of OpenAI’s popular GPT-3.5 language-generation software that’s been designed to carry conversations with people.
Some of its features include answering follow-up questions, challenging incorrect premises, rejecting inappropriate queries and even admitting its mistakes, according to an OpenAI summary of the language model. This is achieved through the use of transformer architecture and pre-training on a large dataset.
Overall, OpenAI’s models provide a valuable resource for programmers and developers looking to leverage the power of AI in their work.
OpenAI offers a range of APIs that can be used to access the capabilities of their machine learning models from within your own applications. OpenAI released one of such APIs that allows researchers and developers to build advanced GPT 3 machine learning models with few lines of code based on the paper “Language Models are Few-Shot Learners”.
You can sign up for a free API key here
In this article, we are going to be using that API to start interacting with the state-of-the-art GPT3 model and build a pet name generator.
Let’s get started…
npm install openai
OpenAI GPT-3 models can understand and generate natural language. They offer four main models with different levels of power suitable for different tasks, with Davinci being the most capable, and Ada being the fastest. You can read more about the models here
Select your model type ￼
You will also be using the OpenAI completion API and below are the list of parameters to understand. More details on the parameters can be found here
git clone https://github.com/openai/openai-quickstart-node.git
cd openai-quickstart-nodecp .env.example .env
OPENAI_API_KEYin your newly created
NB: Make all your API calls on the server-side only when using JS, since making calls in client-side browser code will expose your API key.
npm install npm run dev
In a year that’s turned into a dud for the technology sector, with mass layoffs, wrecked stock prices and crypto catastrophes dominating the headlines, ChatGPT has served as a reminder that innovation is still happening. It has got the world in a frenzy since it was first made available to the public as users are amazed by its potential to provide human-quality responses, with a lot of users sharing the sentiment that it may eventually have the power to disrupt how humans interact with computers and change how information is retrieved.
The program has its limitations, including a knowledge base that ends in 2021, a tendency to produce incorrect answers, constantly using the same phrases and when given one version of a question, the bot claims it cannot answer it, but when given a slightly tweaked version, it answers it just fine.
Connect with me on Twitter if you have any questions.