The evolving Microsoft technologies are encouraging the developers to extend their ideas, scope of the BOT developing with BOT Framework SDK. While developing the BOT with BOT framework, a very clear and specific prediction of expected utterances is required. The cognitive services have not only made a developer’s life easier but have also introduced a new thought process while developing a BOT.
Nowadays, BOT is not just limited to the simple request-response model but it is now working hand in hand with the evolutions of AI technologies. LUIS (Language understanding) is a cloud-based service that analyses the user’s conversation, natural language text and makes the predictive meaning of the sentences along with taking out the relevant data from the sentence. LUIS analyses the sentence to take out the intention behind the sentence and the entities the user is pointing to. In a simpler way, we can say that it gives you the Subject and Object from a sentence.
Thus while integrating the LUIS with BOT frameworks, the user request is passed to the LUIS as a text. Microsoft has exposed the LUIS API which can be integrated with different platforms. Consequently, it has removed restrictions to use LUIS with Microsoft technologies only. The LUIS returns the response in the JSON format describing the details about the intent, entities, and the accuracy of the prediction made for a particular intent.
Consider, the LUIS app has been written for analyzing the employee information in an organization. While writing a LUIS app, the probable utterances are mentioned.
Say, "what is the EmployeeInfo of a user, what are the projects that employee is working on, tell me about leaves applied by an employee" are the utterances mentioned in LUIS app.
Now, if we passed the text as “what is the designation of Don,” the LUIS app will return the JSON as follows :
The LUIS response suggests that the user is asking for the designation of an employee whose name is Don. While writing the utterances, the subject and object can be made generalized so that different actions by/for a number of users can be predicted.
The BOT then receives the response from LUIS and de-serializes it to interpret the key-value pair. From the key-value pair, the query can be created dynamically. While doing so, the generic approach to build a query on the fly for the entities returned by LUIS reduces the entity-specific operations in the business logic. Once the query is ready, the data can be fetched from the data source. The data source can be anything. In this particular use case, data fetched from the SQL Server. Thus to fetch the data from Db, repository pattern has been implemented. The lambda expression is generated on the fly for entity and property mentioned in LUIS response.
The response from the database is then displayed to the user by BOT.