Change Threshold for Intent Matching
# 🤝help
a
@agreeable-pizza-94949 has also asked this in other channels. I would like to change the threshold for when an intent matches, such that the AI Task can respond if an Intent does not match. Currently, intents with 68% confidence are matching because what is asked uses a term that is only in that intent, but the question is not actually related to the intent. Therefore, it never makes it to the AI Task that responds with AI info. I use nested workflows, and many intents, so it doesn't make sense to add an AI Task checking confidence (https://botpress.com/docs/cloud/toolbox/transition-to/#adding-an-always-transition) through a variable (if possible) after every intent, as managing that would be exhausting. Is there (or please create) a global threshold Intent Match Confidence score, perhaps in Bot Settings (or however you best see fit), so we can tune the matching of intents. 😀
Had responses in a different channel. For those wondering how, here's my poor JS attempt 😀 Hook: "After Incoming Message"
Copy code
workflow.intentMatched = false;

// Check if intents exists and has at least one item
if (event.nlu && event.nlu.intents && event.nlu.intents.length > 0) {
  const intentConfidence = event.nlu.intents[0].confidence;

  if (intentConfidence > 0.75) {
    workflow.intentMatched = true;
  }
Then at the start of my Main workflow, if intentMatched is True, it goes into the prepared responses. If not, it directs to an AI Task that can answer questions, guard-railed to the company domain of knowledge. 😀 It looks like you could do the same thing, but in an Execute Code card, which could give you the flexibility to do it in a sub-workflow or even per-intent.
8 Views