IBM Cloud webstarter app connected to IBM Cloudant with Watson Assistant embedded (Watson Discovery under construction)
This application demonstrates how you can combine the Watson Assistant and Discovery services to allow a user to execute commands/ask questionsusing plain English or natural language understanding.
First, users pose a questions to the Watson Assistant service. Short tail answers are routed to Watson Assistant if it is able to confidently answer it does. (not yet implemented) If it is not able to adequately answer the Watson Discovery app executes a call to Discovery, for long tail answers.
The app uses two Watson services and a Cloud Foundry service: Watson Assistant, Watson Discovery & Cloudant
This web app is built from the node.js SDK webstarter within IBM Cloud connected to Cloudant.
It has a cognitive conversational interface that the Watson Assistant service provides that consists of the end user asking questions/giving commands to the cognitive car example workspace and powers the basic Q&A using intents(questions/commands), entities(keywords used to further clarify & categorize intents), relationships and natural language
The Watson Discovery service searches and ranks responses for other questions, Watson Assistant cannot answer and uses Cloudant NoSQL DB for storage of chat and API calls
- Ensure that you have a Github account in order to fork/clone and create your own repositories.
- Ensure that you have an IBM Cloud account. Part of this deployment is local but you must still use IBM Cloud.
- Download IBM Cloud CLI to push changes to your app to IBM Cloud using Cloud Foundry commands in project folder
- Ensure you download the WDC SDK for nodejs modules in project folder & other code examples
- Ensure that you have installed nodejs
- Ensure you have downloaded a text editor like Atom
Create a sample web app via IBM Cloud using nodejs SDK Boilerplate connected to Cloudant(automatically)
- In IBM Cloud via UI, click on catalog then click on boilerplates then click on nodejs sdk fill out form, click create then navigate to dashboard to see your web app running (pic)
- In IBM Cloud via UI, create a Watson Assistant Service instance or programmatically using IBM Cloud CLI
-
Ensure you have service credentials for your Watson Assistant service or create them if they do not exist and make note of username/password/API gateway you will need it later.
-
Create a workspace, like I did use the workspace sample or import a workspace then click view details and note down the workspaceid A workspace is a container for all the artifacts that define the behavior of your service (ie: intents, entities and chat flows).
-
Import or create new intents and entitities for Watson Assistant(if you are creating a workspace from scratch)
- In IBM Cloud, create a Discovery Service instance.
- Ensure you have service credentials created for your Watson Discovery instance.
- [Create a data collection and jot down the Collection Id, Configuration Id and Environment Id].
- [Ingest the documents into a new Discovery collection].
- Connect your two services(Watson Assistant and Watson discovery) via the IBM Cloud UI to your nodejs SDK webstarter app by clicking on your web app service running in Step 1 and clicking on connections then create connection, the app will have to be restaged to make the newly connected services available for use.
- Clone/Fork my repository as a base for your own project in command prompt and save it locally using this command: git clone https://github.com/bmguillo/assistant-cloudant-webstarter
- To install wdc sdk run 'npm install watson-developer-cloud -s' to run cloud foundry commands in command prompt
- Rename your local.env.sample file to .env and fill in credentials from above
- to create package.json file run 'npm init' and hit enter on every prompt
- install dotenv tools to store environment variables 'npm install dotenv 's'
- Update your project
- run node app.js to build your project
- Run bx cf push which points to your manifest.yml file
7.Access the running app in a browser at < webappname >.mybluemix.net
This sample code is licensed under Apache 2.0. Full license text is available in LICENSE.
Find more open source projects on the IBM Github Page.