NLP2SQL in Dialog

In this section, we will discuss how we can use NLP2SQL in our use cases. NLP2SQL can be added to the dialog from the rule editor in the UCD Dialog side-nav.

Figure 1. Figure 265 – UCD Dialog side-nav
C:\Users\sayak.bhattacharjee\AppData\Local\Microsoft\Windows\INetCache\Content.MSO\78469D5E.tmp

The user can have two types of OTB rules to select from to use the NLP2SQL feature in the chat window. The first OTB rule is a default OTB rule, which is “OTB: NLP2SQL,” and the other is the integration created by the user on the used tenant.

Figure 2. Figure 266 - OTB: NLP2SQL rule
C:\Users\sayak.bhattacharjee\AppData\Local\Microsoft\Windows\INetCache\Content.MSO\A5D5111C.tmp

The default OTB rule has its own set of pre-defined ways of connecting with DB APIs and assuming an array of objects coming as objects and using adaptive cards and column set to represent data to display on teams chat window, and currently just an array of JSON is in the web chat window.

Parameters Description
skillId It’s a mandatory parameter. The skillId mentioned here should be an NLP2SQL Skill. If not found this parameter, the error thrown is “For NLP2SQL skillId is mandatory parameters in rule”. Any other skillId mentioned will throw error “The inserted Skill id is not an NLP2SQL skill. Please recheck.” If skillId mentioned is missing, then “No skill found. Please re-check your skillId.”
fallback_message It’s an optional parameter. It indicates there was an issue while generating the sql query. Its default value is “Could you rephrase the query”
parameter_name It’s an optional parameter. Its indicates that only query is required. It takes Boolean value. By default, it’s taken as false.
form_body_type It’s an optional parameter. It is mentioning the DB API URL. If not found. It sends back the query generated.
request_method It’s an optional parameter. Its possible values are POST, GET. By default, it’s always POST. If any other method value is encountered the message appearing is “The request method allowed are only POST & GET.”
request_header It’s an optional parameter.
It’s an optional parameter. To indicate the sql query to be send to api by what name. By default, the parameter name to mention sql query is “query”.
It’s an optional parameter. It indicates in what form is data getting passed to API. Its possible values are “json”, “formBody”, “urlencoded”. By default it’s taken as “json”
on_api_error_message It’s an optional parameter. It’s used for sending the error message if any error occurs on API Call. Its default value is “'There is an error on the API call as: ' + API error message”
on_empty_message It’s an optional parameter. It’s used to send the message when no data found for the query entered. Its default value is “No data present for the query.”

The user has the full right to create his own DB API call with more parameters to send and to represent the data on chat windows using the Integration Console and openwhisk.

In this feature, we introduce a new idea called the "pre-execution handler”.