How Response Generation works in RASA core? - machine-learning

I'm quite new to Chatbots and started using RASA as a framework. And wondering which method RASA use as their response generation technique. (NLG)
Theoretically, there are two types of NLG techniques:
Template driven NLG
Advanced NLG - Neural nets and ML
So, in RASA what method they use ?

The RASA stack is flexible enough to support both use cases.
The documentation (v: 0.10.3) for your question can be found at: http://www.rasa.com/docs/core/responses/
TL;DR
RASA offers a built-in templated based NLG. However, it also allows you to connect to an external HTTP server for NLG. What happens in that server is up to you, and it could be a neural net based NLG server, but that needs to be done by you.
Template driven NLG
From the docs:
The default format is, to include the utterances into your domain
file. This file then contains references to all your custom actions,
available entities, slots and intents.
One section of your domain file will include a templates section. Here is an example from the docs:
templates:
utter_greet:
- "hey there {name}!" # variable will be filled by slot with the same name or by custom code
utter_goodbye:
- "goodbye 😢"
- "bye bye 😢" # multiple templates will allow the bot to randomly pick from them
utter_default:
- "default message"
Advanced NLG - Neural nets and ML
From the docs:
Retraining the bot, just to change the text copy can be suboptimal for
some workflows. That’s why Core also allows you to outsource the
response generation and separate it from the dialogue learning.
The bot will still learn to predict actions and to react to user input
based on past dialogues, but the responses it sends back to the user
are generated outside of Rasa Core.
If the bot wants to send a message to the user, it will call an
external HTTP server with a POST request. To configure this endpoint,
you need to create an endpoints.yml and pass it either to the run or
server script.
The core will contact your server with information from the the conversation, including the user utterance, intent and slots filled. Your server then would have a neural net based NLG (developed by you) which would return the text that the bot should display to the user.

Related

Workday - How to programmatically get list of WSDLs in Workday

I am working on developing an integration with Workday. Under my initial analysis, I found that Workday provides multiple wsdls for different modules like "Human resource", "Inventory" etc. I can see this complete list at https://community.workday.com/sites/default/files/file-hosting/productionapi/operations/index.html
I am trying to understand how I get get this list progamatically in my integration so that my user can select one of the wsdls rather than typing in the full name of WSDL. Please share your thoughts on this.
You can programatically retrieve a list of all web service operations by creating a Custom Report based on the "Public Web Services" data source. The report can then be exposed as a RESTful WS for easy retrieval.
Some fields you can include in the report are: Web service, supported operations, api version, endpoint url, WSDL url, etc, etc.
This is highly customisable, in the sense that you can query the RESTful WS Report for specific versions, specific operations, etc, via Prompts / URL Params.
The report-as-a-service, supports also a variety of output formats as well as its own WSDL.
The purpose of a SOAP WSDL is to generate a client stub, i.e. a model that lets your client interact with objects exposed or consumed by the service provider. You don't interact with a WSDL at runtime - you interact with the stub. If you want to make multiple services available, you have to include each WSDL in your client application at compile time and generate their stubs. The services in a given API version do not change, so there isn't a reason to do this dynamically.
To add to the query asked, what we are trying to understand is that whether there an API call/request which we could hit to get the list of web services available to populate it on the UI to select from it.
For Example: In this link, https://community.workday.com/sites/default/files/file-hosting/productionapi/index.html, we have Absence_Management, Academic_Advising, Academic_Foundation and so on and Now, if I want it to be displayed to the end user so that He can select the webservice to be used and accordingly we could download the WSDL as to work on it.

How to create forms in dart?

What is the best way to create forms (textfields, checkboxes, radio buttons, ...) and handle the data after the user's input?
Just use web components as dart's web ui?
http://www.dartlang.org/articles/web-ui/
http://www.dartlang.org/docs/tutorials/web-ui/
edit: Lets imagine the following example application: I would like to create an online quiz/test.
First the user has to register
Data will be stored in a textfile or in a database
User can log in and play an online quiz or do an online test.
For that quiz/test i need to evaluate the input with the predefined correct answers
Here's a high-level answer to your question.
To handle data on the server side you can use the HttpServer class to start a web server. See this article.
To store data in a flat file you'll need to use the dart:io package to open a file and write to it. See the documentation for File.openWrite().
To store data in a database there are packages available on pub for mysql and postgresql.
There are two different ways to implement the client side. The traditional way is to use templating to generate html with the data in input elements within a form tag, and then handle the form submission in your webserver.
The modern way, that is the focus within the Dart community, is to write a single page app, which uses HttpRequest to read data from and send data to the server (usually using json).
On the client side, you could retrieve data from server (e.g. as JSON) and use that to build a form. This seems like a good fit for a web component as elements can be dynamically added based on received data.
The component would be bound to the model so you can serialize the model object to JSON on submit and send it to server on submit or just send it as standard HTML form.
The server side of the story is less clear, there are no production quality web server libraries that I am aware of, but you could take a look at DartExpress as an example, or Stream, and there are others, more or less complete. Anyway, you would have to extract the POST payload from HttpRequest (if sent as JSON) or use the form data which is also accessible via queryParameters property - please note that this is Dart:io.HttpRequest class, not Dart:html.HttpRequest, and it is available only on server side.
The mentioned server frameworks simplify this part a bit.
Using Web-UI would be a good choice. The todomvc application illustrates nicely how to dynamically capture the input from a user. Processing on the server side is wide open as far as choices go. Dart does have server side capabilities, and you could use some of the existing libraries to accomplish what you want.
Another way that you can process the information server side is to comunicate with the DB directly using a REST based web service like CouchDB. Cloudant offers such a service and allows you to communicate directly to the DB from the client, providing you can overcome the Same-Origin-Policy. There are 2 ways to do this. Enable CORS on the CouchDB instance, or host your application on the server that has the DB, which is also possible with CouchDB.
Dart serverside also supports websockets, so you can easily deliver the user provided data to the server with web sockets, and then do whatever processing you like on the serverside.
One other option I can think of would be to have the information processed and saved in the local browser. You can access the local DB or local browser file system from the Dart client, and keep everything local. For statistics, you can have the client update a web service of your choice.

