How to Connect a Bot to GPT-3
GPT-3 is an LLM (Large Language Model) trained by Open AI. GPT-3 is the technology behind Open AI's ChatGPT. GPT-3 is a text generation model, in that when you give it a text question or prompt, it can generate the answer or a paragraph of following text. The model is able to answer questions on a wide variety of topics in multiple languages, and can even do complex math, and write code.
You can connect your Bot Libre bot to GPT-3 using OpenAI's API, and a Self script in your bot.
Follow the follow these steps to connect your bot.
1 - Create your bot
From the Bot Libre website click on "New Bot",
enter your bots name, and select "gpt3_template" as your bot template
click on "Create"
Another option if you already have an existing bot is to import the "GPT-3" script from the Bot Libre Script library, from your bot's Scripts page select "Import".
2 - Create your Open AI account
From the Open AI website create an account and API key,
Click on "View API Keys",
3 - Set your key in your script
From your bot's Admin Console, select "Scripts" and edit the "proxy" script.
Enter your Open AI API key in the line,
var apiKey = "";
4 - Edit your greeting
Your bot's greeting is the first message the bot send new users. It is also used as the first message in the text prompt sent to GPT-3.
Your greeting lets GPT-3 know what you want it to be.
i.e. here are some example greetings,
"Hello, I am Julie, product support for ACME, how can I help?"
"Hello, I am Joe, and can help you with any questions you have on plumbing."
"Hi, I am Jane, your best friend."
"Hello, I am Dexter, your virtual math tutor, ask me anything about math."
"Bonjour, je suis Céline, votre tutrice virtuelle de français."
5 - Chat with your bot
You can now chat with your bot and it will respond to a wide variety of questions in multiple languages in the context of your conversation.
If you exceed your API quota, or the API is busy you will get the error "Bot is not available", which you can change in the script.
Using Bot Libre you can also now connect your GPT-3 bot to avatars, speech, the web, mobile, social media, and the metaverse. You can also enhance the bot by adding in your own responses, these will overlay the GPT-3 responses and take precedence if they are a good match.
Currently the GPT-3 proxy script forwards every question, but you can change this by editing the pattern in the script. To allow trained responses to take precedence you can change the pattern to "proxy *", and change your default response to redirect("proxy " + input.input) to only engage GPT-3 when you bot does not have a trained response.
If you need help setting up or training your bot, or are interested in training GPT-3 or other GPT models such as GPT-J on your own dataset please contact [email protected]