Closed yashpatel001 closed 5 years ago
How to update dynamically register value available in dialog node response .
@yashpatel001 what version of the SDK are you using?
pip install --upgrade "watson-developer-cloud>=2.4.0"
@yashpatel001, I am not fully sure I understand your question.
I believe you created an issue in the java sdk as well, did you find the answer in the example folder?
@ehdsouza for java i found but i didnt found for python.
i want to update register value in dialognode json response dynamically.
please help for python.
@ehdsouza
input text = "hii"
{
"output": {
"text": {
"values": [
"$(data)good morning"
],
"selection_policy": "sequential"
},
"txcom": 1
}
}
through code if i will give input text ("hii") + data register value ("yash")
Response should come $(data)good morning = yash good morning
@yashpatel001 could you show the java code, I could give you the equivalent python
HashMap<String,String> abc = new HashMap();
abc.put("data","How are you");
Context co = new Context();
co.put("data","How are You");
newmessageoptions = new newmessageoptions.builder()
.workspaceid("")
.input("First message")
.context(context)
.build()
messageResponse response = assistant.message(newmessageoptions).execute();
context = response.getContext();
newmessageoptions = new newmessageoptions.builder()
.workspaceid("")
.input("Second message")
.context(co) // passing data register value how are you
.build()
@ehdsouza please provide for python same
@ehdsouza i shared sample code now give python code
@yashpatel001 She is on vacation until next week. I will try to take a look but I don't have time this week :(
@yashpatel001 here is the equivalent code:
response = assistant.message(
workspace_id='',
input={
'text': 'First message'
},
context={
'data': 'How are you'
}
).get_result()
print(json.dumps(response, indent=2))
context = response['context']
response = assistant.message(
workspace_id='',
input={
'text': 'Second message'
},
context=context
).get_result()
print(json.dumps(response, indent=2))
For code help, I would advice you to use: https://stackoverflow.com/questions/tagged/ibm-watson. We open issues here if there are any problems in the SDK.
@ehdsouza Thank you so much , it is working fine
Expected behavior
Actual behavior
Steps to reproduce the problem
Code snippet (Note: Do not paste your credentials)
python sdk version
python version