Integrate GPT-4 into your Oct8ne chatbot
The speed at which OpenAI updates the Chat GPT versions is so fast that it requires users to understand the operation on the go. At Oct8ne, we keep up with these release cycles to continue offering a wide range of integrations.
Are you using GPT3.5 turbo or GPT4? Good news, because previously the integration was carried out through the generic HTTP action, but now we have created one specifically designed for ChatGPT. This module hides all the inherent complexity of using external APIs, offering a simplified configuration surface where you only have to focus on creating the appropriate prompt for your bot.
This way, you can enjoy an explosive synergy: the power of our chat, unique in the market with visual support, along with the artificial intelligence of OpenAI. Thanks to our co-visor, you can share images and videos in real-time with your customers, allowing you to generate a direct contact much more similar to that of a physical store.
But first of all, let’s review in detail the necessary steps to make the integration, since, first of all, you have to have an account with OpenAI, which is not directly associated with Oct8ne. Follow the steps!
Create an account on Open AI and get an API Key
To have access to the OpenAI API, simply visit their website at https://openai.com/api/ and register as a user. Registration is free, although we can use the platform a limited number of times; from there, to continue, it will be necessary to hire a paid account, separate from your account on Oct8ne. After registration, we must access the API keys menu, where we will use the “Create a new secret key” button to generate a new access key to the API.
We must write down this key because we will use it later.
It is important to note that, to this day, it is still not possible to use GPT4 directly. Being a completely new model, OpenAI is gradually opening up access, so if you want to use it, you will have to sign up for a waiting list through the address https://openai.com/waitlist/gpt-4-api. If all goes well, in a few days, you will receive an email informing you that you have it available, and you can start using it. However, the GPT3.5-turbo model, used by ChatGPT, is available from the outset.
Model the conversation
Oct8ne’s bot designer is designed so that non-technical profiles can easily create conversations thanks to our drag & drop module system. Thanks to this, you can create a flow of multiple questions and answers both to provide 24/7 help to your customers with FAQs and to recommend products with keywords.
To begin, we will create a simple conversation in which we will only ask the user for the query to be made to the OpenAI GPT model and show the response, ending the conversation at that time. To do this, we will use the “Request data” action of the bot designer to request the text from the user. We will save this text in the “query” variable:
Next, we will link the new ChatGPT module, specifically designed to simplify integration with OpenAI APIs, to the data request:
As mentioned earlier, this module radically simplifies the consumption of OpenAI’s ChatGPT APIs. Conceptually, it behaves like a “black box” that receives the message or query sent by the user and from which, in a new variable, the GPT response is returned.
The parameters that we must establish in the ChatGPT module are as follows:
- OpenAI Token: This is the API key you obtained in the first step.
- Prompt: it is the contextual information that tells GPT how to behave. For example, in the previous screenshot, you can see that we have chosen a simple prompt: “You are a personal assistant. You like to talk to the user and answer their questions.” However, we could have used any other prompt to make the bot’s responses fit our needs.
One very important thing to keep in mind is that OpenAI charges us based on the number of tokens we consume (you can see the rates at https://openai.com/pricing).
For this reason, as you define the prompt, you will see the number of tokens that the specified prompt will consume just below it.
- User message variable: here we should select the variable that contains the user’s query or message. In our case, you can see that we have used “query” because it is the variable where we have saved the user’s message obtained through the “Ask Data” module just before the ChatGPT module we are configuring.
- Output variable: it should contain the name of the variable where GPT’s response will be stored. Typically, we will use this variable to display it back to the user or process it to make decisions, such as taking the user to the beginning of a product return process.
The rest of the configuration possibilities for the ChatGPT module are hidden by default, and are related to advanced API and module behavior parameters. Their default values have been chosen so that it is usually not necessary to modify them.
For example, by default, the ChatGPT module is configured to use the GPT3.5-turbo model, as it offers a reasonably good quality of responses and is the least expensive to use. However, if you prefer to use GPT4, you would simply need to expand the “Advanced API Parameters” section to show the “Model” parameter and type the model name “gpt-4” or the one you want to use.
Other aspects, such as the temperature or degree of “creativity” of the responses, or the token limit allowed for responses, can also be configured in the same section.
Once the parameters of the ChatGPT module have been adjusted, we can continue to define the bot’s behavior, which, as mentioned earlier, is going to be quite simple: all we want to do with the response obtained from GPT is to display it to the user and then end the session.
To do this, we just need to add a couple of additional actions to the bot designer and link them appropriately with the previous ones.
Have you tried the Chat GPT yet? Well, just wait until you integrate it into our chatbot and enjoy the power of Open AI integrated into Oct8ne’s virtual assistants.
If you haven’t tried Oct8ne yet, or if you’re a customer and want to learn more about this new integration, you can request a demo to understand what we’re talking about.
Here’s a video showcasing some of the features of Oct8ne and ChatGPT in action: