'Beyond Bitshares' - An open source Google Assistant bot! (WIP)

in #bitshares7 years ago (edited)

'Beyond Bitshares' - An open source Google Assistant bot!

In my last couple Steemit posts, I wrote about developing a HUG REST API for the read-only python-bitshares functions in order to expose said functionality for public Bitshares service utilization.

Given the open source nature of the HUG REST API & the in depth installation documentation, anyone can utilize the tech for whatever Bitshares project they're interested in implementing.

My next Bitshares project is a Google Assistant, this will potentially expose millions of new users to Bitshares through their mobile phones, their watches (in the future) and their dedicated google home devices. It will be first launched in English, and translated into multiple languages once in a production state.

How?

Bitshares HUG REST API

The Bitshares HUG REST API repo provides the Bitshares network an open-source high performance interface to the Bitshares network through simple GET requests.

We will be interacting with the HUG REST API server directly using NodeJS hosted on Firebase Cloud Functions (see below).

Pricing

For each 1 CPU, we can get between 2-4 workers to interact with NodeJS function calls, so each CPU should serve approx 10-15 Google Assistant users. I currently use Vultr which has reasonable pricing for VPS, I'm currently paying $10/month for a single core VPS to host the HUG server.


Oxarbitrage's "BPAB - Bitshares Python Api Backend"

My Bitshares HUG REST API does not provide some of the more advanced functionality than that which Oxarbitrage's "BPAB - Bitshares Python Api Backend" provides.

In the future, I'll investigate original (non copy/pasted) HUG implementation, however for the short term I will likely utilize this API for the following functions:


Dialogflow

I'll be utilizing Dialogflow (formerly API.AI, bought by Google in 2017) to handle the interpretation of user input, producing rich entities (for the fees & about section for now, perhaps assets later) and to build the intent functionality/logic which is effectively the skeleton of the Google Assistant.

With Dialogflow, you create an intent and provide it 'User says' information such as "Show me the current USD:BTS orderbooks" and Dialogflow will detect which intent to trigger (the orderbook intent), as well as extract the trading pair (USD:BTS in this case) for providing as input to NodeJS (and subsequently the HUG REST API).

What I find most difficult about using DialogFlow currently is that users don't have to follow set out paths through the bot, they can trigger any area of the bot (unless certain steps are mandatory) so you need to account for the user being in one area of the bot's functionality then jumping to another area without bringing along historical data from the previous intent/function which could glitch the operation of the bot unexpectedly. You have to program defensively against this issue whenever expecting input from the user.

