Empowering Website Conversations: Part 1

Introduction

From virtual assistants to website pop-ups, chatbots are everywhere, transforming the way we engage with technology. These intelligent systems offer custom and instantaneous support to customers, enhancing user experiences.

Thanks to the rapid advancement of AI technology, creating a tailored chatbot for your specific use case has never been easier. In this series, we will guide you through harnessing OpenAI’s fine-tuning capabilities to build a personalized chatbot specifically designed to answer questions about your website. Ours will be built off of the contents of the Embyr website.

The series will cover all the steps, including converting markdown to a training set, training a question-answer model, developing input and output discriminators, and setting up the required REST API and UI components.

In the first installment, we will delve into what a chatbot is, what their capabilities are, why you should make one, and getting set up to leverage OpenAI’s tools.

By the end of this series, you’ll have the expertise to create a powerful and efficient chatbot that can intelligently interact with users and provide valuable information about your website. Let’s get started on this exciting journey to enhance customer engagement and satisfaction with your custom chatbot.

What is a chatbot?

A chatbot is an advanced technology that utilizes natural language processing to offer customized responses to customers and users, simulating a conversation with a human. As AI solutions advance, chatbots are becoming increasingly human-like in their responses.

By leveraging natural language processing, chatbots can better understand and interpret user queries, allowing them to provide more relevant and personalized answers than they have in the past. As a result, interactions with chatbots feel more natural and intuitive, leading to enhanced user experiences.

As AI technology evolves, chatbots are able to continually learn from user interactions, refining their responses, and becoming more adept at handling complex queries.

Overall, the growing sophistication of chatbots is revolutionizing customer support and user interactions, offering a seamless experience that closely resembles human conversations. This advancement in technology has the potential to transform various industries and enhance customer satisfaction significantly.

Why would you want a chatbot?

A chatbot offers valuable round-the-clock service, catering to your customers’ needs and allowing your employees to focus on more complex tasks, thus boosting overall efficiency. Additionally, it empowers users with convenient self-service options to resolve common problems or inquiries quickly.

For small businesses, maintaining a 24/7 support team can be prohibitively expensive due to fluctuating support demands. A chatbot presents a cost-effective solution, handling routine queries and efficiently escalating more complex issues to real employees when necessary.

Moreover, chatbots prove invaluable in assisting users with finding information. Take, for instance, Embyr’s website, where the implementation of a chatbot can addresses questions such as “How can the Embyr Team support my business?” or “What benefits can AI bring to my existing products?”

Integrating a chatbot not only enhances customer service but also streamlines operations and reduces costs for businesses of all sizes. This powerful tool effectively complements human efforts and significantly improves the overall customer experience.

Use Cases and Applications

Here are just a few quick examples of different way types of chatbots:

  • Virtual Assistants: Personalized help for tasks and questions, schedule appointments and manage to-do lists, control smart home devices.
  • Order Status Assistant: Real-time updates on orders, shipping and delivery information, handle order inquiries.
  • Employee Tech Support: Quick technical assistance for employees, troubleshoot software and hardware.
  • Restaurant Recommendation: Find restaurants based on preferences or location, provide details and user reviews, make reservations.
  • Website Conversationalist: engage website visitors, answer questions and offer support, guide users through the website.

We will focus on the Website Conversationalist example in this series.

Components of a Chatbot

To make our own chatbot we will need the following base components:

  • Natural Language Processor - OpenAI Models
  • Chatbot REST API
  • Chatbot User Interface:

component diagram

Model

A successful chatbot relies on AI and natural language processing to process and generate text effectively. The good news is that we don’t have to build the model from scratch. Instead, we can utilize the powerful OpenAI GPT-3 models and the provided fine-tuning API to create a customized model for our chatbot. This way, we can have a ready-to-use, efficient model without the hassle of starting from the ground up.

Note OpenAI announced base GPT-3 Models are going to be deprecated on January 4, 2024. While not yet available at the time of writing, upgraded base GPT-3, GPT-3.5 Turbo and GPT-4 models will be available for fine-tuning in the near future.

REST API

A chatbot’s functionality relies on a REST API that accepts user requests through the User Interface (UI). When a user makes a request, the API communicates with the OpenAI model to generate a response, which is then returned to the user.

We’ll be using Rust as the programming language for this implementation. Rust offers great advantages in terms of performance and safety. But there are many other language options available to you.

For interacting with the OpenAI model, we can refer to a list of supported libraries available here These libraries provide convenient ways to integrate with the OpenAI platform and make our chatbot development process more efficient and effective.

User Interface

To interact with the REST API, we’ll create a user-friendly interface using React with Typescript. Our UI design will incorporate Material UI components, ensuring a sleek and intuitive user experience. The primary objective is to build a chat button and window that seamlessly emulates a conversation with a real person. With this approach, users will feel engaged and comfortable while interacting with our chatbot, making the whole experience feel natural.

Setting up Open AI

The first step in working with the OpenAI models is to create an account. An account is required to get an API key.

Create an Account

If you do not have an account create one here. If you do have an account, log in.

If you are new to OpenAI, I would suggest going through the introduction and quickstart guide to get a better understanding before you continue. We will go over fine-tuning in a later installment.

Create an API KEY

API key stands for application programming interface key, which acts as an identifier to authenticate your application to be able to interact with the OpenAI API. The key is also used to keep track of billing for the number of tokens used.

It is crucial to treat this API key as confidential information and keep it secret. Never share the key or include it in any client-side code or browsers. Instead, we will access the key securely using environment variables when working with the command line and within our server-side REST API. This ensures that the key remains protected and accessible only to authorized users, maintaining the security and integrity of our chatbot’s interactions with the OpenAI platform.

api key component
diagram

More information about the API key can be found in the OpenAI API Reference

To create an API KEY go to your account and navigate to the View API Keys page.

openai api key
list

To add a new key click the “+ Create new secret key” button.

name a new key dialog

Enter a unique name for the key to distinguish it from any other keys you might create, then click “Create secret key.” You will be presented with your new key. Remember to save off your key as you will not be able to access it again.

new api key dialog

Once generated, this key will be visible in your API Key list, along with the creation date and last usage details. You have the flexibility to modify the name of your key whenever needed.

For added security, remember that you can delete the key if it’s compromised or no longer in use. This gives you full control over the access to your API, ensuring the safety and integrity of your interactions with the OpenAI platform.

new api key list

If you have just created your account, your new API key comes with $5 of free credit to use. Once you reach that limit you will need to configure payment options and usage limits for your account before you will be able to make future API calls.

The Pricing page provides information about how much each model costs per 1,000 tokens used.

Here is a list of helpful links to look over when it comes to working with OpenAI:

Conclusion

We’ve explored the concept of chatbots and their ability to benefit both businesses and customers. As we’ve discovered, integrating a chatbot can enhance customer support and streamline user experiences, making it a valuable addition to any website.

With an understanding of chatbots and their potential, we are now ready to embark on the exciting journey of creating our very own chatbot using the OpenAI API. In the next section, we’ll take the first step by converting our website, currently stored in markdown, into a dataset suitable for training our chatbot model. So, let’s dive in and set the foundation for an interactive chatbot that will add a new way to connect with our audience!

Part 2: From Markdown to Training Data

References

What is a chatbot?

Open AI Website