This application demonstrates how you can combine the Watson Assistant and Discovery services to allow customers, employees or the public to get answers to a wide range of questions about a product, service or other topic using plain English. First, users pose a questions to the Watson Assistant service. If Watson Assistant is not able to confidently answer, the app executes a call to Discovery, which to provides a list of helpful answers.
CVE-2021-44228 noted that versions of log4j2 prior to 2.16.0 allow for remote code execution. Addtionally, CVE-2021-45105 noted that versions of log4j prior to 2.17.0 did not protect from uncontrolled recursion from self-referrential lookups. You can read details about the CVE-2021-44228 here and CVE-2021-45105 here. We have updated the application (although it is deprecated) to bump the log4j version to 2.17.0. Revisions of this application prior to this update used log4j version 2.1 and thus are vunerable to this CVE. If you have forked this repository in the past, you are strongly encouraged to update your version of log4j to 2.17.0 to mitigate this security issue.
The app has a conversational interface that can answer basic questions about a fictitious cognitive car, as well as more obscure questions whose answers can be found in the car’s manual. The app uses two Watson services: Watson Assistant and Discovery. The Watson Assistant service powers the basic Q&A using intents, relationships and natural language, and calls the Discovery app when it encounters questions it can’t answer. Discovery searches and ranks responses from the manual to answer those questions.
The application is designed and trained for chatting with your cognitive car. The chat interface is on the left, and the JSON that the JavaScript code receives from the server is on the right. A user is able to ask two primary categories of questions.
Commands may be issued to the car to perform simple operations. These commands are run against a small set of sample data trained with intents like "turn_on", "weather", and "capabilities".
Example commands that can be executed by the Watson Assistant service are:
turn on windshield wipers
play music
In addition to conversational commands, you can also ask questions that you would expect to have answered in your car manual. For example:
How do I check my tire pressure
How do I turn on cruise control
How do I improve fuel efficiency
How do I connect my phone to bluetooth
In IBM Cloud, create a Watson Assistant Service instance.
In IBM Cloud, create a Discovery Service instance.
To build the application:
Clone the repository
git clone https://github.com/watson-developer-cloud/assistant-with-discovery
Navigate to the assistant-with-discovery
folder
For Windows, type gradlew.bat build
. Otherwise, type ./gradlew build
.
The built WAR file (watson-assistant-with-discovery-0.1-SNAPSHOT.war) is in the assistant-with-discovery/build/libs/
folder.
<liberty install directory>/usr/servers/<server profile>/dropins
.assistant-with-discovery/src/main/resources
folder. Copy the server.env
file.<liberty install directory>/usr/servers/<server name>/
folder (where < server name > is the name of the Liberty server you wish to use). Paste the server.env
here.server.env
file, in the "Watson Assistant" section.
server.env
file, in the "discovery" section.
server run <server name>
(use the name you gave your server). If you are using a Unix command line, first navigate to the <liberty install directory>/bin/
folder and then ./server run <server name>
.http://localhost:9080/
.Navigate to your Discovery instance in your IBM Cloud dashboard
Launch the Discovery tooling
Create a new data collection, name it whatever you like, and select the default configuration. The default configuration now uses Natural Language Understanding.
Download and unzip the manualdocs.zip in this repo to reveal a set of JSON documents
In the tooling interface, drag and drop (or browse and select) all of the JSON files into the "Add data to this collection" box
Go to the IBM Cloud Dashboard and select the Watson Assistant/Discovery service instance. Once there, select the Service Credentials menu item.
Select New Credential. Name your credentials then select Add.
Copy the credentials (or remember this location) for later use.
To use the app you're creating, you need to add a workspace to your Watson Assistant service. A workspace is a container for all the artifacts that define the behavior of your service (ie: intents, entities and chat flows). For this sample app, a workspace is provided.
For more information on workspaces, see the full Watson Assistant service documentation.
Navigate to the IBM Cloud dashboard and select the Watson Assistant service you created.
Click the Launch Tool button under the Manage tab. This opens a new tab in your browser, where you are prompted to login if you have not done so before. Use your IBM Cloud credentials.
Download the exported JSON file that contains the Workspace contents.
Select the import icon: . Browse to (or drag and drop) the JSON file that you downloaded in Step 3. Choose to import Everything(Intents, Entities, and Dialog). Then select Import to finish importing the workspace.
Refresh your browser. A new workspace tile is created within the tooling. Select the menu button within the workspace tile, then select View details:
In the Details UI, copy the 36 character UNID ID field. This is the Workspace ID.
Return to the deploy steps that you were following:
This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.
See CONTRIBUTING.
Find more open source projects on the IBM Github Page.