Skip to content

Commit

Permalink
Merge pull request RasaHQ#11975 from RasaHQ/merge-3.4.x-main-d71e938
Browse files Browse the repository at this point in the history
Merge 3.4.x into main
  • Loading branch information
ancalita authored Jan 28, 2023
2 parents db9b90b + d19f40f commit f890525
Show file tree
Hide file tree
Showing 22 changed files with 594 additions and 230 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,31 @@ https://github.com/RasaHQ/rasa/tree/main/changelog/ . -->

<!-- TOWNCRIER -->

## [3.4.2] - 2023-01-27

Rasa 3.4.2 (2023-01-27)
### Bugfixes
- [#11926](https://github.com/rasahq/rasa/issues/11926): Decision to publish docs should not consider next major and minor alpha release versions.
- [#11968](https://github.com/rasahq/rasa/issues/11968): Exit training/running Rasa model when SpaCy runtime version is not compatible with the specified SpaCy model version.
- [#11971](https://github.com/rasahq/rasa/issues/11971): The new custom logging feature was not working due to small syntax issue in the argparse level.

Previously, the file name passed using the argument --logging-config-file was never retrieved so it never creates the new custom config file with the desired formatting.

### Miscellaneous internal changes
- [#11924](https://github.com/rasahq/rasa/issues/11924)


## [3.4.1] - 2023-01-19

Rasa 3.4.1 (2023-01-19)
### Bugfixes
- [#11923](https://github.com/rasahq/rasa/issues/11923): Changed categorical slot comparison to be case insensitive.
- [#11929](https://github.com/rasahq/rasa/issues/11929): Exit training when transformer_size is not divisible by the number_of_attention_heads parameter and update the transformer documentations.

### Improved Documentation
- [#11899](https://github.com/rasahq/rasa/issues/11899): Update compatibility matrix between Rasa-plus and Rasa Pro services.


## [3.4.0] - 2022-12-14

Rasa 3.4.0 (2022-12-14)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WORKDIR /build
# install dependencies
RUN python -m venv /opt/venv && \
. /opt/venv/bin/activate && \
pip install --no-cache-dir -U "pip==22.*" && \
pip install --no-cache-dir -U "pip==22.*" -U "wheel>0.38.0" && \
poetry install --no-dev --no-root --no-interaction && \
poetry build -f wheel -n && \
pip install --no-deps dist/*.whl && \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 100 \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 100

# Create rasa user and group
RUN useradd -rm -d /app -s /sbin/nologin -g root -u 1001 rasa && groupadd -g 1001 rasa
RUN useradd -rm -d /app -s /sbin/nologin -g root -u 1001 rasa && groupadd -g 1001 rasa
2 changes: 1 addition & 1 deletion docker/Dockerfile.full
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ WORKDIR /build
# install dependencies
RUN python -m venv /opt/venv && \
. /opt/venv/bin/activate && \
pip install --no-cache-dir -U "pip==22.*"
pip install --no-cache-dir -U "pip==22.*" -U "wheel>0.38.0"
RUN . /opt/venv/bin/activate && poetry install --extras full --no-dev --no-root --no-interaction
RUN . /opt/venv/bin/activate && make install-mitie && \
poetry build -f wheel -n && \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.pretrained_embeddings_mitie_en
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WORKDIR /build

# install dependencies
RUN python -m venv /opt/venv && \
. /opt/venv/bin/activate && pip install --no-cache-dir -U "pip==22.*"
. /opt/venv/bin/activate && pip install --no-cache-dir -U "pip==22.*" -U "wheel>0.38.0"
RUN . /opt/venv/bin/activate && poetry install --no-dev --no-root --no-interaction
RUN . /opt/venv/bin/activate && make install-mitie && \
poetry build -f wheel -n && \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.pretrained_embeddings_spacy_de
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WORKDIR /build

# install dependencies
RUN python -m venv /opt/venv && \
. /opt/venv/bin/activate && pip install --no-cache-dir -U "pip==22.*"
. /opt/venv/bin/activate && pip install --no-cache-dir -U "pip==22.*" -U "wheel>0.38.0"
RUN . /opt/venv/bin/activate && poetry install --extras spacy --no-dev --no-root --no-interaction
RUN . /opt/venv/bin/activate && poetry build -f wheel -n && \
pip install --no-deps dist/*.whl && \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.pretrained_embeddings_spacy_en
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WORKDIR /build

# install dependencies
RUN python -m venv /opt/venv && \
. /opt/venv/bin/activate && pip install --no-cache-dir -U "pip==22.*"
. /opt/venv/bin/activate && pip install --no-cache-dir -U "pip==22.*" -U "wheel>0.38.0"
RUN . /opt/venv/bin/activate && poetry install --extras spacy --no-dev --no-root --no-interaction
RUN . /opt/venv/bin/activate && poetry build -f wheel -n && \
pip install --no-deps dist/*.whl && \
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.pretrained_embeddings_spacy_it
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WORKDIR /build

# install dependencies
RUN python -m venv /opt/venv && \
. /opt/venv/bin/activate && pip install --no-cache-dir -U "pip==22.*"
. /opt/venv/bin/activate && pip install --no-cache-dir -U "pip==22.*" -U "wheel>0.38.0"
RUN . /opt/venv/bin/activate && poetry install --extras spacy --no-dev --no-root --no-interaction
RUN . /opt/venv/bin/activate && poetry build -f wheel -n && \
pip install --no-deps dist/*.whl && \
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/compatibility-matrix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ table below to see which one is compatible with your installation of Rasa Plus.
Rasa Pro Services version is independent of Rasa Plus version, except that they share the same major version number.


| Rasa Pro Services | Rasa Plus |
|------------------:|----------:|
| 3.0.x | 3.3.x |
| Rasa Pro Services | Rasa Plus |
|------------------:|-------------:|
| 3.0.x | 3.3.x, 3.4.x |

6 changes: 6 additions & 0 deletions docs/docs/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,8 @@ More details on the parameters can be found on the [scikit-learn documentation p
* `transformer_size`:
This parameter sets the number of units in the transformer (default: `256`).
The vectors coming out of the transformers will have the given `transformer_size`.
The `transformer_size` should be a multiple of the `number_of_attention_heads` parameter,
the training exits with an error otherwise.
* `connection_density`:
This parameter defines the fraction of kernel weights that are set to non zero values for all feed forward
Expand Down Expand Up @@ -2342,6 +2344,8 @@ The `SpacyEntityExtractor` extractor does not provide a `confidence` level and w
* `transformer_size`:
This parameter sets the number of units in the transformer (default: `256`).
The vectors coming out of the transformers will have the given `transformer_size`.
The `transformer_size` should be a multiple of the `number_of_attention_heads` parameter,
the training exits with an error otherwise.
* `connection_density`:
This parameter defines the fraction of kernel weights that are set to non zero values for all feed forward
Expand Down Expand Up @@ -2679,6 +2683,8 @@ Selectors predict a bot response from a set of candidate responses.
* `transformer_size`:
This parameter sets the number of units in the transformer (default: `None`).
The vectors coming out of the transformers will have the given `transformer_size`.
The `transformer_size` should be a multiple of the `number_of_attention_heads` parameter,
the training exits with an error otherwise.
* `connection_density`:
This parameter defines the fraction of kernel weights that are set to non zero values for all feed forward
Expand Down
203 changes: 203 additions & 0 deletions docs/docs/connectors/audioodes-voiceai-connect.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
---
id: audiocodes-voiceai-connect
sidebar_label: Audiocodes VoiceAI Connect
title: Audiocodes VoiceAI Connect
description: Build a Rasa Voice Bot on Audiocodes VoiceAI Connect
---

import RasaProLabel from '@theme/RasaProLabel';
import RasaProBanner from '@theme/RasaProBanner';


<RasaProLabel/>

<RasaProBanner/>

Use this channel to connect your Rasa assistant to [Audiocodes VoiceAI connect](https://www.audiocodes.com/solutions-products/voiceai/voiceai-connect).
## Getting Credentials

To get credentials, create a bot on the [VoiceAI connect portal](https://voiceaiconnect.audiocodes.io/).

1. Select **Bots** in the left side bar.
2. Click on the **+** sign to create a new bot.
3. Select **Rasa** as the Bot Framework
4. Set the bot URL and choose a token value.

## Setting credentials

The token value chosen above will be used in the `credentials.yml`:

```yaml
rasa_plus.channels.audiocodes.AudiocodesInput:
token: <token>
```
You can also specify optional parameters:
| Parameter | Default value | Description |
| --------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `token` | No default value | The token to authenticate calls between your Rasa assistant and VoiceAI connect |
| `use_websocket` | `true` | If `true`, Rasa will send messages through a web socket. If set to `false`, Rasa will send messages through http API calls. |
| `keep_alive` | 120 | In seconds. For each ongoing conversation, VoiceAI Connect will periodically verify the conversation is still active on the Rasa side. |

Then restart your Rasa server to make the new channel endpoint available.

## Usage

### Receiving messages from a user

When a user speaks on the phone, VoiceAI Connect will send a text message (after it is processed by the speech-to-text engine) to your assistant like any other channel.
This message will be interpreted by the NLU and you can then drive the conversation with rules, stories and forms.

### Sending messages to a user

Your bot will respond with text messages like with any other channel. The text-to-speech engine will convert the text and deliver it as a voice message to the user.

Here is an example:

```yaml
utter_greet:
- text: 'Hello! isn’t every life and every work beautiful?'
```

:::note
Only text messages are allowed. Images, attachments, and buttons cannot be used with a voice channel.
:::

### Handling conversation events

Non-voice events can also be handled by the bot. Here are a few examples:

| Event | intent | Description |
| ------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `start` | `vaig_event_start` | VoiceAI will send this intent when it picks-up a phone call. In general, the response to that intent is a welcome or greeting message. [Call context](https://techdocs.audiocodes.com/voice-ai-connect/#VAIG_Combined/call-initiation.htm?TocPath=Bot%2520integration%257CBasic%2520behavior%257C_____1) will be provided through entities |
| `end` | `vaig_event_end` | VoiceAI will send this intent when a call ends. You can use that to call an action that updates the call information. |
| `DTMF` | `vaig_event_DTMF` | VoiceAI will send this intent when receiving a DTMF tone (i.e user presses digit on the keyboard of the phone). The digit(s) sent will be passed in the `value` entity |

The general pattern is that for every `event` sent, the bot will receive the `vaig_event_<event>` intent, with context information in entities.

Here is a simple rule to send a greeting message when a call to the bot is initiated:

```yaml
- rule: New call
steps:
- intent: vaig_event_start
- action: utter_greet
```

Check the [VoiceAI Connect documentation](https://techdocs.audiocodes.com/voice-ai-connect/#VAIG_Combined/voiceai_connect.htm?TocPath=VoiceAI%2520Connect%257C_____0) for an exhaustive list of events.

### Configuring calls

You can send events from Rasa to VoiceAI Connect to make changes to the current call configuration.
For example, you might want to receive a notification when the user stays silent for more than 5 seconds, or you might need to customize how DTMF digits are sent by VoiceAI Connect.

Call configuration events are sent with custom messages and are specific to the current conversation (sometimes to a message).
Which means they must be part of your stories or rules so the same behaviour is applied to all conversations.

Those Rasa responses don't utter anything, they just configure the voice gateway. It is a good practice naming them differently, for example prefixing them with `utter_config_<what_it_does>`

All the supported events are exhaustively documented in the [VoiceAI Connect documentation](https://techdocs.audiocodes.com/voice-ai-connect/#VAIG_Combined/voiceai_connect.htm?TocPath=VoiceAI%2520Connect%257C_____0).
We will look at one example here to illustrate the use of custom messages and events.

#### Example: changing a pin code

In this example we create a flow to allow a user to change a pin code.

```yaml
- rule: Set pin code
steps:
# User says "I want to change my pin code"
- intent: set_pin_code
# Send the noUserInput configuration event
- action: utter_config_no_user_input
# Send the DTMF format configuration event
- action: utter_config_dtmf_pin_code
# A standard Rasa form to collect the pin code from the user
- action: pin_code_form
- ...
```

In the domain, we can add the `utter_config_<config_event>` responses:

[`noUserInput` event](https://techdocs.audiocodes.com/voice-ai-connect/#VAIG_Combined/inactivity-detection.htm?TocPath=Bot%2520integration%257CReceiving%2520notifications%257C_____3)
```yaml
utter_config_no_user_input:
- custom:
type: event
name: config
sessionParams:
# If user stays silent for 5 seconds or more, the notification will be sent
userNoInputTimeoutMS: 5000
# If you want to allow for more than one notification during a call
userNoInputRetries: 2
# Enable the noUserInput notification
userNoInputSendEvent: true
```

[`DTMF` event](https://techdocs.audiocodes.com/voice-ai-connect/#VAIG_Combined/receive-dtmf.htm?TocPath=Bot%2520integration%257CReceiving%2520notifications%257C_____2)
```yaml
utter_config_dtmf_pin_code:
- custom:
type: event
name: config
sessionParams:
# Enable grouped collection (i.e will send all digits in a single payload)
dtmfCollect: true
# If more than 5 secs have passed since a digit was pressed,
# the input is considered completed and will be sent to the bot
dtmfCollectInterDigitTimeoutMS: 5000
# If 6 digits are collected, VoiceAI will send those 6 digits
# even if the user keeps pressing buttons
dtmfCollectMaxDigits: 6
# If the user presses '#' the input is considered complete
dtmfCollectSubmitDigit: "#"
```


Now you can configure the `pin_code` slot in the `pin_code_form` to extract the pin code from the `value` entity with the `vaig_event_DTMF` intent:

```yaml
pin_code:
type: text
influence_conversation: false
mappings:
- type: from_entity
entity: value
intent: vaig_event_DTMF
not_intent: vaig_event_noUserInput
conditions:
- active_loop: pin_code_form
requested_slot: pin_code
```

Notice how `vaig_event_noUserInput` was declared in the `not_intent` field.

Since the `vaig_event_noUserInput` intent is sent by VoiceAI Connect when the user stays silent as per our configuration,
we must deactivate the form so we can pick up the conversation from a rule or a story and gracefully handle the failure.

In the following example, we simply cancel the current flow if we receive the `vaig_event_noUserInput` intent (i.e. user stays silent) while the `pin_code_form` loop is active.

```yaml
- rule: Set pin code - happy path
steps:
- intent: set_pin_code
- action: utter_config_no_user_input
- action: utter_config_dtmf_pin_code
- action: pin_code_form
- active_loop: pin_code_form
- active_loop: null
- slot_was_set:
- requested_slot: null
- action: utter_pin_code_changed
- action: action_pin_code_cleanup
- rule: Set pin code - no response - cancel.
condition:
- active_loop: pin_code_form
steps:
- intent: vaig_event_noUserInput
- action: utter_cancel_set_pin_code
- action: action_deactivate_loop
- active_loop: null
```
Loading

0 comments on commit f890525

Please sign in to comment.