I added a video on how to create a Skill in the cloud, compile it there, then suck it back to a desktop, set debug break points, and continue to debug locally.It doesn't have commentary yet, but I'll get to it.
Retrogaming, Single Boards, Natural Language Processing, Computer Programming, Software Engineering
Showing posts with label #bots. Show all posts
Showing posts with label #bots. Show all posts
Monday, 9 September 2019
Tuesday, 23 July 2019
Thursday, 21 March 2019
90 day new user estimates
Looking at how many users on Google or Microsoft are using my skills.
| Microsoft | ||
| Art of War | 23 | 540 |
| Safety Moments | 54 | 101 |
| Meditations | 12 | 67 |
| Ambient Sounds | 65 | |
| AutoMate | 5 |
Art of War wins on Google. Ambient Sounds wins on Microsoft. And hey, for all this effort, at least Google is sending me a T-Shirt. I suspect Colossal Cave will beat them all...
Google tells me on average 15 new users a day try Art of War.
Thursday, 28 February 2019
Cortana Hosting Off Azure
Yesterday I decided to start moving my skills off Azure. Messaging is still handled by bot service, but the bot lives elsewhere. This is in no way a comment on Azure App Services. It has everything to do with me paying for a GoDaddy VM and I want to have everything in one place. Sure, its not scalable in its current form, but who cares when you have insignificant TPS.
The things that Azure App Services give you for free... a SSL certificate so you can use HTTPS (that you must for bots messaging) and a preconfigured IIS web server that is always managed (because its a container). But its the free tier restrictions... you can't set your web app and skill to "always on", so you get unloaded every 20 minutes. That means your skill will timeout when invoked, and that's a really crappy experience. I wonder how many people actually try a skill twice after it craters the first time? You also can't use web jobs to tickle the endpoint.
So, first step, install Apache. In hindsight, I should have paid GoDaddy the managed fee (that was reasonable, $50 or so) to configure Apache - with their bundled 509 Cert. What a pain... I don't miss running my own web servers.
Why run Apache? Because you want the web server to take care of the SSL for you. It is a lot of work to build a bot supporting HTTPS without a web server. So the trick is, get Apache to handle the secure request, and then tunnel it via proxy to a port without SSL.My node.js bots - they don't know anything about SSL.
How to have all my bots run in one place? Multiple proxies that redirect based on different paths. Instead of https://myserver/api/messages, we now have http://myserver/mybot/api/messages. And the latter redirects to different local ports via a proxy to http://localhost:3000/mybot/api/messages.
Then you have a choice of registering the Cortana skill via a Bot Channel Registration (the right way), or swap out the endpoint after creating a Web App Bot. Why would you want to do the latter? Updated: Because there is a bug in Bot Channel Registrations. Do not use Bot Channel Registration until the glitch is fixed. Create a web app bot, configure the Cortana channel, and then change the bots end point (and tombstone the Azure app service).
I will add my web.conf here when I have time. It is magic that I'll never remember. And the next trick is running node as a daemon. My VM is running Ubuntu server - so
bash -c 'nohup node app &>/dev/null & jobs -p %1'
The things that Azure App Services give you for free... a SSL certificate so you can use HTTPS (that you must for bots messaging) and a preconfigured IIS web server that is always managed (because its a container). But its the free tier restrictions... you can't set your web app and skill to "always on", so you get unloaded every 20 minutes. That means your skill will timeout when invoked, and that's a really crappy experience. I wonder how many people actually try a skill twice after it craters the first time? You also can't use web jobs to tickle the endpoint.
So, first step, install Apache. In hindsight, I should have paid GoDaddy the managed fee (that was reasonable, $50 or so) to configure Apache - with their bundled 509 Cert. What a pain... I don't miss running my own web servers.
Why run Apache? Because you want the web server to take care of the SSL for you. It is a lot of work to build a bot supporting HTTPS without a web server. So the trick is, get Apache to handle the secure request, and then tunnel it via proxy to a port without SSL.My node.js bots - they don't know anything about SSL.
How to have all my bots run in one place? Multiple proxies that redirect based on different paths. Instead of https://myserver/api/messages, we now have http://myserver/mybot/api/messages. And the latter redirects to different local ports via a proxy to http://localhost:3000/mybot/api/messages.
Then you have a choice of registering the Cortana skill via a Bot Channel Registration (the right way), or swap out the endpoint after creating a Web App Bot. Why would you want to do the latter? Updated: Because there is a bug in Bot Channel Registrations. Do not use Bot Channel Registration until the glitch is fixed. Create a web app bot, configure the Cortana channel, and then change the bots end point (and tombstone the Azure app service).
I will add my web.conf here when I have time. It is magic that I'll never remember. And the next trick is running node as a daemon. My VM is running Ubuntu server - so
bash -c 'nohup node app &>/dev/null & jobs -p %1'
Tuesday, 13 November 2018
Actions On Google
Well, after some frustration, I have a chat bot working on Google Actions. But now that the frustration is over, the flood gate is open!
The first challenge; using my existing code. Safety Moments, my first skill, uses json files. I needed to upload them to a Google bucket. And then, for whatever reason, the promise loading these files took > 5s to execute (a download of a file <1K), so my conversation was over before my content loaded. There was no synchronous hack I found. Then, I figured I'd load them on invocation of the cloud function. It worked for a while, and then it just stopped working. No idea why. I received connection resets downloading the files. So second solution? Embed all the json in the webhook itself. (What is a webhook? It is the node code that fulfills the request to do something after LU digestion.)
The second challenge; competing SDKs. It looks like Dialogflow and Actions on Google were inseparable. But they are. And if you follow the code examples for Dialogflow (that I did, because it looked like a really cool tool compared to LUIS), you will discover mismatches between how Actions On Google (for assistants) implements bot behavior. So... I couldn't immediately figure out what was Dialogflow SDK (agent.add) and what was Actions SDK (conversation.ask). It manifested itself in my conversation data not persisting and me scratching my head.
The third challenge; moving targets. The Google tech is migrating from V1 to V2, and Dialogflow seems not to have caught up to Actions. Part of my confusion was out-of-the-box webhooks were V1. Dialogflow examples integrating with Actions was V1. But V2 is pretty much were all Actions documentation and examples sit. Ugh. Now I know what to look for.
What I Like
- International availability.
- Excellent TTS for female and male voice.
- Dialogflow (the tool) and how it builds intents (utterances) and actions (entities).
- You can build dev without charge.
- Events get fired when media stops playing.
What I Dislike
- You can't have a Card before a SimpleResponse. I use cards as banners.
- Cards can have one button, though the JSON supports multiple buttons. Why?
- You can't segment long conversations naturally. You have to make them turn based and granular. Not so good for my experiments.That will, in my opinion, seriously cripple enterprise capability.
- Your action will not pass certification if it does not end the dialog on a question. This forces dialogs to be very transactional.
References
Actions on Google and Dialogflow.
Useful documentation
- https://developers.google.com/actions/assistant/responses
- https://developers.google.com/actions/reference/nodejs/lib-v1-migration
Friday, 13 July 2018
Get your Azure QnA Bot to Speak with Cortana
Building a QnA bot and hooking it up to Cortana is simple in node.js under BotFramework V3.
If you have a FAQ that is in Q: A: format you can import it via the Azure QnA Maker tools and auto-create a "knowledge base". No coding required. You can do this here https://www.qnamaker.ai.
The next step is creating your bot. Microsoft has standardized on their botframework to do this. https://dev.botframework.com is your gateway.
If you are like me and like the simplicity of node.js then pick the QnA template.
Then go back to the Azure portal and update your bot for the Application Settings blade sections shown here.
The test web app will now be successfully linked to your QnA bot! But don't forget the last step...
Go to your Channels blade and set up Cortana. Then, go to the build blade and open the online editor. In the app.js code, you will see that the template uses the standard QnA dialog builder - that does not say the resulting answers back with the Cortana speech channel. Add an override like this.
(See GitHub QnAMaker patch for a V4 node example.)
There you have it. Now "Hey Cortana, ask Bernie Question Bot Test what is a dwarf planet?"
For C#, it is slightly more complicated. You need to subclass the the BasicQnAMakerDialog with something that sends a message with speak attached. This is done as an inner class of RootDialog (from the V3 C# template that comes with Azure Web App Bots.
// Dialog for QnAMaker GA service
[Serializable]
public class BasicQnAMakerDialog : QnAMakerDialog
{
// Go to https://qnamaker.ai and feed data, train & publish your QnA Knowledgebase.
// Parameters to QnAMakerService are:
// Required: qnaAuthKey, knowledgebaseId, endpointHostName
// Optional: defaultMessage, scoreThreshold[Range 0.0 – 1.0]
public BasicQnAMakerDialog() : base(new QnAMakerService(new QnAMakerAttribute(RootDialog.qnaAuthKey, RootDialog.qnaKBId, "No good match in FAQ.", 0.5, 1, RootDialog.endpointHostName)))
{ }
// Override to also include the knowledgebase question with the answer on confident matches
protected override async Task RespondFromQnAMakerResultAsync(IDialogContext context, IMessageActivity message, QnAMakerResults results)
{
if (results.Answers.Count > 0)
{
IMessageActivity response = context.MakeMessage();
response.Text = "Here is the match from FAQ: \r\n Q: " + results.Answers[0].Questions[0] + " \r\n A: " + results.Answers[0].Answer;
response.Speak = response.Text;
response.InputHint = "acceptingInput";
await context.PostAsync(response);
}
}
}
(See GitHub QnAMaker patch for a V4 C# example.)
Thursday, 12 July 2018
Building Bots in Azure
I am starting to build Cortana bots. So far its been interesting.
I had trouble building the Azure function bots from template. The node.js example for the simple "echo" bot... First crack, the Azure "Test in Web Chat" didn't work. Errors implied there was a permission issue.
I tried again, and had a deployment error on the bot function template.
I tried again, and on the third try it deployed. To my knowledge, I did nothing differently.
The advantage of a function bot over a web app bot is supposedly pay per invocation (that should be cheaper, right)? The issue with the example code for node.js on the function bot is that every potential used library is embedded in the index.js code where the two line "echo" functionality is embedded in the middle!
WHY? Why? Well, javascript as a language doesn't have a '#include' statement. Client side, you do the includes on the document for your browser to take care of.
In node, we have requires... that allows us to load modules. But why is this not used in the function bot example? I figure its a work around. But the down side is this: every time I edit the function in the portal for this example, I am touching a 200K line file!
Subscribe to:
Posts (Atom)