The core of the OpenAI API is the completions endpoint: You input some text as a prompt, and the model will generate a text completion based on the context or the pattern of the prompt.įor example, if you give the API the prompt, “As Descartes said, I think, therefore”, it will return the completion “I am”. Handle responses with GPT-3īefore we dive into integrating GPT-3, let’s understand how GPT-3 and the OpenAI API work. Now that your bot can read and respond to messages, it’s time to integrate it with GPT-3. Press CTRL+C in your terminal to abort the running index.js file. Type in a message in your Discord server and you should see your chatbot reply back with the same message: Click Copy to copy your token and store it in a safe place - this token will be used in the next section. Under the Build-A-Bot section, you should see the option to reveal your hidden token. The Bot menu should populate with new settings and look like this: Click Add Bot and then click Yes, do it! to turn your newly created application into a bot. In the panel on the left hand side, click Bot to be redirected to the Bot submenu. You will be redirected to your new application’s portal which should look like this: Enter "discord-gpt3-bot" for your application name and then click Create. A box to create an application should pop up. Once you’re signed in, it should redirect you to the applications page.Ĭlick New Application on the top right. Set up a Discord application for your bot through the Developer Portal. Now that you have your Discord server ready, let’s set up your Discord bot. Lastly, click the blue Create button and you will be directed to your newly created server. The last section will ask you to choose a server name and icon - feel free to add your own or stick with the defaults. The next section will ask you about your new server - choose whichever option you’d like or you can skip this section. To get started, set up a Discord server by first downloading and opening the Discord client (or by heading to the web client) and clicking on the green + icon on the left tab.Ī menu will pop up asking if you’d like to choose a template - choose Create My Own. Visual Studio Code or your preferred IDE.Node.js v16+ installed on your machine.Prerequisitesīefore you get started, you’ll need a few things to create your chatbot: In this article you’ll learn how to use Node.js to set up a Discord chat bot powered by OpenAI’s GPT-3 model. With the gaining traction of both of these technologies, I decided to combine them to build an intelligent but fun chatbot. Through Discords extensive API, developers are able to build robust bots that are capable of various actions such as automating tasks and chatting with users. In recent years, Discord has become the central messaging platform for communities especially with the help of Discord bots. A fitting integration with this is Discord chatbots. The engine is capable of doing anything - it can even do your homework for you! OpenAI's GPT-3 engine is also a remarkable tool for chatbots since its output text is indistinguishable from human text. It can produce code, stories, recipes, and more. OpenAI’s GPT-3 is a language model that offers a multifaceted “text in, text out” interface that can be applied to virtually any task.
0 Comments
Leave a Reply. |