Dialogflow Integrations (Using the fulfillment webhook model versus API interactions model) - dialogflow-es

I am trying to understand the different model in building a bot using dialogflow and came across this 2 methods.
Fulfillment model (with webhook enabled) documentation here
API Interactions documentation here
I understand that both of this models have their own pros and cons, and I understand how they both work. Most online examples are showing the fulfillment method (I guess that's more common?)
However, I would still like to ask what reason will it be to choose one or the other? If anyone had used either model before, what limitations are there?
p/s: I've look through quite a number of tutorials, and read through the dialogflow documentation.

the integration by fulfillment is indeed the default approach because you use DialogFlow to design your conversation flow and (big bonus) manage the integration with the various channels (ie Telegram, Facebook).
It is the easiest way to design a fully fledge conversation, you only need to worry about the post hooks that are sent to your backend to either save the data or alter the conversation (add contexts or trigger events).
Important remark: all user traffic (who says what) goes via Dialogflow cloud
The API interaction becomes a good option when you have already an existing frontend (say an existing application or web sites) and you want to plug in DialogFlow NLP capabilities.
I have done something like that to create a FAQ chatbot that called DialogFlow to identify which intent would match a certain phrase while the BOT was deployed in MS Teams.
The architecture would indeed look like the one in the documentation: MS Team ecosystem is the "End-User" part, then my Java app ("Your System") would use the API to call DialogFlow.
Important remark: only given statements (the ones you send) go to Dialogflow cloud

Related

Single dialogflow agent for several customers

I have done POC on Dialogflow to programmatically create agents and intents. It's working good. However soon I realized I can only create one agent for a project. My use case is to use Dialogflow for multiple customers with their own faq. Hence keeping one agent per customer was making sense but creating a separate project for each customer doesn't seem to be an ideal choice. I am looking for some guidance on using one agent for multiple customers, also making sure there is no conflict. Is this achievable? One way I can think of to use a fulfillment service. When users asks questions I'll pass customer content along with questions to the fulfillment service. Using customer context I'll try to find to answer specific to that customer.
You can achieve the multiple agents in one project setup if you use Dialogflow CX. The limit for this is 100 agents for Dialogflow CX.
The downside of this is if you created an agent in Dialogflow ES, you cannot migrate it to Dialogflow CX as it introduces new concepts like flows, pages, and state handlers. See comparison between ES and CX.
CX agent -> This is an advanced agent type that is suitable for large
or very complex agents. Flows and pages are the building blocks of
conversation design, and state handlers are used to control
conversation paths. The CX agent type is summarized in Dialogflow CX
basics.
Also Dialogflow CX is quite new and its features is not yet as robust as Dialogflow ES. You can read through this article comparing the limitations of CX and ES.
But if you are using features that Dialogflow ES only have, the only option is to have one agent per project.

How to use custom logic with Chatbot frameworks

I am working on a chatbot, I have implemented it with Dialogflow (Dialogflow ES). I found that Dialogflow has the following Pros
Easy to use
Good at Intent classification
Good at extracting Entities (prebuilt/custom)
Conversations can be chained to a certain extent using input/output contexts and lifespan
But in my use case, there are certain situations where human level judgment is required and it cannot be done using Dialogflow. Can we add our custom logic to process certain user requests in Dialogflow or any other chatbot framework which provide more flexibility?
You're a bit vague what you mean by "custom logic", but this sounds like fulfillment is what you're looking for.
With this, you can enable Intents so they send JSON to code that you run (either by a webhook you run or via some deployed through an inline editor which manages the deployment for you). Your code can apply your business logic to determine what the response might be, including what replies to send, what Output Contexts are set, and any parameters that are in those Contexts.

Is there a way to use inner features of an application through Bixby?

I want Bixby to access the inner features of the application. Like to compose a message and send it in a Chat App. Is there a way to do so?
Sure, you can! As long as the application has REST (Or SOAP) endpoints that can be invoked, it can be called from Bixby.
Having said that, Bixby has many built-in features that allows developers to create rich, natural conversational experiences. As a general guide, the data intensive and complex computations parts of your capsule should be run on an external REST endpoint while the conversational experience (and the associated logic) should be driven from within Bixby. Hope this helps.

Chatbot - Possible to call Watson API to respond user queries?

Chatbot has been developed using IBM bulemix to respond the user queries of grade one students.
Suppose a question raised "What is the life cycle of the leaf?" As of now, Chatbot has no entities related to leaf, life cycle etc..
Chatbot identifies the above query as an irrelevant entity. For the above case is it possible call any Watson knowledge API to answer the above queries?
Or
Can we make any third party searches (google/bing).
Or
the only option we need teach more relevant entities to the chatbot
You can use Watson-Discovery Tool
https://www.ibm.com/watson/services/discovery/
As #Rabindra said, you can use Discovery. IBM Developers built one example using Conversation and Discovery service using Java. And I built one example using Node.js based on the Conversation simple example. You can read the README and will understand how it works.
Basically, you need to know: this example has one action variable to call for Discovery when don't have the "relevant information" for an answer to the user and the Discovery service is called for get relevant answers.
You can see more about in this video from Official IBM Watson channel.
See more about Discovery Service.
See the API Reference for using Discovery Service.
You can also check entity linking service from Bing: https://azure.microsoft.com/en-us/services/cognitive-services/entity-linking-intelligence-service/. It is in preview for now, so you will get limited queries per second but it is free for use.

How to implement BOT engine like WIT.AI for on an on-premise solution?

I want to build a chatbot for a customer service application. I tried SaaS services like Wit.Ai, Motion.Ai, Api.Ai, LUIS.ai etc. These cognitive services find the "intent" and "entities" when trained with the typical interactions model.
I need to build chatbot for on-premise solution, without using any of these SaaS services.
e.g Typical conversation would be as following -
Can you book me a ticket?
Is my ticket booked?
What is the status of my booking BK02?
I want to cancel the booking BK02.
Book the tickets
StandFord NLP toolkit looks promising but there are licensing constraints. Hence I started experimenting with the OpenNLP. I assume, there are two OpenNLP tasks involved -
Use 'Document Categorizer' to find out the intent
Use 'Named Entity Recognition' to find out entities
Once the context is identified, I will call my application APIS to build the response.
Is it a right approach?
How good OpenNLP is in parsing the text?
Can I use Facebook FASTTEXT library for Intent identification?
Is there any other open source library which can be helpful in building the BOT?
Will "SyntaxNet" be useful for my adventure?
I prefer to do this in Java. BUT open to node or python solution too.
PS - I am new to NLP.
Have a look at this. It says it is an Open-source language understanding for bots and a drop-in replacement for popular NLP tools like wit.ai, api.ai or LUIS
https://rasa.ai/
Have a look at my other answer for a plan of attack when using Luis.ai:
Creating an API for LUIS.AI or using .JSON files in order to train the bot for non-technical users
In short use Luis.ai and setup some intents, start with one or two and train it based on your domain. I am using asp.net to call the Cognitive Service API as outlined above. Then customize the response via some JQuery...you could search a list of your rules in a javascript array when each intent or action is raised by the response from Luis.
If your Bot is english based, then I would use OpenNLP's sentence parser to dump the customer input into a database (I do this today). I then use the OpenNLP tokenizer and push the keywords (less the stop words) and Parts of Speech into a database table for keyword analysis. I have a custom Sentiment model built for OpenNLP that will tag each sentence with a Pos, Neg, Neutral sentiment...You can then use this to identify negative customer service feedback. To build your own Sentiment model have a look at SentiWord.net and download their domain agnostic data file to build and train an OpenNLP model or have a look at this Node version...
https://www.npmjs.com/package/sentiword
Hope that helps.
I'd definitely recommend Rasa, it's great for your use case, working on-premise easily, handling intents and entities for you and on top of that it has a friendly community too.
Check out my repo for an example of how to build a chatbot with Rasa that interacts with a simple database: https://github.com/nmstoker/lockebot
I tried RASA, But one glitch I found there was the inability of Rasa to answer unmatched/untrained user texts.
Now, I'm using ChatterBot and I'm totally in love with it.
Use "ChatterBot", and host it locally using - 'flask-chatterbot-master"
Links:
ChatterBot Installation: https://chatterbot.readthedocs.io/en/stable/setup.html
Host Locally using - flask-chatterbot-master: https://github.com/chamkank/flask-chatterbot
Cheers,
Ratnakar
With the help of the RASA and Botkit framework we can build the onpremise chatbot and the NLP engine for any channel. Please follow this link for End to End steps on building the same. An awsome blog that helped me to create a one for my office
https://creospiders.blogspot.com/2018/03/complete-on-premise-and-fully.html
First of all any chatbot is going to be the program that runs along with the NLP, Its the NLP that brings the knowledge to the chatbot. NLP lies on the hands of the Machine learning techniques.
There are few reasons why the on premise chatbots are less.
We need to build the infrastructure
We need to train the model often
But using the cloud based NLP may not provide the data privacy and security and also the flexibility of including my business logic is very less.
All together going to the on premise or on cloud is based on the needs and the use case of the requirements.
How ever please refer this link for end to end knowledge on building the chatbot on premise with very few steps and easily and fully customisable.
Complete On-Premise and Fully Customisable Chat Bot - Part 1 - Overview
Complete On-Premise and Fully Customisable Chat Bot - Part 2 - Agent Building Using Botkit
Complete On-Premise and Fully Customisable Chat Bot - Part 3 - Communicating to the Agent that has been built
Complete On-Premise and Fully Customisable Chat Bot - Part 4 - Integrating the Natural Language Processor NLP
Disclaimer: I am the author of this package.
Abodit NLP (https://nlp.abodit.com) can do what you want but it's .NET only at present.
In particular you can easily connect it to databases and can provide custom Tokens that are queries against a database. It's all strongly-typed and adding new rules is as easy as adding a method in C#.
It's also particularly adept at turning date time expressions into queries. For example "next month on a Thursday after 4pm" becomes ((((DatePart(year,[DATEFIELD])=2019) AND (DatePart(month,[DATEFIELD])=7)) AND (DatePart(dw,[DATEFIELD])=4)) AND DatePart(hour,[DATEFIELD])>=16)

Resources