Q&A service¶
The Q&A service by Alan AI allows you to add a conversational layer on top of the existing content. With it, you can create an intelligent question-and-answer (Q&A) virtual assistant being able to automatically find the most appropriate answer to customer’s requests using your knowledge base and maintain contextual and multi-turn conversations.
The Q&A virtual assistant can be helpful if you already have a pool of static information you want to use to:
Handle frequent users’ requests and provide 24/7 automated support
Onboard new customers and employees
Provide guidelines, train personnel and so on
The Q&A virtual assistant is built without any code experience. You only need to provide the content for your virtual assistant – either as plain text added to the dialog script or URLs of your informational knowledge base. As the knowledge base, you can leverage both user-facing and internal resources, for example:
Product manuals
Guidelines
FAQ pages
Articles
Policies
Once you save the dialog script, the Q&A service crawls the specified URLs and retrieves the content to build indices for the virtual assistant. After the indices are built, the users are able to immediately interact with the assistant to get answers to their questions.
Defining the Q&A content¶
To define the content for the Q&A assistant, use the corpus() function. In the function, add a list of links to retrieve information from and the crawl depth:
corpus(
{url: "https://alan.app/", depth: 1},
{url: "https://alan.app/docs", depth: 2},
{url: "https://alan.app/blog/", depth: 1}
);
You can also add the content for the Q&A assistant directly to the corpus()
function:
corpus(`
Alan AI is a complete Actionable AI Platform to build, deploy and manage AI Assistants in a few days.
With Alan AI, a conversational experience for your app can be built by a single developer, rather than a team of Machine Learning and DevOps experts
`);
The Q&A service supports the mixed data mode, with the content provided both as URLs and plain text. In this case, the service will create a separate index for the data sources added to different corpus()
functions and will use all created indices to conduct the dialog with the user.
Note
The indexing process may take some time. To check the progress and results, use the Alan AI Studio logs.
Setting the crawl depth¶
The crawl depth defines how ‘far’ down the website hierarchy the Alan AI crawler must go to retrieve the content for your Q&A virtual assistant.
For example, if you set the crawl depth to 1, the crawler will access the page available by the start URL, get all unique links to other pages in the same domain from this page and retrieve information from the start page and the linked ones.
Set the crawl depth wisely. The deeper the level is, the higher the chance is that users will get more accurate answers to their questions. However, a great crawl depth may affect the Q&A service performance.
Example of use¶
Let’s assume you want to build a virtual assistant to answer diet and nutrition questions based on the information available in articles at https://www.myfooddata.com/articles/
. You can add the following functions to your script:
corpus(`
Hi, I am your virtual AI-powered assistant.
I can provide you with any information you need.
Ask me a question, and I will do my best to help you.
`);
corpus({
url: `https://www.myfooddata.com/articles/`,
depth: 2
});
After you save the script and the indexing process is complete, the user will be able to maintain a contextual dialog with the assistant to get answers to all the questions covered in the indexed articles, like:
Why is vitamin D important?
What is its current daily value?
Should I take calcium with it?
What foods are high in it?
Requirements and limitations¶
Mind the following requirements and limitations for the Q&A service:
Make sure the websites and pages you define in the
corpus()
function are not protected from crawling. The Q&A service cannot retrieve the content from such resources.Do not add URLs and text strings to the same
corpus()
function. Otherwise, the information provided in text strings will be ignored.The number of indexed pages is limited to 1000 for free Alan AI plans and 5000 for paid plans.