How to give a personalized greeting to Watson's conversation?

While we are defining a dialogue in a Watson conversation, I cannot greet the user with my name or I cannot detect the contact number sent by the user and rephrase it to the user. Is it possible to do this in Watson Conversation Api or not.

+4
source share
3 answers

Do you already have access to this information? You can send these values ​​through the context and access them using $ context_variable. The same goes for collecting information from the user. You can grab things with regular expressions through your application or using some Spring expressions, you can see text.matches here: https://www.ibm.com/watson/developercloud/doc/conversation/dialog_reference.shtml Would you save this as a context, and then referenced it using $ context_variable. Information such as names and phone numbers is fairly open, so it’s difficult to capture it without using the mechanism for extracting open objects, which we examine as the best ways to enable it.

+4
source

, .

1. conversation_start node "Hello <? context.username ?>".

enter image description here

2. - (Python).

import json
from watson_developer_cloud import ConversationV1

conversation = ConversationV1(
    username='SERVICE_USERNAME',
    password='SERVICE_PASSWORD',
    version='2016-07-11')

workspace_id = 'WORKSPACE_ID_CONVERSATION'

response = conversation.message(workspace_id=workspace_id, context= {'username':'Simon'})

print json.dumps(response)

3. , : "" - , .

{
  "entities":[],
  "intents":[],
  "output":{
    "log_messages":[],
    "nodes_visited":["node_1_1472298724972],
    "text":["Hello Simon"]
  },
  "context":{
    "username":"Simon",
    "conversation_id":"9dc1501b-ac53-4b51-a299-37f5314ebf89",
    "system":{
      "dialog_turn_counter":1,
      "dialog_stack":["root"],
      "dialog_request_counter":1
    }
  },
  "input":{}
}

, . , REST API, , . , , .

+6

, :

"context": {"yourVariable": "<?input.text?>"}

:

"output": {"text": "You entered this $yourVariable"}
-1

Source: https://habr.com/ru/post/1653027/


All Articles