Tuesday, November 20, 2018

IBM Cloud: The 5 minute barebone news chatbot

News chatbot with Watson Assistant
Do you have 5 minutes and want to build a really simple news chatbot? I tried this yesterday with IBM Cloud and the Watson Assistant and Discovery services. The result is on GitHub in my repository watson-chatbot-discovery-news. It utilizes my Watson Conversation Tool as user interface and for testing. Here are the details.

Let's talk News

The chatbot core is a simple dialog in Watson Assistant. A dialog node "client-side news" reacts to a detected "news" intent. The search phrase for the news items needs to be quoted and is defined as a pattern-based entity.

What are the headlines for "IBM acquires Red Hat"?
Any news on "gift ideas technology gadgets"?
Within the dialog node for news, a client call action channels all relevant information to the client and waits for the result. That result is then used within the response in the child node.
Dialog nodes for news chatbot

Discover News and Gadgets...

A simple Python function retrieves news from the Discovery service. It is invoked as client action by the CLI-based chatbot. The news items are then added to the defined context variable and fed back into Watson Assistant to form the message response. The tool as chatbot client then prints the response and ask for the next user input.

See the code and instructions on GitHub for more details on the setup. And if you are curious about the gift ideas, there are some top 10 and top 25 lists for technology gadgets in the news. Moreover, some news sites discuss security implications of those gadgets.

If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn.