Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt | ||
---|---|---|
| ||
The Knowledge Base Skill gives the Digital Person the ability to answer end user questions based on your knowledge-base provided in a JSON file. |
Overview
This Knowledge Base Skill gives the Digital Person the ability to answer end-user questions based on a customer’s knowledge base. The Knowledge base Skill data is provided in a JSON file with expected questions from the users and corresponding responses. If there is a match the Digital person will pick one of the responses from the list randomly.
This skill is:
Built and owned by Soul Machines Ltd.
Only supported in English.
Limitations
The Skill does not validate the JSON file. So an invalid JSON file can result in the Skill or project not working as expected.
Knowledge Base Skill does not work with other fallback skills like Elegant Failure and Skill - Site Search. However, Elegant Failure is supported as part of the Knowledge Base Skill.
Skill Demo
KnowledgeBaseSkill_Demo.mp4Creating Knowledge Base JSON File
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
Use the https://knowledgebase-ui.prod.soulmachines.cloud/ tool to create or edit your Knowledge Base. Learn more here. |
The JSON file must be in its raw form or hosted on any static site.
It needs to be publicly accessible, no login or other steps involved
It needs to directly serve the .json file as raw text. Not formatted to look nice or served up in a viewer.
For example this link to the JSON is an HTML viewer which the skill will not accept https://drive.google.com/file/d/1Fqj7x7wYOO9hS2URbtWxOa-4rtNJ_m8X/view?usp=share_link. Instead provide you need to reformat the link to be in the format:
Code Block https://drive.google.com/uc?export=download&id=YOUR_ID
Like this: https://drive.google.com/uc?export=download&id=1Fqj7x7wYOO9hS2URbtWxOa-4rtNJ_m8X
The knowledge base data is a JSON file containing an array of questions and answers. The format of the data is as follows:
"intent"
- Used as a unique identifier for each JSON object."examples"
- This is an array of strings that contain examples of different phrasings for the question."metadata"
- This contains an array of strings that are the responses to the question. If more than one value is found for a given intent, the skill will randomly pick one of the responses to reply with.
Code Block | ||
---|---|---|
| ||
[ { "intent": "WhatIsSoulMachines", "examples": [ "what is soul machines", "tell me about soul machines", "who is soul machines", "who are soul machines", "what are soul machines", "what is soul machine", "who is soul machine", "who are soul machine", "what are soul machine", "tell me about soul machine", "explain soul machines to me" ], "metadata": [ "Soul Machines is the world leader in humanizing AI to create astonishing Digital People. A little secret, they actually created me.", "Soul Machines is my creator" ] }, { "intent": "HowAreYou", "examples": [ "Hoe are you", "thow are you doing", "are you doing good today", "how are you feeling", "how are you going", "how are u", "how are you going today", "how do you feel today", "how do you do" ], "metadata": [ "I'm good", "Great!" ] } ] |
If there is not an exact match, a Natural Language Understanding (NLU) process will attempt to find the closest intent based on the examples. If no match is found, it will reply back with a configurable No Match Response.
Displaying Content cards
In the metadata section of the JSON file, you can either add an array of strings (what the Digital Person will speak when the request comes in), or an array of objects which contain both the spoken text as well as any variables for cards that may be needed. The format of the enhanced metadata response looks as below.
Note that all “variables” should contain a “public” entry under it. Below the “public” level, you can include any number of additional variables, then refer to the name (“pic” in this example). This enhancement supports cards and commands now. See Displaying Content Cards for the list of available cards and their corresponding variable requirements.
Code Block | ||
---|---|---|
| ||
{ "intent": "ShowImage", "examples": [ "show me an image" ], "metadata": [ { "text": "@ShowCards(pic) Here is an image", "variables": { "public": { "pic": { "component": "image", "data": { "url": "https://www.soulmachines.com/wp-content/uploads/SM_NavBarLogo_DarkGray.png"} } } } } ] } |
Session persistence in Web Widget
KnowledgeBase now supports responding to page changes on a website when used in conjunction with the Web Widget. As the end-user navigates between different pages on the website, it sends a PageMetadata event to the skill which has a pageUrl variable attached. The KnowledgeBase data file uses the pageUrl as the text to look up in the example section.
In your KnowledgeBase data Json file, you should add URL patterns if you want them to be triggered. For example:
Code Block |
---|
{ "intent": "home-page", "examples": ["https://www.abraxis.com","https://abraxis.com","https://www.abraxis.com/","https://abraxis.com/"], "metadata": ["Welcome to Abraxis. This chat service is experimental."] }, { "intent": "web-hosting-colo-page", "examples": ["https://www.abraxis.com/web_hosting_colo/*","https://abraxis.com/web_hosting_colo/*"], "metadata": ["We can host your website on our dedicated windows or Linux servers, offer Virtual Machines, dedicated servers or colocate your own server in our datacenter"] } |
You can use wild cards to match directory patterns so you can have the same response for everything within a category. For example, https://www.abraxis.com/web_hosting_colo/*
would match any endpoint coming after the web_hosting_colo path. All the standard metadata responses are available.
Info |
---|
Notes:
|
Entity support
You can specify “entities” word varieties in the text. In the example below, the entity is in square brackets (i.e. [cats]) the entity can be any word. The main effect of this format for the example is it is more robust in recognizing the pattern and you do not need as many examples to train the NLU.
Code Block | ||
---|---|---|
| ||
{ "intent": "AskAboutPets", "examples": [ "Are [cats] good pets", "Are [dogs] good ets", "Are [parrots] good pets", "Are [hamsters] good pets" ], ], "metadata": [ "All pets are good if they make the owner happy" ] } |
In the above example, if the user says any other word in place of “cats” the intent is matched and the Digital person will respond with one of the corresponding responses.
Best Practices
Aim to add at least 10 phrases in the array for the best possible match for the question
Get as many new people to test your Knowledge Base as you can so that you have a wide range of questions and answers.
Make sure your JSON file is validated before you configure the Knowledge Base skill.
Configurations
Provide the following information in the Knowledge Base Skill configuration screen in Digital DNA Studio. See Adding Skills to your Digital Person for detailed instructions:
Info |
---|
Note: Provide a URL to the JSON file or enter the JSON data directly into the second field, if you provide both the JSON data will take precedence. |
Field | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
URL Pointing to the JSON file Containing the Data
|
| This should be a publicly available URL that points to a raw file containing the FAQ JSON data. | ||||||
JSON Data Pasted Directly In
|
| This is the Knowledge Base JSON data pasted directly in. If you supply both URL and JSON Data parameters, the JSON DATA parameter will win out. | ||||||
Welsome Message to Greet the User When First Connecting |
| Used to greet the user when the skill is used as a Base Conversation. This option is useful when this skill is used a Base Conversation | ||||||
No Match Response |
| This is an optional field to set the response from the Digital Person in case there is no match. The default is | ||||||
After Answer Response |
| This is an optional field to set the response from the Digital Person after answering the question. The default is | ||||||
Include a Pre-built Model? |
| Allows combining Knowledge Base skill with other fallback skills. Currently supports only Elegant failure. | ||||||
How Strict Should I Be When Matching Phrases?
|
| How closely the user phrase needs to match the configured knowledge base. When used in conjunction with another open-ended skill, you should choose "Exact Match" or "Somewhat Flexible". If the KB skill is used as a FALLBACK, you should choose "Very" or "Extremely". This option is useful when used a skill in addition to a base conversation. |
Content
Table of Contents | ||||
---|---|---|---|---|
|