Open GanadiniAkshay opened 7 years ago
Using the preBuilt Smalltalk agent, it is possible to recognize them.
they will have the name smalltalk.agent.XXX
Would it be acceptable to add something like this:
if(result.action.includes('smalltalk')) result.action = 'smalltalk'; intent = { score: result.score, intent: result.action, entities: entities_found };
@bradleyscott Yes I think that would be the way to go for now. It would be great if you could send in a PR now, I am a little busy and it might take some time for me to add this fix.
Unfortunately I have found some problems with that strategy. When API.ai detects cancellation intents you would want to handle that differently to the smalltalk.agent responses.
I tried using a regular expression but it doesn't work
First I tried with the whatIsWeather intent handler:
intents.matches(/whatIsWeather/i, (session, args, next) => { session.send("It's 27 degrees celsius"); });
Any ideas why this doesn't work?
If regular expression can be used then the smalltalk.greetings..* reg ex can be used
Also is there a way to figure out the original API AI classified intent name (and other values) when the onDefault handler is called?
You're doing it wrong. Regex should be used as an alternative method to NLU. If the name of your intent is whatIsWeather , you should write it this way -> intents.matches('whatIsWeather', ....)
On Tue, Apr 17, 2018 at 9:27 PM, Yuval Naveh notifications@github.com wrote:
I tried using a regular expression but it doesn't work
First I tried with the whatIsWeather intent handler: intents.matches(/whatIsWeather/i, (session, args, next) => { session.send("It's 27 degrees celsius"); });
Any ideas why this doesn't work?
If regular expression can be used then the smalltalk.greetings..* reg ex can be used
Also is there a way to figure out the original API AI classified intent name (and other values) when the onDefault handler is called?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GanadiniAkshay/ApiAiRecognizer/issues/8#issuecomment-382094778, or mute the thread https://github.com/notifications/unsubscribe-auth/AKvNgeSJrTGYLr2NBGCiSMuw2qBVGNBeks5tpjQggaJpZM4NutP8 .
@amitbend the topic of this issue is that the small talk intents are not working If we could catch all intents that match the format smalltalk.agent.* then the issue will be resolved We could build a specific intent handler for each small talk, but what if we just want to handle all small talk in a generic way?
The matches() API is documented to support a regular expression parameter but for some reason it is not working
Try writing exactly whatIsWeather
in the chat and see if you get the right response.
Also, post more code here. it might be something with the way you've configured it
@bigman73 from what I understand passing regex into intent.matches() doesn't compare the regex with the intent name but the actual message sent by the user which is why it wouldn't work
Thanks @GanadiniAkshay Now I get the problem. It looks like an odd design decision by Microsoft - one function does two very different logic depending on a parameter. It should have been matchesByName and matchesByContent I guess this is an issue I need to open with BotBuilder.
Do you have any idea how the original intent name can be extracted in the default intent provider?
Here's how I solved it ` let intentName = result.action;
if (intentName.startsWith('smalltalk.')) {
intentName = 'smalltalk.';
}
intent = { score: result.score, intent: intentName, entities: entities_found,
original_intent: result.action };
`
The original_intent keeps the unmodified intent name as it comes out of API.AI
This technique allows the handler to be generic for all small talk intents and yet have access to the original intent name if needed:
intents.matches('smalltalk.', function (session, args) { session.send(args.entities[0].entity); });
I can create a pull request if this makes sense
Do you have an example of how this works altogether in code? I'm getting this error:
WARN: IntentDialog - no intent handler found for smalltalk.emotions.wow
Due to changes on api.ai side the old method of handling api.ai doesn't work