For the first version of the bot, once the user is provided information they will be force-quit out of the bot (using app.tell()) rather than asking them what they want to do next. The reason for this is that when you ask (app.ask()) what they want to do next, you need to provide a fallback intent (if they provide invalid user input, re-prompting as error handling) for each intent (at the moment there's approx 28 such intent functions) so their coding right now would be throwing thousands of lines of template code in without real functionality - so it's on the back burner for now!

Pricing: FREE!

Repo link: BeyondBitshares-Dialogflow


Firebase

I'll be utilizing Firebase's cloud function hosting to provide Dialogflow the webhook fullfilment required to communicate with once the user has triggered intents through the Google Assistant application/device.

Code hosted on the Firebase cloud function platform is programmed in NodeJS, it's not too difficult to be honest, difficulties arise in the lack of complete documentation (likely to be fixed by Google & its community) and the fact that we'll we working with a single huge NodeJS script (instead of many files).

With the current template code in place (only about 10% complete the current functionality), the line count is already over 2000 lines so it'll probably end up 4000 lines before we start throwing in additional language support.

Pricing

Since we're going to be interacting with the Bitshares HUG REST API (an external networked service), we cannot use Firebase's free tier (only allows external networking to Google services). The cheaper option for now is to pick the 'Blaze Plan'.

Repo link: BeyondBitshares-Firebase

License?

I've open sourced this entire project using the MIT license (both the Dialogflow and the NodeJS web fulfillment code components). The HUG REST API code is already MIT licensed on GitHub.

With this project anyone will be able to fork and run their own clone of the Beyond Bitshares bot. Hopefully rather than immediately forking and competing though we'll work on the one bot together :)

TODO

  • Potentially update HUG REST API to include 'success' fields when everything went well, we're already checking for this in the Firebase code.
  • Work on each of the intent's functions, interacting with the data retrieved from HUG. This is probably the largest area of work right now.
  • Work on each intent's "User says" sections, including the handling of parameters (Account, Asset, Worker, Committee member, etc..).
  • Move from App.Tell() (force quitting after fulfilling user request) to App.Ask() to continue the user's interaction with the bot.
    • This will require providing each intent with a fallback intent, probably a thousand lines of near duplicate code unless I can squish it down somehow..
  • Investigate Asset entity generation, so that USD can be called by 'USD, bitUSD, united states dollar market pegged asset, USD smartcoin, etc...).

Thoughts?

I'd love to hear your thoughts about this project, anyone interested in using or helping develop this bot? Do you think this will be beneficial for the Bitshares network?

What are your initial impressions of the Google Assistant compared to other bots?

Do you have your own ideas for a Google Assistant bot?


Best regards,
@cm-steem

Sort:  

God bless you.

Holy crap this is incredible. I have thought Bitshares had a lot of potential for a while now, but nothing close to this.

Hi @slapbox, I own tons of BTS since 5 cents.
If you want to invest and learn Crypto's?
@haejin and/ or https://www.cryptosclass.com/

Could quite easily create a similar HUG REST API for Gridcoin & provide a similar Google Assistant. The difficulty would be establishing and maintaining accurate BOINC statistics & how to serve this data up efficiently.

it's very very very very very very good.....I don't understand anything but the pictures seem cool...but I believe you should add naked girls

with big boobs like Pamela Anderson

Wow. This is just so far beyond my abilities, I can hardly begin to understand how this works, but it's definitely incredible stuff.

It's pretty complex when you first get started, it took me well over a week to get my bearings straight, but once you've figured things out it's pretty much just javascript and messing around with dialogflow.

I love the way machine learning is going, so you don't need any NLP toolkit?

Dialogflow makes the NLP extremely easy, you just provide 10+ examples of what they use might say in order to trigger a certain function, including the handling of variables mid sentence & it handles the rest. Pretty smart stuff!

No one knows what potential of Bitshares.

hay i have up voted you now up vote me

very nice post!!

it would be nicer if it would have boobs

Loading...

BTS is future!

nah...the future is Pamela Anderson

It was just yesterday when i came to know about the bitshares. Specially its link with the Steem. Surely i would love to see something similar to google assistant on my smartphone. This post of yours contained a lot of technical information, most of which went over my head. After Reading through this post almost twice all i managed to understand was that you are trying to make this technology mainstream by bringing it to peoples smartphones and smart watches.

As far as google assistant is concerned i believe that this platform still needs some development. Google assistant comes kind of handy for elderly people. This is just my personal opinion.

Surely i would love to see something similar to google assistant on my smartphone.

What smartphone device do you have? It's also available for iOS devices.

As far as google assistant is concerned i believe that this platform still needs some development.

I fully agree, It's still in its infancy - Alexa has several years head start, but Google's putting serious effort into competing with them.

Google assistant comes kind of handy for elderly people. This is just my personal opinion.

Certainly, it makes it easier for the elderly to Google things, and I've even read ideas regarding checking up on elderly relatives or calling for help if they've fallen, or even helping to reassure those with degenerative diseases (answering repetitive questions, potentially learning how to properly interact with and calm down upset individuals, etc).

There are endless possibilities for Google Assistant applications/use-cases.

I personally use an android device. I rarely use google assistant but i have taught my mother to use it. She was having difficulty navigating through contacts and making calls. Most of the time she was putting extra pressure on the screen because of which she would end up calling anyone on the list. In order to ease this process out i saved a custom contact list on her phone and taught her how to use google assistant .

good article
i have up voted you now up vote me

hay i have up voted you now up vote me

Google has everything don't they?🌎

yeah they are way ahead.

They'll soon have a Bitshares block explorer bot, so yeah almost everything ;D

GOOGLE RUNS THE WORLD

This sounds like a terrific idea! However, if your bot becomes very successful, your cost in Firebase will likely skyrocket, because every single query will go through your cloud server.

Meh, Google offers $200 free credits/month for new 3rd party Google Assistant bots, plus in the event that I've got thousands of concurrent users that'll be worth the billing & I can switch from pay-as-you-go to the 'flame plan' firebase payment option.

salam kenal master, posting a very extraordinary, very interesting deserve extraordinary appreciation, best regards friendship from me user aceh steem Indonesia, please give directions for us in order to manage steemit well and true
THANK YOU

please give directions for us in order to manage steemit well and true

Post about things you enjoy doing? Start projects, and show Steemit users them. Meaningful content is better than copy/paste spam.

I think it is a very interesting initiative, the future is now and with the new technologies of today such as computers, android phones and watches too, in them there is a lot of intelligence and creating these new software would be very good. thanks for sharing this information

hay i have up voted you now up vote me