Thursday, July 13, 2017

Chatbots: Testing Contexts

Watson Conversation Tool in action
Some weeks ago I blogged about a tool I wrote for the IBM Watson Conversation Service (WCS). It allows you to manage your conversation workspaces from the command line and to test dialogs. Yesterday, I added a new feature to it that helps me (and you) to examine and modify the dialog context. Here is how you can test contexts with my watson conversation tool.

The tool features a "dialog" option. Once in that mode, the tool asks for an input message, sends it to WCS and dumps the entire answer and waits for the next input. So far, so good. That option helped me to understand the JSON-based metadata and how it is moved throughout an ongoing chat. As a next step, I wanted to modify it, to send specific user context variables to the conversation service.

To accomplish that I decided to persist the current session context in a file "session_context.json". Once a response from WCS is received, the context metadata is stored to the file. I can inspect and modify the data. After the next input message is typed in, the tool reads "session_context.json" again and picks up any changes.

At the start of the dialog option, the tool asks whether to begin with an empty context or try reading the "session_context.json". That way, previous sessions can be resumed or, if only user variables are present in the context object, initial values be passed into WCS.

That's today's update on the watson conversation tool. If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or create an issue against the mentioned GitHub repository.