Rasa plugins to extend state and store functionalities
Project description
rasa extension plugin
Extends rasa core through component plugin to include:
max_event_history : limits the tracker to maximum of latest 'N ' events
ExtendedDialogueStateTracker: optimize payload to action server to exclude tracker events.
Installation
-
Install the plugin (requires python3)
Online from pypi:
pip install rasa-ext-plugin
Offline:
git clone https://github.com/AppliedSoul/rasa_ext_plugin.git pip install -e rasa_ext_plugin
-
In RASA endpoints.yaml , setup the plugin tracker store
########################################################### # limiter tracker for existing store types : # rasa_ext_plugin.core.tracker_store.InMemoryLimiterTrackerStore # rasa_ext_plugin.core.tracker_store.RedisLimiterTrackerStore # rasa_ext_plugin.core.tracker_store.MongoLimiterTrackerStore # rasa_ext_plugin.core.tracker_store.SQLLimiterTrackerStore # # All limiter tracker store optionally accepts: # max_event_history - limit maximum events tracked by tracker ############################################################ #tracker_store: # type: rasa_ext_plugin.core.tracker_store.InMemoryLimiterTrackerStore # url: localhost # max_event_history: 40 tracker_store: type: rasa_ext_plugin.core.tracker_store.RedisLimiterTrackerStore url: localhost port: 6379 db: 0 # password: # record_exp: max_event_history: 40
-
Startup the rasa server.
Customizing tracker payload sent to remote action server
Refer to [tracker_store] ExtendedDialogueStateTracker , modify the return state from current_state method.
class ExtendedDialogueStateTracker(DialogueStateTracker):
# override
# Actions uses this method to collect tracker's metadata
# before sending payload as json.
def current_state(
self, event_verbosity: EventVerbosity = EventVerbosity.NONE
) -> Dict[Text, Any]:
# conversation state format
# {
# "sender_id": self.sender_id,
# "slots": self.current_slot_values(),
# "latest_message": self.latest_message.parse_data,
# "latest_event_time": latest_event_time,
# "followup_action": self.followup_action,
# "paused": self.is_paused(),
# "events": evts,
# "latest_input_channel": self.get_latest_input_channel(),
# "active_form": self.active_form,
# "latest_action_name": self.latest_action_name,
# }
state = super(ExtendedDialogueStateTracker,self).current_state(event_verbosity)
#
# request payload to action server contains tracker information
# from this state
# removing events from state information
# action server currently ignores event history
# reduces size of request payload to action server
#
# additional unwanted keys can be poped to reduce size
#
state.pop("events", None)
return state
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rasa-ext-plugin-0.0.4.tar.gz
(3.6 kB
view details)
File details
Details for the file rasa-ext-plugin-0.0.4.tar.gz.
File metadata
- Download URL: rasa-ext-plugin-0.0.4.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a10e9ac8d094bf2240a2d276eb19709ab44eb3b37f3ab34f475daa35199069be
|
|
| MD5 |
2cdb368362e552a2cead06bdcae82304
|
|
| BLAKE2b-256 |
dc70227f73345217bbc6cf99f94d91be66a39c0df2ccc5df03e864bafab710d8
|