Git Product home page Git Product logo

jotaraffalli / assistant-with-discovery-openwhisk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from watson-developer-cloud/assistant-with-discovery-openwhisk

0.0 2.0 0.0 2.75 MB

Integrate Watson Conversation and Discovery with OpenWhisk to explore the possibilities of "serverless" architecture.

Home Page: https://conversation-with-discovery-openwhisk-demo.ng.bluemix.net/

License: Apache License 2.0

JavaScript 34.60% Shell 1.95% HTML 0.74% CSS 62.71%

assistant-with-discovery-openwhisk's Introduction

Watson Assistant (formerly Conversation) with Discovery - OpenWhisk

Build Status codecov

This application shows the capabilities of Watson Assistant and Discovery services to work together to find answers on a given query. In this sample app, the user is chatting with a virtual car dashboard, giving it commands in plain English such as "Turn on the wipers," "Play me some music," or "Let's find some food." If the user makes a request and Watson Assistant is not confident in its answer (e.g. "How do I check my tire pressure?"), Discovery will search the car manual and return the most relevant results, if relevant materials exist.

This demo is a reworking of a previous one but with an OpenWhisk back-end and React front-end. OpenWhisk is IBM's "serverless" offering, allowing users to upload functions to the cloud, call them via REST API, and pay only by the millisecond of usage.

Table of Contents

How it Works

Flow diagram

Under the hood, there are two components to this app:

  • One is the front-end, which is simply static assets (HTML, CSS, and React), it uses CSS with Sass for cleaner, more maintainable source code.
  • The other is the OpenWhisk actions:
    • When the user inputs text, the UI sends the current context and input to the OpenWhisk sequence. These are processed by the Watson Assistant service and returned, with an output and new context. The results are sent to the next action.
    • The Discovery action checks for a flag from the Watson Assistant output, and if it is present takes the original input and queries the manual with it. If there is no flag, the Watson Assistant results pass through the function unchanged. The Sequence returns the output and updated context back to the UI.

Run Locally

Getting Started

  1. If you don't already have an IBM Cloud account, you can sign up here

Make sure you have at least 2 services available in your IBM Cloud account.

  1. Clone (or fork) this repository, and go to the new directory
git clone https://github.com/watson-developer-cloud/assistant-with-discovery-openwhisk.git
cd assistant-with-discovery-openwhisk
  1. Install Node.js (Versions >= 6).

  2. In the root directory of your repository, install the project dependencies.

npm install

Setting up Watson Services

Skip this section if you have downloaded the project from Watson Console and already have a credentials.json file

  1. Create a project using the Watson Console using Watson Assistant and Discovery services.

  2. In the Watson Console navigate to Projects, click your newly created project, copy credentials from Project View page and paste them in to a new credentials.json file.

Train Watson Services

Run following commands to train Watson Assistant and Discovery services:

  npm run train

Setting up the OpenWhisk Back-end

  1. Install the Openwhisk Command Line Interface.

  2. Download and install the Bluemix CLI.

  3. Login by running the following:

bx login
  1. Install jq as a dependency.

  2. Run the provided shell script create-openwhisk-actions.sh to create your OpenWhisk actions & sequence. The syntax to do so may vary by system, but for example:

   sh create-openwhisk-actions.sh

Setting up the React Front-end

Create an optimized build of your project. During this stage, your environment variable will be inserted into App.js for use by your components.

npm run build

Running the App

All that's left is to serve your static files locally. You should see the project running in a new tab!

npm start

License

Licensed under Apache 2.0.

assistant-with-discovery-openwhisk's People

Contributors

cvsanchez42 avatar g-may avatar germanattanasio avatar jotaraffalli avatar mamoonraja avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.