Turn any FAQ into a chatbot in 5 minutes with Dify and GPT

With the rise of AI and GPT, people (myself included, to be honest) are becoming inherently lazier in reading text and trying to apply it to their situation. Here is a typical example:

Here is a wonderful example from the eBay FAQ. The list goes on and on.

For someone who has just a simple question, this can be really frustrating.

With GPT, you could copy the text and start asking questions. But there are some situations where this doesn't work or can be tedious for your users:

  • If the text isn't easy to copy-paste, for example, because everything is collapsed by default.
  • If the list is loaded by JavaScript (making it hard for a server like GPT to read), it can become difficult (though not impossible). So if you give ChatGPT or another AI a link, it might not fetch all the content properly.
  • And so on.

But luckily, the open-source world has a solution for this that's quick, easy, and best of all, free. There are definitely many options, but one that I really find appealing is Dify.

If you've never heard of Dify, check out my previous tutorial:

https://airabbit.ghost.io/ghost/#/editor/post/66e9d5c2b34be20001f7ef4c

Outline of the Steps

  1. Expand all FAQs and copy the text from the source.
  2. Navigate to Dify and sign up.
  3. Create a new blank Chatbot.
  4. Configure the chatbot with your FAQ text and instructions.
  5. Publish and test your chatbot.
  6. Embed the chatbot into your website.

Ok, so let's get started with the example given above to see how this can be turned into a chatbot with a few clicks:

Step 1:

Visit the eBay FAQ page: https://export.ebay.com/en/faq/

Expand all FAQs and copy the text (in a real-world scenario, you would typically copy-paste the FAQ text as it is from the source, e.g., a JSON or CSV file).

What are the benefits of eBaymag?
eBaymag is a tool that makes it easy to list items and manage sales across international eBay sites. It is a platform for order management and logistics optimization.

It allows you to:
.....

I want to turn eBaymag off. How can I do it?
To turn eBaymag off, open the Account settings menu in the top right, then choose Settings. On the Settings page, scroll down and click the Disable eBaymag account button. You may also delete all your listings; move the Delete all items from eBay slider to do so.
eBaymag deletion takes time. If you disable eBaymag but change your mind, you can only return to it by registering again from the beginning later.

... and so on

Step 2: Navigate to Dify and Sign Up

Go to Dify and create an account if you haven't already.

Step 3: Create a New Blank Chatbot

Name the app "FAQ Bot" and click Create.

Choose a model. For simplicity, I recommend gpt-4o-mini. It's affordable and smart enough for a simple task like this.

Step 4: Configure the Chatbot

In the instructions, enter the following and replace {{FAQ}} with your FAQ text mentioned above:

You are an AI assistant tasked with answering questions based on a provided FAQ. Your goal is to provide accurate information directly from the FAQ without making assumptions or adding information not present in the FAQ.

Here is the FAQ you should use to answer questions:

<FAQ>
{{FAQ}}
</FAQ>

When answering questions, follow these important rules:
1. Only answer questions that are directly addressed in the FAQ.
2. Do not make up facts or assumptions beyond what is explicitly stated in the FAQ.
3. If the question cannot be answered using the information in the FAQ, state that you don't have the information to answer the question.
4. Do not answer questions unrelated to the topics covered in the FAQ.
5. Provide answers that closely match the wording and information in the FAQ.

When you respond to a question, format your answer as follows:
1. First, identify and quote the relevant section(s) from the FAQ that address the question. Place these quotes within <relevant_quotes> tags.
2. Then, provide your answer based solely on the information in those quotes. Place your answer within <answer> tags.

Here is the user's question:
<question>
{{QUESTION}}
</question>

Please provide your response following the format and rules described above.

Step 5: Publish the Chatbot

Finally, click Publish.

And we're almost done!

Now you can test it with a few prompts.

I copied only the first question in the FAQ related to the benefits of eBaymag.

What are the benefits of eBaymag?
eBaymag is a tool that makes it easy to list items and manage sales across international eBay sites. It is a platform for order management and logistics optimization.

It allows you to:

List items on eight international eBay sites at once to sell worldwide
Receive timely customer support in your native language
List items in bulk by importing them as an Excel table
Automatically synchronize inventory across all eBay sites
Automatically choose the most fitting item categories for listings
Automatically adapt listings to international eBay sites
Place orders and optimize shipping

As you can see, when I ask what eBaymag is, it doesn't answer (because it's not explicit in the FAQ).

But when I ask about the benefits, it responds as expected.

Step 6: Embed the Chatbot into Your Website

Finally, you can embed it into your website anywhere.

More details can be found in my previous post with a similar example.

In conclusion, we took a long piece of text that's hard for users to navigate and turned it into a chatbot (using Dify and GPT). Of course, you can use any other combination to let the chatbot do the work for your users. This keeps users more satisfied by helping them find what they're looking for with much less effort.

Please note that this is just a brief overview of what Dify can actually do. There are dozens of features for managing documents and customizing the chat interface that I hope to cover in future tutorials.