Using GPT and OpenAI in your Chatbot

What is GPT?

GPT (Generative Pre-trained Transformer) is a pre-trained language model developed by OpenAI. It is designed to produce texts that are based on answers but appear to be written by a human being. Used to generate short descriptions and articles, GPT can also be used for more complex tasks such as dialogue generation.

What is Open AI?

OpenAI is a non-profit organization created to develop cutting-edge artificial intelligence (AI) technologies and promote their use. It aims to bring AI within the reach of companies, researchers and individuals.

How do I integrate GPT into my chatbot?

It is possible to integrate OpenAI’s GPT into a chatbot by using it as a dialogue engine so that it can answer questions asked by users. You can test an example of GPT integration on Botnation on this GPT chatbot for example.

To get the same result in your Botnation chatbot you just have to follow these steps:

Select the OpenAI connector

It is simply available on your Botnation interface and will save you from using a Webhook or Zapier. The Botnation team takes care of optimizing it and making it efficient by connecting directly to the Open AI API without intermediaries.

Get your OpenAI Secret Key

On the OpenAI website, go to the “API Key” section and generate an API key that will be dedicated to your Botnation project. We recommend that you use one API key per project in order to isolate your project’s usage and billing with OpenAI.

openai api key

Simply indicate your request to the OpenAI connector.

Your “secret key” is to be indicated in the Token field of the OpenAI connector on Botnation, it will serve as a link between Botnation and your Open AI account.

Simply enter your request and Botnation will generate the request to OpenAI” for you. This can of course contain Botnation variables coming from a user input or from the assignment of a button variable in order to be totally dynamic for each use of your chatbot.

In the example below, the request will be for a Pokémon previously indicated by the user in the variable {{pokemon}}.

The result of the GPT request will then be displayed immediately in your chatbot in a properly formatted text message.

The Botnation / OpenAI connector uses the most powerful GPT algorithm by default, currently GPT-3.5 (Da Vinci).

Advanced use of the OpenAI GPT connector

It is possible to use additional options of the Open AI connector on Botnation.

  • The size of the response (number of words) generated to your OpenAI request. This will depend on the complexity of the request and will impact your eventual billing to OpenAI.
  • The name of a custom template that you have trained at OpenAI. Do not indicate anything if you do not have your own model.

How to use the user input directly?

If you don’t want to use user input variables to customize requests to OpenAI you can automatically use the user input contained in the Botnation {{BN_USER_INPUT}} system variable containing the last user text input in your chatbot.

Use OpenAI GPT as your chatbot’s default message

You can also direct your default message to the sequence containing the OpenAI connector. This way you can mix the NLP rules of Botnation and direct the user to OpenAI if your chatbot does not have the answer itself.

Simply set the default sequence in Botnation’s IA NLP settings.

If you want to use 100% OpenAI in Botnation NLP then we recommend you enable this additional option to “Block Botnation AI” in the advanced settings of your chatbot. This will optimize its responsiveness and avoid collecting useless default response logs on your Botnation interface.

Don’t hesitate to come back to us to let us discover your Botnation chatbots realized with this OpenAI connector opening new powerful and certainly surprising uses!

Create your Chatbot Easily and for Free!