/assistant-cloudant-webstarter

This repository demonstrates nodejs web app in IBM Cloud with Watson Assistant embedded and Cloudant

Primary LanguageJavaScriptApache License 2.0Apache-2.0

IBM Cloud webstarter app connected to IBM Cloudant with Watson Assistant embedded (Watson Discovery under construction)

Build Status

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.

How the app works

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

Getting Started locally

test

Before you begin

  • 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)

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

Create the Watson AI services

  1. In IBM Cloud via UI, create a Watson Assistant Service instance or programmatically using IBM Cloud CLI
  1. 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) to your nodejs SDK webstarter app

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

Updating & Building Your Project Locally

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

Deploying(Pushing your app to IBM Cloud via Cloud Foundry command)

  1. Run bx cf push which points to your manifest.yml file

test test test test

Running your app

7.Access the running app in a browser at < webappname >.mybluemix.net test


License

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

Open Source @ IBM

Find more open source projects on the IBM Github Page.