The [LuisIntent("")] attribute uses the ILuisService to query the LUIS based on LUISModel attributes' value, then finds out the top scoring intent and matches the IntentHandler Delegate in the overridden MessageRecievedAsync method and loads the LUISResult dynamically in the following method while debugging a class which inherits from LuisDialog.
public async Task None(IDialogContext context, LuisResult result)
{
//some stuff
}
My question is how to make a custom attribute which maps it to the correct intent handler.
I am trying to use RASA NLU Service as my NLP engine along with Microsoft Bot Framework in C#.
I am trying to map LUISEmulatedResult which I get from HttpClient.GetAsync() method which queries RASA NLU to get LUISResult type JSON to a method which follows this delegate.
Progress I have done:
The [RASAIntentAttribute("IntentName")]
using Microsoft.Bot.Builder.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
namespace DemoFlightRASA.Models
{
public class RASAIntentAttribute : Attribute
{
private readonly string _intentName;
public RASAIntentAttribute(string IntentName)
{
this._intentName = IntentName;
}
//The intent handler delegate
//Now I want to map LUISEmulatedResult which I get from HttpClient.GetAsync() method to a method which follows this delegate
public delegate Task RASAIntentHandler(IDialogContext context, LUISEmulatedResult result);
}
}
The LUISEmulatedResult model class:
namespace DemoFlightRASA.Models
{
public class LUISEmulatedResult
{
public string query { get; set; }
public Topscoringintent topScoringIntent { get; set; }
public Intent[] intents { get; set; }
public Entity[] entities { get; set; }
}
public class Topscoringintent
{
public string intent { get; set; }
public float score { get; set; }
}
public class Intent
{
public string intent { get; set; }
public float score { get; set; }
}
public class Entity
{
public string entity { get; set; }
public string type { get; set; }
public int startIndex { get; set; }
public int endIndex { get; set; }
public Resolution resolution { get; set; }
public float score { get; set; }
}
public class Resolution
{
public string[] values { get; set; }
}
}
Also I tried this one, but this doesn't seem to work
I want to create a end-to-end flow which uses RASA NLU opposed to LUIS in bot framework. I have the RASA NLU endpoint ready, just not able to make the RASAIntentAttribute.
Any pointers, tips, tutorials, code snippets as to how to map the delegate to the method will be greatly appreciated. Thank you.