Skip to main content

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


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.3.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rasa_ext_plugin-0.0.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file rasa-ext-plugin-0.0.3.tar.gz.

File metadata

  • Download URL: rasa-ext-plugin-0.0.3.tar.gz
  • Upload date:
  • Size: 3.3 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

Hashes for rasa-ext-plugin-0.0.3.tar.gz
Algorithm Hash digest
SHA256 9aeedf25301fa050027d19f020081758df95a957e7bd8c39fa91ef8af7072317
MD5 6d70fedf247a587f45d67fd69b94f065
BLAKE2b-256 3d2b4fe19c96c5408ac91a9914f62780813cfa5eb64739fb05f443b17331f7b0

See more details on using hashes here.

File details

Details for the file rasa_ext_plugin-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: rasa_ext_plugin-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • 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

Hashes for rasa_ext_plugin-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 95c83e23d982357a2fc98659dafe54a9b99a8fa38161dbc2c8e564ef3ce8b599
MD5 fa556426ec1e210187b41511384bc169
BLAKE2b-256 4c0f9906fcba01bf4a2186307f25c9f8fb429698755c55a71a52d8edbe3bd667

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page