Git Product home page Git Product logo

rasa-for-botfront's Introduction

Rasa for Botfront

Rasa for Botfront is a maintained forked version of Rasa to be used with Botfront project on Github, an enterprise-grade open source conversational platform built for Rasa teams.

For more information visit the Botfront project on Github

Main features supported by this fork (when used with Botfront)

  • Multilingual support (incl. NLG)
  • Form UI support
  • Conversion routes
  • Fetching creds and endpoints at startup
  • support for gazette (that is not really important)
  • Automated tests
  • NLU evaluation

Integrating Rasa upstream changes

  1. If you don't have the rasa upstrem do
git remote add upstream https://github.com/RasaHQ/rasa.git
  1. Then retreive all the tags
 git fetch upstream --tags 
  1. Merge the most recent one
 git merge TAG
  1. Solve conflicts
  2. Apply versions using
 command to release here

Rasa Addons

Rasa for Botfront is packaged with custom componenents used by Botfront.

rasa_addons.core.policies.BotfrontDisambiguationPolicy

This policy implements fallback and suggestion-based disambiguation.

It works with actions rasa_addons.core.actions.ActionBotfrontDisambiguation, rasa_addons.core.actions.ActionBotfrontDisambiguationFollowup and rasa_addons.core.actions.ActionBotfrontFallback, and NLU pipeline component rasa_addons.nlu.components.intent_ranking_canonical_example_injector.IntentRankingCanonicalExampleInjector.

Example usage

policies:
  ...
  - name: rasa_addons.core.policies.BotfrontDisambiguationPolicy
    fallback_trigger: 0.30 # default value
    disambiguation_trigger: '$0 < 2 * $1' # default value
    disambiguation_template: 'utter_disambiguation' # default value
    n_suggestions: 2 # default value
    excluded_intents:
      - ^chitchat\..* # default value
      - ^basics\..*
  ...

Note: Automatic generation of suggestion button titles

Botfront introduces the notion of "canonical" training examples, which provide a canonical human-readable text for intent labels. For example, for an intent pay_bills with examples "Pay bills", "I want to pay my bills", "How does one pay the bills on this website?", the first example may be selected as canonical. Canonical status serves as a cue to the bot designer, since intent labels can become untractable over time. It may also come to serve more Botfront-internal roles in the future.

The Botfront Disambiguation Policy uses canonical status to provide localized text for the suggestion buttons shown to users during disambiguation. In order to enable this feature, the NLU pipeline for each language model needs to be extended in the following way:

pipeline:
  ...
  - name: rasa_addons.nlu.components.intent_ranking_canonical_example_injector.IntentRankingCanonicalExampleInjector
  ...

This NLU component enriches the intent_ranking key of user messages in the tracker with canonical text, so that the Disambiguation Policy may pick it up. If the NLU component is not used, buttons will have the intent name as their title.

Parameters

fallback_trigger

Float (default 0.30): if confidence of top-ranking intent is below this threshold, fallback is triggered. Fallback is an action that utters the template utter_fallback and returns to the previous conversation state.

disambiguation_trigger

String (default '$0 < 2 * $1'): if this expression holds, disambiguation is triggered. (If it has already been triggered on the previous turn, fallback is triggered instead.) Here this expression resolves to "the score of the top-ranking intent is below twice the score of the second-ranking intent". Disambiguation is an action that lets the user to choose from the top-ranking intents using a button prompt.

disambiguation_template

String (default 'utter_disambiguation'): a response name resolving to a template containing a text field with a message, e.g. "I could not quite understand. Did you mean...". Any button included under the buttons field of this template will also appear at the end of autogenerated suggestions, e.g. {"title": "None of the above", "type": "postback", "payload": "/deny_suggestions"}.

n_suggestions

Int (default 2): the maximum number of suggestions to display (excluding the 'Other' options).

excluded_intents

List (default ["^chitchat\..*", "^basics\..*"]): any intent (exactly) matching one of these regular expressions will not be shown as a suggestion.

rasa_addons.core.channels.webchat.WebchatInput

Example usage

credentials:
  ...
  rasa_addons.core.channels.webchat.WebchatInput:
    session_persistence: true
    base_url: {{rasa_url}}
    socket_path: '/socket.io/'
  ...

rasa_addons.core.channels.rest.BotfrontRestInput

Rest Input Channel with multilanguage and metadata support.

Example usage

credentials:
  ...
  rasa_addons.core.channels.rest.BotfrontRestInput:
    # POST {{rasa_url}}/webhooks/rest/webhook/
  ...

rasa_addons.core.channels.bot_regression_test.BotRegressionTestInput:

Conversation testing channel. Simulates each user event in the input test stories as a message sent by a user, then compares the input story to the results from rasa. Returns a diff of the input story and output story with expected and actual events.

Example usage

credentials:
  ...
  rasa_addons.core.channels.bot_regression_test.BotRegressionTestInput: {}
    # POST {{rasa_url}} /webhooks/bot_regression_test/run
  ...

rasa_addons.core.nlg.BotfrontTemplatedNaturalLanguageGenerator

Idential to Rasa's TemplatedNaturalLanguageGenerator, except in handles templates with a language key.

rasa_addons.core.nlg.GraphQLNaturalLanguageGenerator

The standard way to connect to the Botfront NLG endpoint.

Example usage

endpoints:
  ...
  nlg:
    url: 'http://localhost:3000/graphql'
    type: 'rasa_addons.core.nlg.GraphQLNaturalLanguageGenerator'
  ...

rasa-for-botfront's People

Contributors

akelad avatar alwx avatar amn41 avatar arthurtemporim avatar b-quachtran avatar dakshvar22 avatar degiz avatar epedrotti avatar erohmensing avatar evgeniiaraz avatar federicotdn avatar ghostvv avatar howl-anderson avatar imlew avatar indam23 avatar justinapetr avatar lunelson avatar m-vdb avatar metcalfetom avatar msamogh avatar paulawesselmann avatar phlf avatar rasabot avatar ricwo avatar tabergma avatar tmbo avatar tttthomasssss avatar twerkmeister avatar twhughes avatar wochinge avatar

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.