Being able to interrupt a chatbot in realtime - streaming

My goal is to make a chatbot capable of reading a list of article titles (long list, could take 5 minutes for the chatbot to read orally the entire list) and the user can navigate in real-time on the answer saying: next, previous, share facebook, share twitter, read full article, go back to article list, etc. I think a rule based chatbot could make it, no NLP needed.
I started to develop my own conversation logic with Google Dialogflow. The chatbot reads the article list but it is not possible (orally !) to 'cut' the chatbot in the middle of the list to say: 'next', 'previous', etc... without having to at least repeat the name of the article or the article number which is not convenient for my needs at all.
For instance, the bot starts reading article titles: "article 1, Elon Musk reads books. article 2, self driving car industry hot. article 3, ... article n." When the bot reads "self driving car industry hot", the user says in the middle: "tell me more" (orally). And then the bot understands it was reading article 2 when it has been interrupted by the user so it goes to the article itself and read the full article.
Would be happy to hear about how to be able to build such kind of chatbot (only vocal is needed), in python would be appreciated. Ideally I would be able to put the bot as many places as possible (amazon alexa, google home, etc).

Related

Building a custom chatbot with GPT-3

I want to build a chatbot by training on my custom data. The procedure is provided by OpenAI at https://platform.openai.com/docs/guides/fine-tuning. I would like the bot to recommend my Facebook page at the end( Which is about movies) after having some meaningful conversation about movies with a customer. I want to leverage the power of Davinci model, as it is the most powerful.
My only question is, is there a chance I can include all the important information in the prompt, like features of my page, my website, etc, and then train it in the custom model(so I dont have to rewrite the whole prompt again for each user)? Because if I repeat the whole prompt again with all the information, my tokens will be consumed very quickly. Thank you.

Google analytics and different domain tracking

I asked this question directly to the Google Analytics community with absolutely no answer.
The question is as follow:
I have a AI based site, which give a customer a specific aid to select the right product he/she want to buy. The front ed application is React/js based.
My site is usually a small icon on a merchant site, and the user, while he/she is navigating the merchant site, can decide to recall clicking on a specific icon.
Then my site opens and help the user to select the right product(s) belonging to the merchant site. The product are choosen and then clicked to be added to the merchant cart.
Of course, there is a written agreement between the merchant and I to be signed, and some changes to the merchant site to incorporate my clickable icon: I'd like to pass a piece of code to the merchant including the icon and all the code needed to implement this kind of application.
So, given that the merchant call my site passing a specific transaction related token and the customer info (if any) when the user click on my icon, how can I:
directly add one or more items into the merchant cart
track the action made by the user after he/she leave me site and return to the merchant one to conclude the journey with a payment, so I can later invoice the merchant for the right commission
track if the user remove some (or all the) item from the cart, so I have less to nothing commissions to invoice.
I tried to follow the instruction given by google, but they are a mess, and I wasn't able to reach any conclusion.
Any help will be really appreciated.
Adding items to the merchant's cart is possible using some live API that the client would extend, but the easiest way to do it would be just using the window.postMessage(). So, I would suggest having your button implemented as a simple iframe. That will make it possible for you to send messages to the parent page from that button. The parent page, however, has to be ready to listen to those messages and add to cart whatever ids you specify. So the client devs will have to do some implementation for this to work.
Well, no, this is a bit too much to ask for. You can ask the merchant to share that data with you so that you could improve your algos (tune them for the client) and, therefore, improve the merchant's conversion rates (which is a win-win scenario), but the merchant would have to actively either implement parallel tracking to your instance of analytics (install your pixel, if you're willing to develop one), or share their own data with you.
That's what a lot of very similar services do. Let's say, Facebook. Facebook sells traffic. When you buy traffic, you generally don't want to pay for irrelevant/badly converting tracking, so you're implementing so-called facebook pixel. Facebook doesn't do this implementation. Client's developers/implementation experts implement it and trigger various events through it, making it send signals to the FB endoint, indicating which client this is from, for which campaign, what the action is page load, purchase, add to cart... Just take a quick glance at FB documentation: https://www.facebook.com/business/help/402791146561655?id=1205376682832142
Facebook is just an example. There are many-many services that do similar pixels. It may be not about selling traffic, it may be about adjusting site look and feel based on AI, or generating discounts and customizing conversion funnels, or even simpler stuff like feedback chat performance and suggestions modules. All these and more exist as third parties and pretty much all of the established ones use pixels for tracking.
If you don't want to spend time at the moment to make your own tracking logic, then implementing a parallel GA tracking will be a pain for you (for your clients, actually). Instead, it would be easier to enrich their data with your products. Let's say, have them implement a product-level custom dimension that would "paint" products added to cart by you and share the data with you.
Note that a client who goes for it must be a very loyal client since analytics data is normally treated as sensitive and is not readily shared with third parties, not mentioning the implementation of a custom dimension (or the using the expensive product parameters) just for a third party to count their conversions. Yes, it has to be a good friend that allows this.
Finally, you could ask them installing your GTM instance or giving you access to theirs, but that would effectively give you the power to execute arbitrary code on any of their page. I would never give a third party that power.
Tl;Dr: I would suggest making your own very simple pixel. Even though it sounds now like a lot of work, it will worth it if the project itself has real potential to be useful for ecommerce.
Exactly the same as 2.

