{"id":2497,"date":"2022-12-21T16:52:45","date_gmt":"2022-12-21T15:52:45","guid":{"rendered":"https:\/\/botnation.ai\/using-gpt-and-openai-in-your-chatbot\/"},"modified":"2026-01-02T15:27:49","modified_gmt":"2026-01-02T14:27:49","slug":"using-gpt-openai-chatbot","status":"publish","type":"support","link":"https:\/\/botnation.ai\/en\/support\/using-gpt-openai-chatbot\/","title":{"rendered":"Using GPT and OpenAI in your Chatbot"},"content":{"rendered":"<h2 class=\"wp-block-heading\">What is GPT?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Open AI?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">How do I integrate GPT into my chatbot?<\/h2>\n\n\n\n<p>It is possible to integrate OpenAI\u2019s GPT into a chatbot by using it as a dialogue engine so that it can answer <a href=\"https:\/\/botnation.ai\/en\/what-to-do-when-users-ask-multiple-questions-at-once\/\">questions asked by users<\/a>. You can test an example of GPT integration on Botnation on <a href=\"https:\/\/nation.ai\/chat\/\" rel=\"noopener\">this GPT chatbot<\/a> for example.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/12\/openai_7_en.jpg.webp\" alt=\"\" class=\"wp-image-2514\"><\/figure>\n\n\n\n<p>To get the same result in your Botnation chatbot you just have to follow these steps:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Select the OpenAI connector<\/h3>\n\n\n\n<p>It is simply available <a href=\"https:\/\/start.botnation.ai\/\">on your Botnation interface<\/a> 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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/12\/openai_1_en.jpg.webp\" alt=\"\" class=\"wp-image-2502\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Get your OpenAI Secret Key<\/h3>\n\n\n\n<p>On the OpenAI website, go to the \u201cAPI Key\u201d 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\u2019s usage and billing with OpenAI.  <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/12\/openai_8.jpg.webp\" alt=\"openai api key\" class=\"wp-image-2485\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Simply indicate your request to the OpenAI connector.<\/h3>\n\n\n\n<p>Your \u201csecret key\u201d 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.<\/p>\n\n\n\n<p>Simply enter your request and Botnation will generate the request to OpenAI\u201d 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.<\/p>\n\n\n\n<p>In the example below, the request will be for a Pok\u00e9mon previously indicated by the user in the variable {{pokemon}}.  <\/p>\n\n\n\n<p>The result of the GPT request will then be displayed immediately in your chatbot in a properly formatted text message.  <\/p>\n\n\n\n<p>The Botnation \/ OpenAI connector uses the most powerful GPT algorithm by default, currently GPT-3.5 (Da Vinci).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/12\/openai_2_en.jpg.webp\" alt=\"\" class=\"wp-image-2504\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Advanced use of the OpenAI GPT connector<\/h2>\n\n\n\n<p>It is possible to use additional options of the Open AI connector on Botnation.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>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.<\/li>\n\n\n\n<li>The name of a custom template that you have trained at OpenAI. Do not indicate anything if you do not have your own model.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/12\/openai_3_en.jpg.webp\" alt=\"\" class=\"wp-image-2506\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">How to use the user input directly?<\/h2>\n\n\n\n<p>If you don\u2019t 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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/12\/openai_4_en.jpg.webp\" alt=\"\" class=\"wp-image-2508\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Use OpenAI GPT as your chatbot\u2019s default message<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>Simply set the default sequence in Botnation\u2019s IA NLP settings.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/12\/openai_5_en.jpg.webp\" alt=\"\" class=\"wp-image-2510\"><\/figure>\n\n\n\n<p>If you want to use 100% OpenAI in Botnation NLP then we recommend you enable this additional option to \u201cBlock Botnation AI\u201d in the advanced settings of your chatbot. This will optimize its responsiveness and avoid collecting useless default response logs on your Botnation interface.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/12\/openai_6_en.jpg.webp\" alt=\"\" class=\"wp-image-2512\"><\/figure>\n\n\n\n<p>Don\u2019t 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!  <\/p>\n\n\n\n\n\n<p><\/p>\n","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":false},"categorie-support":[194,221],"class_list":["post-2497","support","type-support","status-publish","hentry","categorie-support-features","categorie-support-web-chatbot-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/support\/2497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/types\/support"}],"wp:attachment":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/media?parent=2497"}],"wp:term":[{"taxonomy":"categorie-support","embeddable":true,"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/categorie-support?post=2497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}