-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7136 from RasaHQ/end-to-end-policy-predictions
Policy Predictions for End-to-End
- Loading branch information
Showing
24 changed files
with
1,192 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[Policies](policies.mdx) can now return obligatory and optional events as part of their | ||
prediction. Obligatory events are always applied to the current conversation tracker. | ||
Optional events are only applied to the conversation tracker in case the policy wins. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
The [`Policy`](policies.mdx) interface was changed to return a `PolicyPrediction` object when | ||
`predict_action_probabilities` is called. Returning a list of probabilities directly | ||
is deprecated and support for this will be removed in Rasa Open Source 3.0. | ||
|
||
You can adapt your custom policy by wrapping your probabilities in a `PolicyPrediction` | ||
object: | ||
|
||
```python | ||
from rasa.core.policies.policy import Policy, PolicyPrediction | ||
# ... other imports | ||
|
||
def predict_action_probabilities( | ||
self, | ||
tracker: DialogueStateTracker, | ||
domain: Domain, | ||
interpreter: NaturalLanguageInterpreter, | ||
**kwargs: Any, | ||
) -> PolicyPrediction: | ||
probabilities = ... # an action prediction of your policy | ||
return PolicyPrediction(probabilities, "policy_name", policy_priority=self.priority) | ||
``` | ||
|
||
The same change was applied to the `PolicyEnsemble` interface. Instead of returning | ||
a tuple of action probabilities and policy name, it is now returning a | ||
`PolicyPrediction` object. Support for the old `PolicyEnsemble` interface will be | ||
removed in Rasa Open Source 3.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.