blab_chatbot_rasa.conversation_rasa#

A module that interacts with the APIs of Rasa and BLAB Controller.

Module Contents#

Classes#

RasaWebSocketBotClientConversation

Performs the communication between Rasa and BLAB Controller.

class RasaWebSocketBotClientConversation(*args, **kwargs)#

Bases: blab_chatbot_bot_client.conversation_websocket.WebSocketBotClientConversation[blab_chatbot_rasa.rasa_settings_format.BlabRasaClientSettings]

Performs the communication between Rasa and BLAB Controller.

Create an instance. Arguments are forwarded to the parent class.

Parameters:
  • args (Any) –

  • kwargs (Any) –

send_message_to_rasa(text)#

Send a text message to the Rasa bot (on behalf of the user).

Args:#

text: the message text

Returns:#

the list of raw messages returned by the bot

Parameters:

text (str) –

Return type:

list[dict[str, Any]]

classmethod process_bot_message(message)#

Process a message received from a Rasa bot.

Args:#

message: the message as received from Rasa

Returns:#

a dictionary with the message that will be sent back to the user

Parameters:

message (dict[str, Any]) –

Return type:

dict[str, Any]

on_receive_message(message)#

Handle the arrival of a new message.

This method does nothing. The behaviour is defined by subclasses.

Note that this method is also called when the bot’s own messages are delivered.

Parameters:

message (blab_chatbot_bot_client.data_structures.Message) – the incoming message

Return type:

None

generate_answer(message)#

Generate zero or more answers to a given message.

This method returns an empty list. Subclasses should implement the desired behaviour.

Parameters:

message (blab_chatbot_bot_client.data_structures.Message) – the message which should be answered

Returns:

a list with the answers

Return type:

list[blab_chatbot_bot_client.data_structures.OutgoingMessage]