blab_chatbot_deepage.conversation_deepage#

DEEPAGÉ bot for BLAB.

Module Contents#

Classes#

DeepageBot

A bot that uses DEEPAGÉ.

Attributes#

logger#
class DeepageBot(*args, **kwargs)#

Bases: blab_chatbot_bot_client.conversation_websocket.WebSocketBotClientConversation[blab_chatbot_deepage.deepage_settings_format.BlabDeepageClientSettings]

A bot that uses DEEPAGÉ.

Create an instance.

Parameters:
  • args (Any) – positional arguments (passed to the parent class)

  • kwargs (Any) – keyword arguments (passed to the parent class)

classmethod _load_model(model_dir)#
Parameters:

model_dir (str) –

Return type:

tuple[transformers.PreTrainedTokenizer, transformers.PreTrainedModel, transformers.Seq2SeqTrainer]

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]

_find_relevant_documents(question)#
Parameters:

question (str) –

Return type:

list[haystack.Document]

_preprocess(docs)#
Parameters:

docs (list[dict[str, Any]]) –

Return type:

dict[str, Any]

_preprocess_input(examples)#
Parameters:

examples (dict[str, Any]) –

Return type:

transformers.BatchEncoding

_preprocess_function(examples)#
Parameters:

examples (dict[str, Any]) –

Return type:

transformers.BatchEncoding

classmethod index(config, max_entries, max_words)#

Index the entries in a document.

If an old index exists, it is deleted.

Parameters:
  • config (DeepageSettings) – settings for DEEPAGÉ

  • max_entries (int) – maximum number of entries to index

  • max_words (int) – maximum number of words per document

Return type:

None