You can add a Knowledge Graph to an existing or new Bot. So, if you haven’t already created a bot, refer to Creating a new Bot.
Creating a Knowledge Graph involves the following steps:
Step 1: Add Knowledge Graph to Bot
To open the Knowledge Graph builder:
- Log in to Kore.ai Bot Builder and open the bot to which you want to add the Knowledge Graph.
- On the Bot main menu, click Knowledge Collection tab and then click Create on the right-hand screen.
Step 2: Create the Ontology
By default, the name of the bot becomes the root node of the ontology and you can edit this. Create the rest of the nodes below the root node as follows:
- On the top left side of your Bot Ontology window, hover the mouse over the root node.
- Click the plus icon. A box appears below to add a node.
- Type the name of the node in the box and press enter.
Note: This node becomes a child for the root node and can be referred to as a First level node.
- Repeat steps 1 to 3 to create other First-level nodes.
- After you create First-level nodes, create child nodes as follows:
- Hover your mouse over any First-level node, and click the icon to create its child node.
- You can create a child node for any level nodes by hovering the mouse over it and clicking the icon.
Step 3: Add Question and Answers
The next step is to add relevant question-answer sets to the nodes in the ontology. As you enter these questions, pay attention to terms that you can further add to your ontology.
To enter the question and answer for a selected node:
- On the top left side of your Bot Ontology window, click the node to which you want to add questions.
- On the top right side of the Bot Ontology, click Add Q&A.
- In the User Says box, enter the question that describes the user’s query.
- Optionally, if there are alternatives to the same question, click the plus icon to add the other question. Repeat the step for all the alternative questions you want to add.
Note: By default, questions added to a child node are visible for all its parent nodes in the path, up to the root node. If you do not want the questions from child nodes to be seen beyond a certain parent node, click the following icon on the Questions panel of the selected parent:
The questions from all its child nodes will not be visible to the selected parent node and all its parent nodes.
For the Response, you can either invoke a bot task as the response or compose a simple or channel-specific reply.
Use this option to compose a simple text reply or advanced channel-specific messages.
You can add channel-specific responses to questions in your Knowledge Graph. By varying the responses, you can make the language and formatting to leverage the strengths of the selected channels.
To add a channel-specific response, select the channel from the channels list before typing the response as shown below.
Run a Task
You can link a Dialog task as a response to an FAQ. It helps you to leverage the capabilities of the Knowledge Graph and Dialog tasks to handle FAQs that involve complex conversations.
Click the button and select a task from the drop-down list to add it as a response to the question.
When you type a question in the User Says field, the Knowledge Graph suggests some terms that you can add to the graph based on the text. To include a suggested term to the path, click the term and it appears at the end of the Path field.
Once you add a tag, it will be visible below the question like a tag everywhere the question appears. Tags work exactly like terms but are not displayed in the Bot Ontology to avoid clutter. You can add synonyms and classes to tags as you do to terms.
Step 4: Enter Synonyms
You can add multiple synonyms for each term in your Knowledge Graph, making the path discoverable for varied user utterances. You can add synonyms for a term from the Settings window. When you add a synonym for a term in the Knowledge Graph, you can now add them as global synonyms. Local synonyms apply to the term only in that particular path, whereas global synonyms apply to the term even if it appears on any other path in the ontology.
To add synonyms for a term:
- On the top left side of your Bot Ontology, hover the mouse over the terms for which you want to add synonyms.
- Click the gear icon to open the Settings window.
- To add synonyms, do the following:
- To add local synonyms, type them in the box under Path Level Synonyms.
- To add Global synonyms, click Add New under Knowledge Graph Synonyms and enter them.
Note: Press Enter after typing each synonym in the Synonyms box. If you type multiple synonyms, and without pressing enter, all the synonyms are considered as a single entity, even if they are separated by spaces.
- To add synonyms for a child node, enter them in the Synonyms box next to the term.
To add synonyms for a tag:
- On the top left side of your Bot Ontology, click the term to which you have added the question.
- From the list of questions on the Questions panel, hover the mouse over the question.
- Click the edit icon and in the Edit Q&A window, double-click the term.
- On the pop-up window that opens, type each synonym and press Enter to add it.
Step 5: Define Term Usage
- Default: Default terms do not have any particular considerations in shortlisting qualified paths.
- Mandatory: When you mark a term as Mandatory, all paths associated with the term are shortlisted for ranking only if the user’s utterance includes the mandatory term or its synonyms.
- Organizer: Indicates that a term is just a placeholder (folder) and it should not add any value to scoring. When you mark a term as Organizer, it’ll not be counted while shortlisting qualified paths.
Step 6: Create Classes and Add them to Terms
You can create classes with common user utterances and then add them to the relevant terms in your Knowledge Graph.
To create a class:
- On the top right side of your Bot Ontology window, click the > Manage Classes.
- On the Classes pop-up window, click Add Class.
- In the Class Name field, enter a relevant name for the class, for example, Issues.
- In the Utterances box, enter all the utterances that you want to include in the class. Examples of the Issues class: it is not working, not working, is not working, and I cannot see.
- Click Save.
After you create a class, you can assign it to multiple nodes in the Bot Ontology.
To add a class to a node, follow these steps:
- On the top left side of your Bot Ontology, hover the mouse over the terms to which you want to add the class.
- Click the gear icon to open the Settings window.
- In the Class drop-down list, select the name of a class and then click Save.
Note: Adding a class to a node doesn’t add it to other nodes with the same name. You should add classes to each relevant node separately.
Step 7: Train the Knowledge Graph
After you complete creating the ontology, click the Train button on the top right-hand side of your Bot Ontology window. When you do so, all the paths, synonyms, and question-answer sets are sent to the Graph DB engine.
Step 8: Test the Knowledge Graph
When you complete creating the Bot Ontology and training it, we recommend you to interact with the bot and ask questions connected to the Knowledge Graph. Test the bot responses by using a variety of utterances so that you can identify missing terms, questions, alternative questions, synonyms, and classes.