Skip to content

Latest commit

 

History

History
290 lines (238 loc) · 9.1 KB

File metadata and controls

290 lines (238 loc) · 9.1 KB

Rasa CALM Demo

This demo showcases a chatbot built with Rasa's LLM-native approach: CALM.

Caution

Please note that the demo bot is an evolving platform. The flows currently implemented in the demo bot are designed to showcase different features and capabilities of the CALM bot. The functionality of each flow may vary, reflecting CALM's current stage of development.

Terms of Use

This project is released under the Rasa's Early Release Software Access Terms.

Demo Bot

The demo bot's business logic is implemented as a set of flows, which are organized into three main skill groups: Contacts, Transactions, and Others/Misc.

Each flow consists of a yaml file and a domain definition, which includes actions, slots, and bot ressponses. The table below shows all the skills implemented in the bot, along with the flow and domain definitions for each:

Skill Group Flow Name Description Link to flow Link to domain
Contacts Add new contact Adds a new contact to the user's list. Link Link
Remove contact Removes selected contact from the user's list. Link Link
List contacts List all of user's saved contacts. Link Link
Transactions Check account balance Allows users to check their current account balance. Link Link
Transfer money Facilitates the transfer of funds to user's contacts. Link Link
Setup recurrent payment Sets up recurring payments which can either be a direct debit or a standing order. Link Link
List transactions List the last user's transactions. Link Link
Replace card Replace the user's card. Link Link
Replace eligible card Replace the user's card that meets specific eligibility criteria. This is a flow link exclusively accessed by replace_card flow Link N/A
Verify account Verify an account for higher transfer limits. Link Link
Others / Misc Book Restaurant Make a reservation at a restaurant. Link Link
Health Advice Detects an out-of-scope topic: health advice. Link Link
Hotel search Search for a hotel and show hotel rating. Link Link

Rasa ships with a default behavior for every conversation repair case which is handled through a default pattern flow. In addition to its core functionality, the demo bot also includes an examples of pattern overriding in data/flows/patterns.yml.

Running the project

This section guides you through the steps to get your Rasa bot up and running. We've provided simple make commands for a quick setup, as well as the underlying Rasa commands for a deeper understanding. Follow these steps to set up the environment, train your bot, launch the action server, start interactive sessions, and run end-to-end tests.

Installation

Important

To build, run, and explore the bot's features, you need Rasa Pro license. You also need access to the rasa-plus Python package, which requires authentication with our artifact repository. For detailed instructions on the authentication process, please refer our documentation here.

Note

If you want to use a different version of rasa or rasa-plus, you can change the versions in the pyproject.toml file.

Prerequisites:

  • rasa pro license
  • being authenticated with our artifact registry
  • poetry (1.4.2), e.g. using poetry self update
  • python (3.10.12), e.g. using pyenv pyenv install 3.10.12
  • set up and running Duckling server

After you cloned the repository and are authenticated, follow the installation steps:

  1. Locate to the cloned repo:
    cd demo-flows
    
  2. Set the python environment with pyenv or any other tool that gets you the right python version
    pyenv local 3.10.12
    
  3. Install the dependencies with poetry
    poetry install
    
  4. Create an environment file .env in the root of the project with the following content:
    RASA_PRO_LICENSE=<your rasa pro license key>
    OPENAI_API_KEY=<your openai api key>
    RASA_DUCKLING_HTTP_URL=<url to the duckling server>

Training the bot

To train a model use make command for simplicity:

make train

which is a shortcut for:

rasa train -c config.yml -d domain --data data

The trained model is stored in models directory located in the project root.

Starting the assistant

Before interacting with your assistant, start the action server to enable the assistant to perform custom actions located in the actions directory. Start the action server with the make command:

make actions

which is a shortcut for:

rasa run actions

Once the action server is started, you have two options to interact with your trained assistant:

  1. CLI-based interaction using rasa shell:
rasa shell
  1. GUI-based interaction using rasa inspector:
rasa inspect

Running e2e test

The demo bot comes with a set of e2e tests, categorized into two primary groups: failing, and passing. These tests are organized not per individual flow but according to CALM functionalities.

Note

The passing and failing statuses are relative to the performance of the GPT-4, which is enabled by default. The use of different models may yield varying results.

You have the flexibility to run either all tests, only the passing tests, only the failing tests, or a single specific test.


To run all the tests you can use the make command:

make test

or

run rasa test e2e e2e_tests

To run passing/failing tests you can use the make command:

make test-passing
make test-failing

or

run rasa test e2e e2e_tests/passing
run rasa test e2e e2e_tests/failing

To run a single test with make command, you need to provide the path to a target test in an environment variable target:

export target=e2e_tests/path/to/a/target/test.yml

and then run:

make test-one

or

rasa test e2e e2e/tests/path/to/a/target/test.yml