Context not returned for run_actions
gruban opened this issue · 1 comments
gruban commented
When I use this example from the Readme:
actions = {
:say => -> (session_id, context, msg) {
p msg
},
:merge => -> (session_id, context, entities, msg) {
return context
},
:error => -> (session_id, context, error) {
p 'Oops I don\'t know what to do.'
},
}
client = Wit.new access_token, actions
session = 'my-user-session-42'
context0 = ""
context1 = client.run_actions(session, 'what is the weather in London?', context0)
p "The session state is now: #{context1}"
Then the output is "The session state is now: "
It seems like the input context is always returned, not the output-context.
patapizza commented
Context should be a Hash
.
I updated the code to throw an exception when it's not the case.