If you’ve had to deal with managing streaming data, maybe you’ve heard of PubNub. Now it’s easy to add Watson-powered machine intelligence to those streams with BLOCKS, a feature of the PubNub Data Stream Network (DSN) that makes the network programmable. Using BLOCKS, developers can easily deploy functions on the PubNub network to modify messages without the need to manage their own infrastructure.
In a new episode of the Building with Watson webinar series, Josh Marinacci, Head of Developer Relations at PubNub demonstrates how he used the Watson Conversation PubNub BLOCK to build a geology-themed chatbot called Mr. Rockbot.
When you’re building a chatbot, you need to remember that a chatbot involves constant communication between the user and your bot. To tie these elements together, you’ll need a real-time, low-latency and high security infrastructure. The PubNub programmable network is designed for developing real-time applications like chatbots. It’s like a global Content Delivery Network (CDN), but for the streaming web (also known as a Data Stream Network or DSN). While a CDN is designed to serve static content, you can use a DSN like PubNub to conduct real-time communication.
A chatbot may need to interact with other platform proxies and access web services that provide the knowledge the chatbot needs to function successfully. Chatbots also require some level of artificial intelligence that can range from a phone tree, to full natural language processing or a rich neural net for the back-end.
Creating the example chatbot
Mr. Rockbot, the geology-themed chatbot example in the webinar demonstration, uses a serverless infrastructure and a number of third-party services. The client can be a phone or webpage. It then talks to the real-time network provider (PubNub) and computes in the network’s serverless compute system (PubNub BLOCKS). Here’s how the process works with Watson:
- The message goes to the network compute block, which uses the IBM Watson Conversation API to add natural language processing insights to the input text.
- You train the Conversation API to allow it to identify relevant entities and intents. Intents are possible chatbot actions and entities are targets of an intent, such as questions the user might ask.
- After you have entities and intents set up, you can then create dialogs, which are the workflows a user can follow. Using dialogs, you can specify what the bot actually says to the user in different circumstances.
- After you teach Watson Conversation, you can call the API from your serverless code using a simple HTTP POST.
Note that Watson Conversations is a stateless API, which means that to understand the context of a conversation, you have to provide this context on each request using a context structure.
To learn more about how you can add Watson-powered machine intelligence to your streaming data, be sure to check out the Building with Watson webcast.