CONVERSATION Service - Let's Explore!

POSTED IN: Building Bridges from R to IBM Watson


I wrote some R Hooks to talk with Conversation service - here:







IBM Watson Launched CONVERSATION Service July 2016 - - here is what I found on my 1st tour....


Step 1 - Go To Bluemix https://console.ng.bluemix.net/ and select USE SERVICES OR APIs  (signing up to free account takes 2m)

here is bluemix dashboard.  click bottom right box to launch a service




new tile!  Conversation.  It's a mashup of NLC, Dialog and other services.  with terrific UX/tooling



Step 3 - Think of a nice name and CREATE  - you can leave it unbound.

creating the service in bluemix.  Takes about 10-20 seconds to be available.


Step 4 - Select LAUNCH TOOL (bottom right)

this is the step I normally go to "Service Credentials" and start hammering service.  For now, as of July 2016 - the best way to create the Conversation Service is with Tooling.  Launch Tool! 


Step 5 - New tooling will launch - select CREATE.  Pick a name and some simple example of Chat Bot


my example was a basic intent detector for coffee, cheese, chocolate and wine.  Yum!


Step 6 - Start with basic INTENTS - Add a 3 or 4 intents to test - and give service 5-10 examples of user inputs that should MAP to intents.  (Classes) - this may look familiar to NL Classifier users. 

see NLC and Conversation documentation for details.  Links below.


Step 7 - Click on CREATE DIALOG.  Then start playing with nodes.  FIRST NODE - CREATE "conversation_start" and create new CONDITION (Starting node) - see docs for this.

experiment here - you can test real time, so you'll get hang of basic flow pretty quick


Step 8 - First box is prompt.  Then build a decision tree from your INTENTS like below #coffee and #chocolate . Also LOOP back (continue from -> Go to condition)

Also - create a LOOP back to start for testing "Continue From should click to "go to response" in the first conversation node (i.e. reset the talk once it provides answer)


Step 9 -  Try it out!  Test using icon top right corner


Step 10 - FUTURE - Add downstream functionality - I have some NL CLassifier Ground truths (Coffee, Cheese, Wine) that I'll 'wire in' - so Bot can ask follow up question and then recommend a specific delicacy.

Summary -  so in about 30 minutes of playing around we....

  1. Created a Bluemix Service called Conversation

  2. Launched Tooling

  3. Built some simple INTENT detectors

  4. Did a logic flow in Dialog

  5. Tested a simple bot to detect whether I was interested in Coffee, Wine, Chocolate or Cheese.

I had a bit of a learning curve in Dialog area, so may blog more on that later.  Also, I am keen to plug my Code into this (hit APIs) so watch this space.



Other Conversation Links:

Build a chatbot in 6 minutes with IBM Watson Conversation






Appendix A - here is an example of curl/command line syntax



Ryans-MacBook-Pro-2:~ ryan$

curl -X POST -u e63f524d-b6f4-9999-905b-e6bXXXe99b87:KQ4d0EggCyGR -H "Content-Type:application/json" -d "{\"input\": {\"text\": \"hot coffee\"}, \"context\": {\"system\": {\"dialog_stack\": [\"root\"], \"dialog_turn_counter\": 1, \"dialog_request_counter\": 1}}}" "https://gateway.watsonplatform.net/conversation/api/v1/workspaces/2ded4293-871d-4b24-XXXX-4c8b1289be81/message?version=2016-07-11"


{error: no user with username '"intents":[{"intent":"coffee","confidence":0.9871662023563588' was found}],"entities":[],"input":{"text":"hot coffee"},"output":{"log_messages":[],"text":["I'm sorry. I don't understand. Please try again"],"nodes_visited":["node_9_1468894011999"]},"context":{error: no user with username '"system":{error: no user with username '"dialog_stack":["root"],"dialog_turn_counter":2,"dialog_request_counter":2},"conversation_id":"1f84342f-5aad-XXXX-b40f-dd1XXXb66b4f"' was found}' was found}



Appendix B - here is an example of R syntax:

library(RCurl) # install.packages("RCurl") # if the package is not already installed

username_CON <- "e63f524d-xxxx-xxxx-905b-e6b1d4e99b87"
password_CON <- "KQ4dxxxxxyGR"
workspace_CON <- "xxxxxxxx-871d-xxxx-xxxx-4c8b1289be81"


## testing
response <- POST(url=paste(url_CON,"/workspaces/",workspace_CON,"/message",version,sep=""),
                 body = '{ "input": { "text": "coffee cake" } }',
                 encode = "json"

response_text <- content(response, "text", encoding = "UTF-8")  # or encoding = "ISO-8859-1"


> response_text <- content(response, "text", encoding = "UTF-8")  # or encoding = "ISO-8859-1"
> response_text
[1] "{error: no user with username '\"intents\":[{\"intent\":\"coffee\",\"confidence\":0.9871662023563588' was found}],\"entities\":[],\"input\":{\"text\":\"coffee cake\"},\"output\":{\"log_messages\":[],\"text\":[\"Welcome to the Tasty Helper!  \\nWhat are you looking for?\"],\"nodes_visited\":[\"node_6_146889888885\"]},\"context\":{error: no user with username '\"conversation_id\":\"28c696cd-5694-4377-99a5-688888d3ab266\",\"system\":{error: no user with username '\"dialog_stack\":[\"node_6_14688888593485\"],\"dialog_turn_counter\":1,\"dialog_request_counter\":1}' was found}' was found}"










Interested in more content by this author?

About the Author

Ryan Anderson

Ryan Anderson

Hi! I like to play with data, analytics and hack around with robots and gadgets in my garage. Lately I've been learning about machine learning.

About this blog

This is an informal blog that explores tools, code and tricks that group members have developed to engage IBM Watson cognitive computing services - from the R Programming Language. Packages include RCURL to access Watson APIs - for services that include Natural Language Classifier and Speech to Text. THIS IS MY PERSONAL BLOG - it does not represent the views of my employer. Code is presented as 'use at your own risk' (it has lots of bugs)

Created: September 13, 2015


Up Next