• This repository has been archived on 21/Dec/2021
  • Stars
    star
    145
  • Rank 254,144 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEPRECATED: this application is deprecated and thus will not receive fixes or security updates. It is archived for educational purposes, but may not function.

Watson Assistant (formerly Conversation) with Discovery Build Status

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.

log4j version for CVE-2021-44228

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.

How the app works

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

Getting Started locally

Before you begin

Create the services

  1. In IBM Cloud, create a Watson Assistant Service instance.
  1. In IBM Cloud, create a Discovery Service instance.

Building locally

To build the application:

  1. Clone the repository

    git clone https://github.com/watson-developer-cloud/assistant-with-discovery
    
  2. Navigate to the assistant-with-discovery folder

  3. For Windows, type gradlew.bat build. Otherwise, type ./gradlew build.

  4. The built WAR file (watson-assistant-with-discovery-0.1-SNAPSHOT.war) is in the assistant-with-discovery/build/libs/ folder.

Running locally

  1. Copy the WAR file generated above into the Liberty install directory's dropins folder. For example, <liberty install directory>/usr/servers/<server profile>/dropins.
  2. Navigate to the assistant-with-discovery/src/main/resources folder. Copy the server.env file.
  3. Navigate to the <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.
  4. In the server.env file, in the "Watson Assistant" section.
  • Populate the "password" field.
  • Populate the "username" field.
  • Add the WORKSPACE_ID that you copied earlier.
  1. In the server.env file, in the "discovery" section.
  • Populate the "password" field.
  • Populate the "username" field.
  • Add the COLLECTION_ID and ENVIRONMENT_ID that you copied from the Discovery UI
  • (Optional) Edit the DISCOVERY_QUERY_FIELDS field if you set up a custom configuration . Learn more here.
  1. Start the server using Eclipse or CLI with the command 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>.
  2. Liberty notifies you when the server starts and includes the port information.
  3. Open your browser of choice and go to the URL displayed in Step 6. By default, this is http://localhost:9080/.

Create a collection and ingest documents in Discovery

  1. Navigate to your Discovery instance in your IBM Cloud dashboard

  2. Launch the Discovery tooling

  3. Create a new data collection, name it whatever you like, and select the default configuration. The default configuration now uses Natural Language Understanding.


  • After you're done, there should be a new private collection in the UI
  1. Download and unzip the manualdocs.zip in this repo to reveal a set of JSON documents

  2. In the tooling interface, drag and drop (or browse and select) all of the JSON files into the "Add data to this collection" box

  • This may take a few minutes -- you will see a notification when the process is finished

Service Credentials

  1. Go to the IBM Cloud Dashboard and select the Watson Assistant/Discovery service instance. Once there, select the Service Credentials menu item.

  1. Select New Credential. Name your credentials then select Add.

  2. Copy the credentials (or remember this location) for later use.

Import a workspace

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.

  1. Navigate to the IBM Cloud dashboard and select the Watson Assistant service you created.

  1. 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.

  1. Download the exported JSON file that contains the Workspace contents.

  2. 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.

  3. Refresh your browser. A new workspace tile is created within the tooling. Select the menu button within the workspace tile, then select View details:

Workpsace Details

In the Details UI, copy the 36 character UNID **ID** field. This is the **Workspace ID**.

  1. Return to the deploy steps that you were following:

Adding environment variables in IBM Cloud

  1. In IBM Cloud, open the application from the Dashboard. Select Runtime and then Environment Variables.
  2. In the User Defined section, add the following Watson Assistant environment variables:
  • ASSISTANT_PASSWORD: Use your Watson Assistant service credentials
  • ASSISTANT_USERNAME: Use your Watson Assistant service credentials
  • WORKSPACE_ID: Add the Workspace ID you copied earlier.
  1. Then add the following four Discovery environment variables to this section:
  • DISCOVERY_PASSWORD: Use your Discovery service credentials
  • DISCOVERY_USERNAME: Use your Discovery service credentials
  • DISCOVERY_COLLECTION_ID: Find your collection ID in the Discovery collection you created
  • DISCOVERY_ENVIRONMENT_ID: Find your environment ID in the Discovery collection you created
  • DISCOVERY_QUERY_FIELDS: Set this value to 'none'. If you set up a custom configuration (optional), set this value to the name of your enrichment fields, separated by commas. Learn more here..
  1. Select SAVE.
  2. Restart your application.

Troubleshooting in IBM Cloud

  1. Log in to IBM Cloud, you'll be taken to the dashboard.
  2. Navigate to the the application you previously created.
  3. Select Logs.

License

This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.

Contributing

See CONTRIBUTING.

Open Source @ IBM

Find more open source projects on the IBM Github Page.

More Repositories

1

node-sdk

โ˜„๏ธ Node.js library to access IBM Watson services.
TypeScript
1,482
star
2

python-sdk

