Beyond Bitshares Google Assistant upgrading to latest 'Action on Google' alpha release!

in #bitshares6 years ago (edited)

Beyond Bitshares Architecture

Beyond Bitshares Google Assistant Updates!

I last wrote about creating the Beyond Bitshares Google Assistant on Steemit about 3 months ago now, since then I've been focusing primarily on my studies, however with a temporary gap between classes and exams I began upgrading the Firebase cloud function for Beyond Bitshares from actions-on-google v1.10.0 to v2.0.0-alpha.

The alpha Actions on Google (v2.0.0) library was released earlier this month, they're collecting feedback from the Actions on Google developer communities and will decide their next development priorities on April 2nd 2018.

It's worth noting that Beyond Bitshares is one of the only open source Google Assistant cloud functions available, other than Google's Samples. Hopefully other Google Assistant developers can more easily migrate to the new version by going through Beyond Bitshares code!

This upgrade was required to migrate from Dialogflow v1 to v2, which brings the latest functionality offered by Dialogflow - BeyondBitshares is going to enjoy the following new functionality:

The most exciting new feature is 'Speech recognition - Google Cloud Speech' which will hopefully enable the Google Assistant platform to finally differentiate between two users in the same room. This will greatly improve security of our google assistant interactions, potentially enabling non-read-only Bitshares functionality in the future.

New features = new charges?

Dialogflow v2 functionality does appear to come with new quotas:

As long as we're below our usage quotas it should be free:

That said, the plan isn't to create a Google Assistant which nobody will use, rather we want as many users as possible! It does mean that private development instances or small testing environments will cost next to nothing to operate, which will drastically inflate the potential developer base around the world!

Whilst Dialogflow v2 looks to become a new source of bills (once above usage quotas), Firebase has modified their Blaze payment package (required for cloud function to contact external REST APIs) to offer free usage which means whilst the Beyond Bitshares userbase is small it will likely not cost anything to run. Check out their pricing comparison & calculator.

So what's changed?

Silvano Luciani (Google Assistant Developer Programs Engineer) wrote an excellent article on Medium regarding the changes between v1.10.0 and 2.0.0-alpha, it's worth a read!

The TL;DR changes for Beyond Bitshares

  • A massive reduction in pointless code, especially surrounding matching intents to functions, no more action mapping nor static declaration at the start of the code, now just app.intent('intent_name', conv => {conv.close('Thanks for talking to me!')}) which is much simpler and less tedious.
  • Asynchronous code enforcement - required the creation of promises which the function waits for before continuing (external REST API communication). This was a large change for most existing Beyond Bitshares functions, however the code is a lot more readable now. A major thanks to Shuyang Chen for helping me on Stack Overflow regarding this!
  • With the move to Async code, the HUG request has been converted so a function thus reducing code within each intent's function.
  • Dialogflow:Firebase verification has changed - requiring a simple header property in the dialogflow app object. Thanks to Shuyang Chen again for providing this information on stack overflow!
  • Much neater code thanks to the v2.0.0-alpha's more idiomatic JavaScript functionality.
  • Check out the new index.js file, compared to the old index.js file!

What is the TODO list for Beyond Bitshares?

  • Test each function, extract the error messages when they fail for debugging.
  • Parse input from DialogFlow (e.g. an username or asset name) for use in each function (currently set to static variables for testing).
  • Create entities for asset-id:asset-name, account-id:account-name, committee-id:committee-member-name, etc. So that we're able to more easily parse input data from what the user says to the bot.
  • Move from conv.close()to conv.ask() for all functions (aside from the goodbye function) so as to not immediately throw away our users, we want to offer them the ability to easily search for more information through the bot.
  • After move from close to ask, create generic fallback for all functions which allows the input of responses and suggestons as input variables (so as to create a template function, but allow for per-function custom fallback text). Will probably store the data in context data storage.
  • Create private Bitshares full API server for the HUG REST API to have local access to; this will hopefully reduce time taken to return responses - we need to be way below the 5 second max response time. Most functions don't take this long, however with increased load this will be a concern, besides it'd be better to provide immediate Google Assistant responses.
  • Investigate generalizing text fields, for enabling localization (to reach a worldwide audience). Check out this related Medium article regarding Google Assistant localization.
  • Get Beyond Bitshares into a production state & submit to Google for publishing. Once published, I'll open source the Dialogflow export on Github using the MIT license.

Interested developing your own Google Assistant?

You should consider attending your local 'Build Actions for your Community' events being hosted by Google Dev Groups to learn about the platform in person.

Alterantively, consider trying to create your first Dialogflow based Google Assistant, bearing in mind that these tutorials will likely change in the next month or two as v2.0.0-alpha becomes the master branch.


Got any questions regarding Beyond Bitshares or the Google Assistant platform? Comment below!

Would you consider approving a Bitshares worker proposal to cover this development in the future?

Best regards,
@cm-steem

Sort:  

First of all, I want to say something you.
@cm-steem a big congratz to you. Now you have 3000 followers & i am very happy for that because I am the very lucky persona who is the number 3000!
i feel very happy now.
any way thanks again for this important information share with us. i hope now we are enjoying more facilities on them. Thank you

Thank you @angelina66 for this happy news. @cm-steem congtas to you 3000 follower achieven
@angelina66 you resteem this post, that's why i see this important post. Thanks

thanks for your feedback

At last google provide "alpha release! (v2.0.0) " Very exciting news..@cm-steem.. Hope that we got more facilities in this version..

Wow that's a very good news for bitshares. finally they are upgrading to latest 'Action on Google' i think its a good choice. now they are more powerful & hope so provide us more features & good facilities also. @cm-steem thank you so much for ypur great information share with us.

this is a very important update that lands a little over one year after they published v1 on NPM. they spent this year listening to feedback from developers who used the library to build apps for the assistant & using the client library ourselves to write sample applications. they learned a lot. then they are upgrading this new version v2.0.0. that's a good changes. very well work. keep it up.

Now the alpha actions on Google (v2.0.0)!
its a very good news because bitshares now have best place. every one should be happy now to see this new feature. Silvano Luciani write about this new change. its so good. @cm-steem thank you so much from my heart for this best news.

@cm-steem that's great. many many congratulatuons to you for your new achievments. now 3000 followes! its a big one. carry on. we are always with you.
by the way, its big change by bitshares but we are happy to see their changes. its a good for us for this new features. i hope so they are now wotking their best. best wishes on then and thanks to you for this information.

image-1.png
wow! its big changes of us. i really like this new upgrading. this is very helpful for us. specially audio requests are so important us. its very amazing news @cm-steem. i am very happy & excited to see this upgrading news. thanks.

amazing google programming.......

Hopefully post better

amazing google programming post thank for shearing

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.030
BTC 57951.98
ETH 3051.79
USDT 1.00
SBD 2.26