Git Product home page Git Product logo

rasahost's Introduction

RasaHost

A user interfaces for Rasa NLU and Rasa Core, that simplify bot development.

Features

  • Editor for MD files (intents, stories, domain) in Rasa format
    • Getting started is beyond easy, you just have to specify paths to your MD files.
    • No migration is needed. The tool uses standard Rasa format.
    • It does not have a dependency on the Rasa version.
  • Logs conversations
    • All logs and conversations are saved in SQLite.
    • You just have to create an agent and bind it to the host.
    • The logging can be mixed with standard logging to files and console-like Rasa does by default.
    • It does not have a dependency on the Rasa version.
  • Testing
    • Chat control
    • Memoization Policy visualization

Tech

  • python
  • flask
  • vuejs

Installation

https://pypi.org/project/rasa-host

pip install rasa-host

Running

Rasa-Host does not have a dependency on Rasa(in fact does not have Rasa packages dependency) and will work with all versions.

from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.agent import Agent
interpreter = RasaNLUInterpreter('models/current/nlu')
agent = Agent.load("models/current/dialogue", interpreter=interpreter)

from RasaHost import host
host.nlu_path = os.path.join(current_dir, "data/nlu/")
host.stories_path = os.path.join(current_dir, "data/stories/")
host.domain_path = os.path.join(current_dir, "data/domain.yml")
host.agent = agent
if __name__ == '__main__':    
    host.run()
    # werkzeug  -  * Running on http://0.0.0.0:5005/ (Press CTRL+C to quit)
    
    # GET http://localhost:5005/conversations/daniel/respond?q={{message}}

NLU - md files

from RasaHost import host
host.nlu_path = os.path.join(current_dir, "data/nlu/")
if __name__ == '__main__':    
    host.run()

NLU - md files

Core - stories files

from RasaHost import host
host.stories_path = os.path.join(current_dir, "data/stories/")
if __name__ == '__main__':    
    host.run()

Core - md stories

Core - domain file

from RasaHost import host
host.domain_path = os.path.join(current_dir, "data/domain.yml")
if __name__ == '__main__':    
    host.run()

Core - domain file

Core - chat

Chat interface for testing Rasa. By default, does GET http://{{host}}/conversations/{{sender_id}}/respond?q={{message}}

from RasaHost import host
host.agent = agent
if __name__ == '__main__':    
    host.run()

Core - chat

Core - conversations

Conversations are saved in SQLite.

from RasaHost import host
host.agent = agent
if __name__ == '__main__':    
    host.run()

Core - conversations

Core - logs

Logs are saved in SQLite.

from RasaHost import host
host.agent = agent
if __name__ == '__main__':    
    host.run()

Core - logs

Core - analyze

Analyze intents, stories, and domains. Shows warnings and suggestions.

from RasaHost import host
host.nlu_path = os.path.join(current_dir, "data/nlu/")
host.stories_path = os.path.join(current_dir, "data/stories/")
host.domain_path = os.path.join(current_dir, "data/domain.yml")
if __name__ == '__main__':    
    host.run()

Core - analyze

Core - memoization policy

Decode memoization policy data.

from RasaHost import host
host.memoization_policy_path = os.path.join(current_dir, "models\current\dialogue\policy_1_MemoizationPolicy")
if __name__ == '__main__':    
    host.run()

Core - memoization policy

Actions

You can also host actions, with or without the agent.

from rasa_core_sdk.executor import ActionExecutor
actionExecutor = ActionExecutor()
actionExecutor.register_package('actions')

from RasaHost import host
host.actionExecutor = actionExecutor
if __name__ == '__main__':    
    host.run()
    # werkzeug  -  * Running on http://0.0.0.0:5005/ (Press CTRL+C to quit)
    # POST http://localhost:5005/actions

Agent with actions

Example of running the app with agent and custom actions.

from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.agent import Agent
from rasa_core import utils, server
from rasa_core_sdk.executor import ActionExecutor
#  #rasa-host.endpoints.yml
#  action_endpoint:
#  url: "http://localhost:5005/actions"
action_endpoint_conf = utils.read_endpoint_config("rasa-host.endpoints.yml", endpoint_type="action_endpoint")
interpreter = RasaNLUInterpreter('models/current/nlu')
agent = Agent.load("models/current/dialogue", interpreter=interpreter, action_endpoint=action_endpoint_conf)

actionExecutor = ActionExecutor()
actionExecutor.register_package('actions')

from RasaHost import host
host.nlu_path = os.path.join(current_dir, "data/nlu/")
host.stories_path = os.path.join(current_dir, "data/stories/")
host.domain_path = os.path.join(current_dir, "data/domain.yml")
host.agent = agent
host.actionExecutor = actionExecutor
if __name__ == '__main__':    
    host.run()
    # werkzeug  -  * Running on http://0.0.0.0:5005/ (Press CTRL+C to quit)
    
    # GET http://localhost:5005/conversations/daniel/respond?q={{message}}
    # POST http://localhost:5005/actions

Channels

Supports channels. All the conversations will be logged.

from rasa_core.channels.botframework import BotFrameworkInput
input_channel = BotFrameworkInput(
        app_id="",
        app_password=""
)

from RasaHost import host
host.agent = agent
host.channels = [input_channel]
if __name__ == '__main__':    
    host.run()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.