How to maket chatbot to capture audio from a google meet?

I am new to developing chat bots. I am trying to figure out if there is a way for a chat bot in google meet to capture audio (or a transcript of the audio) of the whole meeting.
The only thing that seems to deal with audio to some extent I have been able to find so far is dialogflow but it still doesn't seem to offer what I am looking for:
- https://cloud.google.com/dialogflow/docs/how/detect-intent-tts
- https://cloud.google.com/blog/products/g-suite/keep-the-dialog-flowing-create-conversational-chatbots-in-hangouts-chat-with-dialogflow
You can't do this with hangout API. The only requests available for a Hangouts chat bot are the ones mentioned in the documentation of Hangouts Chat API:
spaces.get Returns a space.
spaces.list Lists spaces the bot belongs to.
spaces.members.get Returns a member.
spaces.members.list Lists humans (not bots) that belong to the space.
spaces.messages.create Creates a message.
spaces.messages.delete Deletes a message.
spaces.messages.get Returns a message.
spaces.messages.update Updates a message.

How to train watson conversation service?

I'm evaluating watson and part of this to upload Wikipedia data and then ask questions of this data. To achieve this I create a conversation service :
Note the text : 'You can input: Your domain expertise in the form of intents, entities and crafted conversation'
My understanding was that I could upload piece of text , in this case a wikipedia article' and then train watson on this text. After training I can then ask questions of watson in relation to the text.
This article seems to suggest this : https://developer.ibm.com/answers/questions/11659/whats-the-easiest-way-to-populate-a-corpus-with-content-like-wikipedia-or-twitter.html with regard to uploading data 'You could always pull the latest wikipedia dump and upload it. You do the upload through the experience manager, which is a web UI.'.
Reading https://developer.ibm.com/answers/questions/29133/access-to-watson-experience-manager-and-watson-developer-portal.html states : 'Currently Watson Experience Manager is only available to Watson Ecosystem and Watson Developer Cloud Enterprise partners.' The article is dated 2014, is this still valid ? I cannot upload a piece of text and train watson against this unless I'm a 'Watson Ecosystem and Watson Developer Cloud Enterprise' partner ? My only alternative is to train watson using 'intents, entities and crafted conversation' ?
Watson conversation service has three components to it.
1. Intents. These are questions with an "intent" key. For example "I can't log in" would have an intent of USER_ACCESS. For more details on this, read up on the NLC service.
2. Entities. These are keywords that share a common theme. For example: Weather is "sunny, rain, cloudy".
3. Dialog. This is the conversational flow or answers to questions asked in relation to Intent + Entity.
The conversation service documentation has a demo which explains it better. There is also a useful blog post outlining how to get started in six steps, and a video demonstrating how to quickly build a chatbot.
If it is a case where you want to analyse documents, there is Watson Explorer or Retrieve & Rank.
In relation to Watson Experience Manager. That is the older pre-bluemix version of Watson. It is no longer accessible. It had the functionality of NLC, Dialog, Retrieve & Rank, Document Conversion.

