notice
This is documentation for Rasa Documentation v2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.x).
rasa.core.policies.fallback
FallbackPolicy Objects
Policy which predicts fallback actions.
A fallback can be triggered by a low confidence score on a NLU prediction or by a low confidence score on an action prediction.
__init__
Create a new Fallback policy.
Arguments:
priority
- Fallback policy priority.core_threshold
- if NLU confidence threshold is met, predict fallback action with confidencecore_threshold
. If this is the highest confidence in the ensemble, the fallback action will be executed.nlu_threshold
- minimum threshold for NLU confidence. If intent prediction confidence is lower than this, predict fallback action with confidence 1.0.ambiguity_threshold
- threshold for minimum difference between confidences of the top two predictionsfallback_action_name
- name of the action to execute as a fallback
train
Does nothing. This policy is deterministic.
nlu_confidence_below_threshold
Check if the highest confidence is lower than nlu_threshold
.
nlu_prediction_ambiguous
Check if top 2 confidences are closer than ambiguity_threshold
.
should_nlu_fallback
Check if fallback action should be predicted.
Checks for:
- predicted NLU confidence is lower than
nlu_threshold
- difference in top 2 NLU confidences lower than
ambiguity_threshold
- last action is action listen
fallback_scores
Prediction scores used if a fallback is necessary.
predict_action_probabilities
Predicts a fallback action.
The fallback action is predicted if the NLU confidence is low or no other policy has a high-confidence prediction.