๐Ÿ Client library to use the IBM Watson services in Python and available in pip as watson-developer-cloud
Python
1,452
star
3

speech-to-text-nodejs

๐ŸŽค Sample Node.js Application for the IBM Watson Speech to Text Service
JavaScript
1,086
star
4

swift-sdk

๐Ÿ“ฑ The Watson Swift SDK enables developers to quickly add Watson Cognitive Computing services to their Swift applications.
Swift
880
star
5

java-sdk

๐Ÿฅ‡ Java SDK to use the IBM Watson services.
Java
586
star
6

unity-sdk

๐ŸŽฎ Unity SDK to use the IBM Watson services.
C#
570
star
7

personality-insights-nodejs

๐Ÿ“Š Sample Nodejs Application for the IBM Watson Personality Insights Service
JavaScript
558
star
8

visual-recognition-coreml

Classify images offline using Watson Visual Recognition and Core ML
Swift
489
star
9

assistant-simple

A simple sample application demonstrating the Watson Assistant api.
JavaScript
482
star
10

tone-analyzer-nodejs

Sample Node.js Application for the IBM Tone Analyzer Service
CSS
452
star
11

text-to-speech-nodejs

This is a deprecated Watson Text to Speech Service Demo. A link to the newly supported demo is below
JavaScript
346
star
12

speech-javascript-sdk

Library for using the IBM Watson Speech to Text and Text to Speech services in web browsers.
JavaScript
256
star
13

node-red-labs

Node-RED labs on the use of the Watson Developer Cloud services
208
star
14

botkit-middleware

A middleware to connect Watson Conversation Service to different chat channels using Botkit
TypeScript
208
star
15

natural-language-classifier-nodejs

Deprecated: this demo will receive no further updates
JavaScript
158
star
16

dotnet-standard-sdk

๐Ÿ†•๐Ÿ†•๐Ÿ†•.NET Standard library to access Watson Services.
C#
146
star
17

android-sdk

๐Ÿ”† Android SDK to use the IBM Watson services.
Java
145
star
18

natural-language-understanding-nodejs

๐Ÿ†• Demo code for the Natural Language Understanding Service.
JavaScript
133
star
19

api-guidelines

๐Ÿ‘ฎ REST API guidelines created for the Watson Developer Cloud services
133
star
20

assistant-toolkit

Toolkit for experimentation with watsonx Assistant
HTML
100
star
21

car-dashboard

Application that demonstrates how the Watson Assistant service uses intent capabilities in an animated car dashboard UI.
JavaScript
91
star
22

node-red-node-watson

A collection of nodes for the IBM Watson services
HTML
83
star
23

discovery-nodejs

This is a deprecated Watson Discovery Service Demo. A link to the newly supported demo is below
JavaScript
76
star
24

go-sdk

๐Ÿญ go SDK for the IBM Watson services.
Go
71
star
25

assistant-improve-recommendations-notebook

Assistant Improve notebooks for Watson Assistant
Jupyter Notebook
68
star
26

investment-advisor

DEPRECATED: this repo is no longer actively maintained
JavaScript
66
star
27

speech-android-sdk

DEPRECATED - Please use https://github.com/watson-developer-cloud/android-sdk
Java
66
star
28

dialog-tool

DEPRECATED: this repo is no longer actively maintained
CSS
60
star
29

doc-tutorial-downloads

The download files from the IBM Watson Service documentation tutorials
Shell
57
star
30

language-translator-nodejs

Sample Node.js Application for the IBM Language Translator Service
CSS
51
star
31

sentiment-and-emotion

DEPRECATED: this repo is no longer actively maintained
CSS
50
star
32

simple-chat-swift

DEPRECATED: this repo is no longer actively maintained
Swift
48
star
33

ruby-sdk

โ™ฆ๏ธ Ruby SDK to use the IBM Watson services.
Ruby
45
star
34

raspberry-pi-speech-to-text

DEPRECATED: this repo is no longer actively maintained
JavaScript
44
star
35

food-coach

DEPRECATED: this repo is no longer actively maintained
JavaScript
39
star
36

assistant-skill-analysis

Dialog Skill Analysis framework for Watson Assistant
Jupyter Notebook
39
star
37

community

Example data that can be used for various Watson services
Shell
34
star
38

speech-to-text-swift

Speech-to-Text example using the Swift SDK
Swift
34
star
39

visual-recognition-code-pattern

JavaScript
33
star
40

react-components

DEPRECATED: this repo is no longer actively maintained
JavaScript
31
star
41

assistant-dialog-flow-analysis

Dialog Flow Analysis Notebook for Watson Assistant
HTML
28
star
42

salesforce-sdk

A Salesforce library for communicating with the IBM Watson REST APIs
Apex
28
star
43

conversation-connector

The Conversation connector is a set of components that mediate communication between your Conversation workspace and a Slack or Facebook app. Use the connector to deploy a chat bot that Slack or Facebook Messenger users can interact with.
JavaScript
27
star
44