HL7 transfer engine

I am working on a web based EMAR application which we are building in DotNet. I have a requirement to make to Pharmacy Software's with my web based EMAR. Please correct me if I am wrong, I think I need to make a transfer engine which communicate with Pharmacy Software and my web based EMAR.
This is the basic of my requirement. Now let me allow to explain what I have to achieve.
In my EMAR there are Facilities and they have Patients (Residents) there. Now If a Pharmacy of a Resident add or edit in any medication in its own software then it should automatically appear in the medication profile of web based EMAR.
I am doing some research in this from last couple of days. I found "Mirth Corp" ( http://www.mirthcorp.com/products/mirth-connect ) and "IGUANA" ( http://www.interfaceware.com/iguana.html ) which provide this. But not sure how they can help me in this.
Can anyone help me here how fulfill this requirement?
Thanks
Rahul K
We are using WSO2 ESB to transfer HL7 messages (ADT messages for Patient Data) from one system to the other. As it is a ESB you can transform the HL7 (file based or over TCP-IP) in any other format (XML, text) over different transports like WebService, FTP, local file or whatever.
WSO2 is a really simple ESB and fully free & open-source. Just download and create a proxy (gets data), transform it (if you need) and send it to you application.
-- I'm not related to WSO2, so this is just my opinion ---
Of course you can use also other ESB like Mirth. Or here you can see a list of some open-source ESB. But you need to check if they have an HL7 adapter included.
If you don't want to use any ESB, there is the Java Implementation of HL7 with the HAPI library. Then you can do whatever you want with it.

iOS app with Django

So we currently have a website that was created using Django. Now, we would like to create a native iOS app that uses the same backend, so we don't have to re-code the whole thing. From my understanding, there are two alternative routes:
1) Call directly Django URLs, which then calls a function. Within that function, create a HTTPResponse, with encoded JSON data and send that back.
2) Create a REST Service from the Django server with something like Tastypie. However, aside from doing straight-forward GET calls to an object, I don't see how we can call custom functions in our Django Models from TastyPie. Can we even do that?
I find it surprising that there is not a lot of information about consuming a web service from iOS with existing backends like Django or RoR. For example, I know that instagram uses Django, but how do they communicate from iOS to their servers?!
Thanks a lot!
I am currently working on an iOS app for iPhone, with Django / Tastypie in the backend. We do both 1 and 2. The resources are offered REST-style (after auth) via Tastypie, and any custom function calls (for example, creating a new user) are handled by views.py at various REST endpoints, which returns JSON.
When you can you should try to use a common way of doing something instead of reinventing the wheel. Given that, REST is a standard style of software architecture for distributed systems and it works very well when you work with entities/objects.
If you have an API where you interact with entities, it is recommended to use REST interfaces. On python you have Tastypie or the newer Django Rest Framework that does almost all the work. As you propose in 2)
If you have an API where you interact with services, like a login, then you should build an RPC service, basically a function with remote access as you explain on 1).
Normally you will need both ways on a robust application. And YES, it is possible to do that. I agree with #sampson-chen, we are doing the same. We have a REST interface with tastypie, and other methods are done with custom RPC services.
The performance in our case is still good, but mostly depends on the methods you call inside your services, for example, a DB query. You have a lot of ways to improve speed, for example using Celery to queue heavy jobs.
Hope it helps.
REST APIs, while very useful, limit you to GET, POST, PUT, DELETE actions, which are performed upon resources. This can make it difficult to express other action types, such as sending an email. There are a few ways I've found to handle this within django/tastypie:
Issue a PUT/PATCH request on an existing resource, setting a flag that lets your backend know to trigger an action. Detecting if a flag was set can be done inside post_save signal handlers (use django-model-utils FieldTracker to see if a field was changed from False to True); this also helps make sure your application logic works the same outside your REST API (such as changes via the admin site, a celery task, an HTML based view, or the Python shell).
Create a non-ORM Resource (e.g. /api/v1/email/) and override the post_list() method, calling your function there.
As mentioned elsewhere, create a subordinate resource (/api/v1/myresource/send/).

How to provide your app with a network API

I am going to write a Ruby application that implements a video conversion workflow consisting of multiple audio and video encoding/processing steps.
The application interface has two core features:
queueing new videos
monitoring the progress for each video
The user can access these features using a website written in Ruby on Rails.
The challenge is this: I want make the workflow app a self-sufficient application, not dependent on the existence of the web view.
To enable this separation I think that adding a network API to the workflow application is a good solution because this allows the workflow app to reside on a different server than the web server.
My question is: Which solution do you suggest for such a network API?
A few options are:
implement a simple TCP server and invent my own string based API
use some sort of REST api (I don't know if this is appropriate for this situation)
some sort of web-services solution (SOAP, XML-RPC)
another existing framework
Feel free to share your thoughts on this.
I would suggest two things:
First, use REST as your API. This allows you to write one core application with both a user interface and an API for outside applications to use.
Second, take a look at PandaStream. It's a Merb application that encodes videos from multiple formats into flash. It has a REST API, and there's even a Rails plugin so you can integrate it with your application. It might be a good example codebase, or even a replacement for the one you're trying to build.
Hope my answer helped,
Mike

Resources