Yes, it is possible.
At the time of constructing your FormFlow, for all the properties of your entity, set the formflow's Field () method to the validate parameter and call a method that tries to extract all possible entities from LUIS and store in the instance that FormFlow is filling in.
.Field(nameof(NomePropriedade), validate: async (state, value) => await ExtractEntity((state as NomeClasse), value, "nomeEntidadeLuisCorrespondenteAoCampoDaVez"))
Applying would look like this:
.Field(nameof(DataNascimento), validate: async (state, value) => await ExtractEntity((state as Cliente), value, "data_nascimento"))
So in every question that FormFlow does you can intercept and extract the entities from luis and send pro state.
The ExtractEntity method would look like this:
protected static async Task<ValidateResult> ExtractEntity(Cliente state, object value, string entityName, Func<ValidateResult, Task<ValidateResult>> next = null)
{
INLPService service = NLPServiceFactory.Create("NomeServicoLuis");
var nlpresult = await service.QueryAsync(value.ToString());
var entity = nlpresult.QueryEntity(entityName);
var result = new ValidateResult { IsValid = true, Value = string.IsNullOrEmpty(entity) ? value : entity };
var nomeEntity = nlpresult.QueryEntity("nome");
var dataNascimentoEntity = nlpresult.QueryEntity("data_nascimento");
state.Nome = CoalesceEntityValue(nomeEntity, entityName, "nome", value.ToString(), state.Nome);
state.DataNascimento = CoalesceEntityValue(dataNascimentoEntity, entityName, "data_nascimento", value.ToString(), state.DataNascimento);
if (next != null)
return await next(result);
else
return result;
}
And finally the CoalesceEntityValue method decides which value to assign in the property, the value extracted from luis, what user entered, or the current value.
private static string CoalesceEntityValue(string extractedEntityValue, string extractedEntityName, string entityName, string rawEntityValue, string currentValue)
{
if (!string.IsNullOrEmpty(extractedEntityValue))
{
return extractedEntityValue;
}
else if (!string.IsNullOrEmpty(rawEntityValue) && entityName == extractedEntityName)
{
return rawEntityValue;
}
else
{
return currentValue;
}
}
Any questions are available.