The 'Is Desired Intent' is returning a wrong value in Power Automate LUIS connector - azure-language-understanding

I am using the "Get Prediction" connector for LUIS in Power Automate. It seems that even though my desired intent has a high score (90+%) and is the highest scoring intent, the "Is Desired Intent" returns false when it should return true. How do I fix this?

Related

Parse email subject office 365 flows

I am trying to get some data parsed out of a subject line in Office 365 Flows. I have an email that has a consistent format:
Help Desk [Ticket #12345]
I want to get the number '12345' for use in later steps in the flow. So far, I've attempted to use the substring expression in a compose connector:
substring(triggerBody()?['Subject'], 20, 5)
But I get an error about the string being null.
Besides the index being incorrect (to retrieve '12345' from Help Desk [Ticket #12345] you need to use substring(value, 0, 5) as the index is 0-based), the expression looks correct. But you can take a step-by-step approach to see what is wrong.
To start, take a look at the flow run to see exactly what the trigger outputs are:
If you see the Subject field (as I do in my case), create a variable containing that value only to make sure that you don't have any typo:
If it works correctly, then you should see in the flow run the subject:
If everything is still good at that point, create a new variable with the substring that you want:
And again, check the value.
If you got to this point, then you should be able to retrieve the ticket id.

Detect intent in prompt choice

I use the Node Botframework Sdk, and the user have to fill out a questionnaire.
This questionnaire have three questions with the same answer "yes", "no", "maybe".
But if the user answer is "yep" or "yes of course" or "always" that can match "yes" (affirmative answer)
If the user answer is "sometimes" or "it depends" or "rarely" that can match "maybe"(nuance answer)
In the future, we must be able to predict new answer not expected at the begining (add easily new answer).
Unfortunately Prompts.choice() don't permit to bind a choice to a intent.
So Two solutions :
Use Prompts.choice() synonyms
Use Prompts.text() and create 3 differents intents (affirmative, nuance, negative) and pass the answer to luis. On the luis response save the good answer (yes | no | maybe)
Which one is the best solution ? Other solution exist ?
Probably the way to go here is using the synonyms of the Prompts.choice; however an alternative you can also explore is overriding some of the behaviors of the Prompts.choice to also call LUIS before parsing the response and returning if it's valid or not.
Why don't you use buttons to get user entry using buttons ? However you can type this code in ResumeAfterAsync function
var r = await result;
if(r.ToLower.Contains("yes") || r.ToLower.Contains("yea" || .....)
{
}
but I think using buttons is a better way

Outlook 'Flow' AppBuilder issues - Branching Condition Not Satisfied

tl;dr - approval settings not working in Outlook Flow
Of 130 staff, I need to when they leave who has returned all their kit. My Column is titled 'Further Action Required.'
I want to set up a weekly email which, if this cell is set to 'Yes', emails the area manager asking them if kit has been returned. Answer is 'Yes' or 'No'.
If they click 'Yes', it emails me and other staff, it also overwrites the cell so that next time it runs, it doesn't email them.
If they hit 'No', I get a notification, nothing happens and it triggers the following week.
I created the whole thing - it doesn't work. So I pared it down to test different areas and it doesn't seem to like the condition for approval....I get Bad Request error, a branch condition not satisfied error and condition failed error. Any ideas? I'm stumped.
Flow error:
Edit view:
Point of clarity - it sent the approval email (I tried the 'Select Options' version but doesn't send any follow up email).
Then I select 'Yes' (returned kit)
and it returns the 'no' (kit not returned) email and then throws up the error above.
When I select No, it does the same....
I'm a bit late to this thread, but for future inquiries, I believe the YES/NO button does not actually function with the words "Yes" or "No." I was getting this same error until I changed the button to a choice and added in my option "Completed." I then changed the condition to look for the word "Completed," and the e-mail was sent. However, when I made the change to choice, I noticed that the field then classified the previous "Yes" option as "1". Thus, it is my take that the "YES/NO" button is actually looking for the words "1" or "0". And if you, like I had, input the word "Yes" into the condition, it fails because it doesn't find it. I did not test this idea, though, since "Completed" works for my needs.

Report Builder Expressions

Im new to Report Builder and having issues with some expressions that Im trying to implement in a report. I got the standard ones to work however as soon as I try any distinctions, I get error messages. Over the last couple weeks, Ive tried many combinations, read the expression help, google and looking at other questions at internet sites. To reduce my frustrations, I even would jump to other expressions and walk away hoping I would have different insight coming back.
Its probably something simple or something I dont know about writing expressions.
Im hoping that someone can help with these expressions; they are the versions I get the least errors with(usually just expression expected) and show what Im trying to accomplish.
=IIF((Fields!RECORDFLAG.Value)='D',COUNTDISTINCT(Fields!TICKETNUM.Value),0)
=IIF((Fields!TRANSTYPE.Value)='1' and (Fields!RECORDFLAG.VALUE)='A' or
'B',SUM(Fields!DOLLARS.Value),0)
=IIF((Fields!TRANSTYPE.Value)='1' and
(Fields!RECORDFLAG.VALUE)='P',SUM(Fields!DOLLARS.Value),0)
=Sum([DOLLARS] case when [RECORDFLAG]='P' then -1*[DOLLARS])
Thank You.
=IIF((Fields!RECORDFLAG.Value)=”D”,COUNTDISTINCT(Fields!TICK‌​ETNUM.Value))
The error message gives you the answer here - no false part of the iif() has been specified. Use =IIF((Fields!RECORDFLAG.Value)=”D”,COUNTDISTINCT(Fields!TICK‌​ETNUM.Value), 0)
=IIF((Fields!TRANSTYPE.Value)="1" and (Fields!RECORDFLAG.VALUE)="A" or "B",SUM(Fields!DOLLARS.Value),0)
This is not how an OR works in SSRS. Use:
=IIF((Fields!TRANSTYPE.Value)="1" and (Fields!RECORDFLAG.VALUE="A" or Fields!RECORDFLAG.Value = "B"),SUM(Fields!DOLLARS.Value),0)
The 0s are returned due to your report design. countdistinct() is an aggregate function - it's meant to be used on a set of data. However, your iif() is only testing on a per row basis - you're basically saying "if the current row is thing, count all the distinct values" which doesn't make sense. There are a couple of ways forward:
You can count the number of times a certain value occurs in a given condition using a sum(). This is not the same as the countdistinct(), but if you use =sum(iif(Fields!RECORDFLAG.Value = "D", 1, 0)) then you will get the number of times RECORDFLAG is D in that set. Note: this requires the data to be aggregated (so in SSRS, grouped in a tablix).
You can use custom code to count distinct values in a set. See https://itsalocke.com/aggregate-on-a-lookup-in-ssrs/. You can apply this even if you have only one dataset - just reference the same one twice.
You can change the way your report works. You can group on Fields!RECORDFLAG.Value and filter the group to where Fields!RECORDFLAG.Value = "D". Then in your textbox, use =countdistinct(Fields!TICKETNUM.Value) to get the distinct values for TICKETNUM when RECORDFLAG is D.

totalEstimatedMatches behavior with Microsoft (Bing) Cognitive search API (v5)

Recently converted some Bing Search API v2 code to v5 and it works but I am curious about the behavior of "totalEstimatedMatches". Here's an example to illustrate my question:
A user on our site searches for a particular word. The API query returns 10 results (our page size setting) and totalEstimatedMatches set to 21. We therefore indicate 3 pages of results and let the user page through.
When they get to page 3, totalEstimatedMatches returns 22 rather than 21. Seems odd that with such a small result set it shouldn't already know it's 22, but okay I can live with that. All results are displayed correctly.
Now if the user pages back again from page 3 to page 2, the value of totalEstimatedMatches is 21 again. This strikes me as a little surprising because once the result set has been paged through, the API probably ought to know that there are 22 and not 21 results.
I've been a professional software developer since the 80s, so I get that this is one of those devil-in-the-details issues related to the API design. Apparently it is not caching the exact number of results, or whatever. I just don't remember that kind of behavior in the V2 search API (which I realize was 3rd party code). It was pretty reliable on number of results.
Does this strike anyone besides me as a little bit unexpected?
Turns out this is the reason why the response JSON field totalEstimatedMatches includes the word ...Estimated... and isn't just called totalMatches:
"...search engine index does not support an accurate estimation of total match."
Taken from: News Search API V5 paging results with offset and count
As one might expect, the fewer results you get back, the larger % error you're likely to see in the totalEstimatedMatches value. Similarly, the more complex your query is (for example running a compound query such as ../search?q=(foo OR bar OR foobar)&...which is actually 3 searches packed into 1) the more variation this value seems to exhibit.
That said, I've managed to (at least preliminarily) compensate for this by setting the offset == totalEstimatedMatches and creating a simple equivalency-checking function.
Here's a trivial example in python:
while True:
if original_totalEstimatedMatches < new_totalEstimatedMatches:
original_totalEstimatedMatches = new_totalEstimatedMatches.copy()
#set_new_offset_and_call_api() is a func that does what it says.
new_totalEstimatedMatches = set_new_offset_and_call_api()
else:
break
Revisiting the API & and I've come up with a way to paginate efficiently without having to use the "totalEstimatedMatches" return value:
class ApiWorker(object):
def __init__(self, q):
self.q = q
self.offset = 0
self.result_hashes = set()
self.finished = False
def calc_next_offset(self, resp_urls):
before_adding = len(self.result_hashes)
self.result_hashes.update((hash(i) for i in resp_urls)) #<==abuse of set operations.
after_adding = len(self.result_hashes)
if after_adding == before_adding: #<==then we either got a bunch of duplicates or we're getting very few results back.
self.complete = True
else:
self.offset += len(new_results)
def page_through_results(self, *args, **kwargs):
while not self.finished:
new_resp_urls = ...<call_logic>...
self.calc_next_offset(new_resp_urls)
...<save logic>...
print(f'All unique results for q={self.q} have been obtained.')
This^ will stop paginating as soon as a full response of duplicates have been obtained.

Resources