IBM Watson gives Voice to SAP Leonardo!
During the SAPPHIRE May’17, Orlando, Florida when SAP published their first set of Machine Learning APIs, I was really excited and wanted to be one of the early to try it out. We all do stand in the queue to be early
for lot of things, right? Anyway, while thinking about a quick demo scenario the first thing that came to my mind is to make Leonardo speak and let the world know about some of his features! but the current set of APIs do not include dialog/conversation related features. So, what next??
Hey!! Why not IBM Watson can lend his voice to Leonardo? SAP and IBM being involved in so many joint ventures and initiatives for decades, so why not the IBM Watson and SAP Leonardo become buddies and go hand in hand to help each other overcome this limitation?
IBM Watson being in the market for a long time already offering a very robust set of cognitive APIs including Visual Recognition, Natural Language Classifier, Retrieve and Rank, Speech to Text/Text to Speech, Conversation, Language Translator, Personality Insight, Document Conversion, Tone Analyzer etc. and out of all these APIs we will leverage IBM Conversation service to give voice to SAP Leonardo’s Translation API. Even though Watson already supports language translation in multiple languages but just for the sake of this demo we will leverage Leonardo’s Translation API.
IBM Conversation allows you to quickly build, test and deploy a bot or virtual agent across mobile devices, messaging platforms like Slack or even on a physical robot. Conversation has a visual dialog builder to help you create natural conversations between your apps and users, without any coding experience required.
Leonardo’s Translation API translates multiple translation units from a source language into multiple target languages.
Oh!! I forgot to mention you the venue of this friendship meet is none other than IBM Watson’s own house @Bluemix. Just kidding – basically we will leverage IBM Bluemix platform to develop a Node Red Cloud Foundry application leveraging the Watson Conversation & Leonardo’s Translation API and Telegram Chat Bot
Step-by-step
To try this demo, first you need to have a IBM Bluemix Account which you can create very easily following link: https://console.ng.bluemix.net/registration/ – Once logged in you are all set to follow the steps. Also download Telegram app on your phone.
Create a new chat bot on Telegram’s BotFather
- Run the Telegram app
- Search for @BotFather at the search bar on top and select it
- Search for @BotFather
- send /newbot command / message to BotFather
- Enter the name and username of your bot
- Once created, you’ll be given a token string which will be needed to configure telegram node inside Node-Red (as shown below)
Create a Node-RED app
- Click Create App
- Search and select Node-RED Stater boilerplate
- App name: WatsonNDLeonardo
- Host name: WatsonNDLeonardo <your_initials>
- Once the app has been started, click View app or go to the url of the app directly
- Click on the Go to your Node-RED flow editor or add /red path to the url to view the Node-RED flow. For example: http://<>.mybluemix.net/red/
- Click on the top-right menu and select Manage palette
- Click on the Install tab
- Enter node-red-contrib-chatbot on the search module textbox and click install
- Once the node has been installed, click Done
- Import the following code snippet into your Node-Red editor (as shown below)
Node Red – Flow Json
[{“id”:”d8b7d11f.3308a8″,”type”:”function”,”z”:”85b387ba.b14b2″,”name”:”Leonardo – Translation Input”,”func”:”msg.url = ‘https://sandbox.api.sap.com/ml/translation/translate’;\nmsg.method = ‘POST’;\nmsg.headers = {\n ‘Accept’:’application/json;charset=UTF-8′,\n ‘APIKey’: ‘USE YOUR API KEY‘,\n ‘Content-Type’:’application/json’\n};\nmsg.payload = \”{\\\”sourceLanguage\\\”: \\\”\” + msg.srclang + \”\\\”, \\\”targetLanguages\\\”: [ \\\”\” + msg.destlang + \”\\\” ], \\\”units\\\”: [ { \\\”value\\\”: \\\”\” + msg.payload + \”\\\”} ]}\”\nreturn msg;”,”outputs”:1,”noerr”:0,”x”:910.2856750488281,”y”:141.99999618530273,”wires”:[[“78266e49.d461c”]]}]
Create and Configure Watson Conversation Service
- Open Bluemix console and click Catalog
- Select Conversation under Watson and click create leaving everything as default.
- Once created, click on the Connections tab and click on the Create Connection and select your CloudFoundry app and click connect.
- To understand Watson Conversation service in detail please refer to https://www.ibm.com/watson/developercloud/doc/conversation/configure-workspace.html.
- Just for this demo purpose open your conversation service and find the Launch button and click it to launch the tooling for the conversation service.
- Click Import to import the workspace json file which defines the conversation workspace.
- Don’t forget to keep a copy of your Workspace ID and use it later to configure the conversation service inside Node-Red flow (as shown below).
Generate API key for Leonardo Translation API
To use this translation API you need an API key which you can generate on https://api.sap.com/#/shell/discover/contentpackage/SAPLeonardoMLFunctionalServices/api/translation_api by clicking the “key” icon. Use the generated key inside the Node-Red flow code to replace ‘USE YOUR API KEY’ string.
After all these changes, you are now all set to “Deploy” your node-red flow and see the live action!
The complete flow should look this.
Let’s now test the Leonardo’s Language translation API integration with Watson’s Conversation capability using Telegram
This is just a beginning of the friendship between Watson and Leonardo and I hope in the coming days we will see more and more APIs from both these machines complementing each other….
……………………….
Nice start Avijit. Thanks for sharing the details and opening up a new world of possibilities!!!
Thanks for your comment
This is good stuff Avijit. With the IBM-Ariba Watson Leo partnership we should continue and create more value for joint clients.
Thanks Devraj.
Dear Avijit
This is the journey from Good to Great ! Keep it up.
Thanks for your comment and really means a lot.
Hi Avijit
Very interesting integration indeed. So many options opening up to bring more value to clients in their digital transformation journey!
Yes indeed. Thanks for your comment.
That's really interesting!
Can we implement CHAT BOT application in smart devices such as i-pads etc? with Watson's conversation capabilities. Thanks .
Yes absolutely. These chat bots are specifically designed for all kinds of mobile devices and also desktop.
--> workspace.json file does not find. Would you upload this file again please.