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.2.tar.gz (2.5 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.2-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rasa-ext-plugin-0.0.2.tar.gz
  • Upload date:
  • Size: 2.5 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.2.tar.gz
Algorithm Hash digest
SHA256 60c169ebf3a71f3b7bbfe1e3879c30798c9ec3642ce8a4772eb29e7ad3d27706
MD5 41e525ac4930a2841a2a7fcf3cd24bb2
BLAKE2b-256 5de1a0275db5f03939456747e2cf7864563fdeae8fd33439fa10ad0f3eee8c26

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rasa_ext_plugin-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0c405657acf58ec55d03a6268da7202f90a5d4389def5714357b8cea63934092
MD5 1bf8767f98ea8eda5272b0b2eb73bc53
BLAKE2b-256 95320a97fbca0062e46e68924ba10f7375a8de580ccc1cedeccad0e79b49cc5d

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