4 Easy Steps to Build an Ai-Powered Support Bot That Knows Your Docs
Goal
In this tutorial, you'll learn how to build an AI-powered support bot for your application using the Appsmith AI Chat template. We'll use contextual data (in this case, a PDF generated from the Appsmith documentation) to enhance the bot's ability to provide helpful, accurate responses for an optimized AI support bot.
Prerequisites
AI integration (Appsmith AI is the default example)
Tool to generate sitemap as PDF
Overview
Support bots are a powerful tool, but they can be even more effective when provided with the right context. In this tutorial, we’ll start with the Appsmith AI Chat template, attach a PDF of Appsmith's documentation, and refine the bot's prompts to improve the quality of responses. By the end, you'll have a fully functional AI support bot capable of answering questions and providing links to relevant docs.
Too impatient to read the tutorial or build it yourself? Check out the result here: Appsmith AI Support Chatbot.
Start with the Appsmith AI Chat Template
We have a pre-built AI Chat template that makes creating your support bot easy. This includes
- Custom widget for chat window.
- Appsmith AI integration.
- Local device memory of chats.
- Enable limits on the number of responses
The template comes with a default prompt designed for conversational AI, which we’ll optimize for support bot functionality later.
Generate a PDF from Appsmith Docs
Next, we need to generate a PDF of Appsmith's documentation that the AI will use as context. We’ll use the sitemapExport tool for this. It is a simple CLI tool I built to extract, cleanup, format, and save all of the pages in a sitemap (or RSS feed) into a single document. The command is used with various flags like this:
./sitemapExport --url="https://docs.mysite.com/sitemap.xml" --css=".theme-doc-markdown" --outputName="supportdocs" --outputType="pdf" --format="md"
- URL - the URL for the sitemap.xml or RSS feed to crawl
- CSS - the CSS selector for the content to extract
- outputName - the name of the file to output
- outputType - the type of file to output (json, txt, md, pdf, jsonl)
- format - the format of the content in the file (text, md, HTML)
In this case, the command will generate a PDF named
supportdocs.pdf
, which contains all the documentation from the site. This will help the AI respond with accurate and contextual information. This command is pretty fast - I generated a pdf of the Appsmith docs site in about 25 seconds.Modify the Appsmith AI Datasource Integration
Now, let’s integrate the documentation PDF into the AI datasource.
- In Appsmith, open the AI Chat app you forked from the template.
- Go to Datasources, select the Appsmith AI datasource, and open the settings.
- Attach the
supportdocs.pdf
by using the Attach File option. This will enable the AI to access the documentation as it responds to users.
Note that you can add multiple files including forum posts, code samples, KB articles, blog posts, tutorials, etc. Plus, these files can be selectively added to the AI requests when you need them.
Update the Prompt for the Support Bot
The template comes with a basic prompt that reads:
Below is a new message from the user, and a history of your chat with them. Review the history and the new message, then reply as the system to continue the conversation. # NEW MESSAGE: {{inp_userPrompt.text}} # CHAT HISTORY {{chat.chatHistory}}
We’re going to optimize this to act as an Appsmith Support Bot that can use the attached documentation.
Updated Prompt:
You are an AI support bot for the Appsmith platform. Using the attached Appsmith documentation, review the user’s new message and the chat history, then respond with the most accurate and helpful information. Include reference links to the documentation whenever possible. # NEW MESSAGE: {{inp_userPrompt.text}} # CHAT HISTORY: {{chat.chatHistory}}
This will guide the AI to use the documentation for more accurate responses.
Test and Refine
Now it’s time to test your support bot.
- Ask a few questions related to the your platform.
- See how the bot responds using the attached documentation.
- Tweak the prompt or attached data if the responses need improvement.
Conclusion
The results of these simple changes can have profound results. Check out the differences between these simple variations:
Appsmith AI Template (no change)
Appsmith Support Chatbot with the PDF
Appsmith Support Bot with PDF and Prompt Adjustment
As you can see, the results improve and become more useful with each adjustment. This approach also allows you to easily update the data you attach to the chat and continue to refine it.
By following this tutorial, you can build an AI support bot that not only interacts with users but also leverages your documentation to provide accurate and helpful responses. Using the Appsmith AI Chat template as a foundation, and enhancing it with contextual data like a PDF of your docs, you’ve created a more intelligent, more efficient support system.
Is it meta or just lazy when using AI to generate an image for an AI tutorial?
Asking for a friend...