Realtime Twitter Replies?

I have created Twitter bots for many geographic locations. I want to allow users to #-reply to the Twitter bot with commands and then have the bot respond with the results. I would like to have the bot reply to the user as quickly as possible (realtime).
Apparently, Twitter used to have an XMPP/Jabber interface that would provide this type of realtime feed of replies but it was shut down.
As I see it my options are to use one of the following:
REST API
This would involve polling every X minutes for each bot. The problem with this is that it is not realtime and each Twitter account would have to be polled.
Search API
The search API does allow specifying a "-to" parameter in the search and replies to all bots could be aggregated in a search such as "-to bot1 OR -to bot2...". Though if you have hundreds of bots then the search string would get very long and probably exceed the maximum length of a GET request.
Streaming API
The streaming API looks very promising as it provides realtime results. The API allows you to specify a follow and track parameters. follow is not useful as the bot does not know who will be sending it commands. track allows you to specify keywords to track. This could possibly work by creating a daemon process that connects to the Streaming API and tracks all references to the bot's names. Once again since there are lots of bots to track the length and complexity of the query may be an issue. Another idea would be to track a special hashtag such as #botcommand and then a user could send a command using this syntax #bot1 weather #botcommand. Then by using the Streaming API to track all references to #botcommand would give you a realtime stream of all the commands. Further parsing could then be done to determine which bot to send the command to. This blog post has more details on the Streaming API
Third-party service
Are there any third-party companies that have access to the Twitter firehouse and offer realtime data?
I haven't investigated these, but here are a few that I have found:
Gnip
Tweet.IM
excla.im
TwitterSpy - seems to use polling, not realtime
tweethook
I'm leaning towards using the Streaming API. Is there a better way to get near realtime #-replies for many (hundreds) of Twitter accounts?
UPDATE: Twitter just announced that in the future they will have User Streams which expands upon the Streaming API. User Streams Preview
Either track or follow will work for the cases you describe. See http://apiwiki.twitter.com/Streaming-API-Documentation#track for details on what track actually does. The doc on follow is on the same page.
There are rate limits of sorts on the streaming API, but they have to do with how big a slice of the total tweet stream you're consuming. For writing a bot like this you won't hit these limits without a pretty big user base. And when you get that user base you can apply for elevated access levels that increase the rate limets.
There's the twitter firehose but you're probably best off using the Streaming API. The firehose is open to Google (try googling your twitter name) and as the link says they're opening it up to all soon enough.
You'll want to get your IP whitelist too.
If your not already, you want to check out the GoogleGroup for twitter devs.
The track predicate for the streaming api would actually be useful because if you follow your bot's user IDs, you'll get all the messages made by your bots and all the other messages that mention your bots #usernames (including #replies). It really does track everything public on twitter relating to the user IDs you follow with it, give it a shot.
REST API:
The most comprehensive results with the least amount of false positives. Will include protected statuses if the bot is following the protected account. If you poll every thirty seconds it is pretty close to realtime and you will be well under your rate limit (350/hour) if you are using api.twitter.com/1 with OAuth.
Streaming API:
You will want to avoid the Search API. It is trending more and more towards popular results and not complete results.
Streaming API
The fastest but also likely to miss some statuses as well as include false positives. Protected statuses for example are not included. Track for a screen_name will return statuses with that screen_name in it but will also include tweets that just have the screen_name as a string without the # so be sure to filter on your side.