document-conversion-nodejs

DEPRECATED: Please use https://github.com/watson-developer-cloud/discovery-nodejs
JavaScript
27
star
45

text-to-speech-java

DEPRECATED: this repo is no longer actively maintained
CSS
27
star
46

assistant-web-chat-service-desk-starter

A starter kit for building custom service desk integrations for Watson Assistant web chat
TypeScript
25
star
47

raspberry-pi-time-weather-demo

DEPRECATED: this repo is no longer actively maintained
JavaScript
24
star
48

assistant-demo

Assistant demo
JavaScript
23
star
49

discovery-starter-kit

IBM Watson Discovery Starter Kit
JavaScript
22
star
50

assistant-intermediate

An intermediate example of Watson Assistant in a Node.js application
JavaScript
22
star
51

discovery-components

IBM Watson Discovery components
TypeScript
22
star
52

assistant-with-discovery-openwhisk

DEPRECATED: this repo is no longer actively maintained
CSS
21
star
53

company-insights

DEPRECATED: this repo is no longer actively maintained
JavaScript
20
star
54

text-to-speech-swift

DEPRECATED: this repo is no longer actively maintained
Swift
20
star
55

social-customer-care

DEPRECATED: this repo is no longer actively maintained
CSS
19
star
56

speech-to-text-websockets-ruby

Ruby client that interacts with the IBM Watson Speech to Text service through its WebSockets interface
Ruby
19
star
57

customer-engagement-bot

DEPRECATED: this repo is no longer actively maintained
JavaScript
18
star
58

abap-sdk-nwas

ABAP code for using IBM Watson Developer Services with SAP NetWeaver Application Server, imported via abapGit
ABAP
18
star
59

assistant-web-chat

Language strings for web chat integration of IBM watsonx assistant
JavaScript
16
star
60

python-primer-companion-code

DEPRECATED: this repo is no longer actively maintained
Python
15
star
61

spring-boot-starter

Spring Boot support for Watson services
Java
13
star
62

personality-insights-java

DEPRECATED: this repo is no longer actively maintained
CSS
13
star
63

watson-developer-cloud.github.io

Index page with links to SDKs, docs, etc.
HTML
13
star
64

simple-chat-objective-c

DEPRECATED: this repo is no longer actively maintained
Objective-C
12
star
65

text-bot-openwhisk

DEPRECATED: this repo is no longer actively maintained
JavaScript
12
star
66

ui-components

DEPRECATED: this repo is no longer actively maintained
CSS
12
star
67

openwhisk-sdk

๐Ÿ†• SDK for using Watson Services on IBM Cloud Functions (based on Apache Openwhisk) - DEPRECATED
JavaScript
12
star
68

app-insights-discovery

DEPRECATED: this repo is no longer actively maintained
Swift
10
star
69

customer-engagement-nodejs

Customer Engagement
JavaScript
10
star
70

token-generator

Basic Node.js Server to generate watson auth tokens from user-supplied credentials.
JavaScript
6
star
71

watson-vision-coreml-code-pattern

Watson Visual Recognition CoreML Code Pattern
CSS
5
star
72

abap-sdk-scp

ABAP code for using IBM Watson Developer Services with SAP Cloud Platform, imported via abapGit with dependencies via APACK
ABAP
5
star
73

restkit

Core networking and authentication library for the Watson Swift SDK
Swift
4
star
74

cognitive-client-java

DEPRECATED: this repo is no longer actively maintained
Java
4
star
75

speech-to-text-utils

Speech to text CLI that helps you manage speech customizations.
JavaScript
4
star
76

homebrew-tools

DEPRECATED: this repo is no longer actively maintained
Ruby
3
star
77

language-translator-tooling

DEPRECATED: this repo is no longer actively maintained
JavaScript
2
star
78

natural-language-classifier-intent-classification-demo

Deprecated
JavaScript
2
star
79

discovery-nodejs-static

Sample Node.js application that uses the IBM Watson Discovery Service
JavaScript
2
star
80

natural-language-understanding-code-pattern

Natural Language Understanding Code Pattern
JavaScript
2
star
81

speech-to-text-code-pattern

React app using the Watson Speech to Text service to transform voice audio into written text.
JavaScript
2
star
82

swift-playgrounds

Swift playgrounds for Watson Developer Cloud services
Swift
2
star
83

sdk-example-editor

Web application that helps edit SDK examples from an OpenAPI file.
JavaScript
1
star
84

actions-logging-server

HTML
1
star
85

Watson-Assistant-Workspace-Retrain

Python
1
star
86

actions-analytics-dashboard

JavaScript
1
star
87

assistant-web-chat-react

A React library to make integration of Watson Assistant web chat with a React application easy.
TypeScript
1
star
88

visual-recognition-utils

Command line tools to make creating & managing Watson Visual Recognition Custom Classifiers easier.
JavaScript
1
star