Module conversation

Source
Expand description

§Multi-turn dialogue

Conversation model based on Microsoft’s DialoGPT. This pipeline allows the generation of single or multi-turn conversations between a human and a model. The DialoGPT’s page states that

The human evaluation results indicate that the response generated from DialoGPT is comparable to human response quality under a single-turn conversation Turing test. (DialoGPT repository)

The dependencies will be downloaded to the user’s home directory, under ~/.cache/.rustbert/dialgpt-medium The following illustrates how to run a 2-turns conversation using a conversation manager:

use rust_bert::pipelines::conversation::{ConversationManager, ConversationModel};
let conversation_model = ConversationModel::new(Default::default())?;
let mut conversation_manager = ConversationManager::new();

let conversation_id =
    conversation_manager.create("Going to the movies tonight - any suggestions?");
let output = conversation_model.generate_responses(&mut conversation_manager);

let _ = conversation_manager
    .get(&conversation_id)
    .unwrap()
    .add_user_input("Is it an action movie?")?;

let output = conversation_model.generate_responses(&mut conversation_manager);

Example output: \

"{a0cb3c15-9a5a-4a34-958d-95eddac0215a: \"The Big Lebowski\"}",
"{a0cb3c15-9a5a-4a34-958d-95eddac0215a: \"It's a comedy.\"}"

§Disclaimer

The authors of this repository are not responsible for any generation from the 3rd party utilization of the pretrained system.

Structs§

Conversation
Data structure keeping track of a conversation in the system. It contains past user inputs and generated answers, a history of the tokens generated and a placeholder for new user inputs to be processed by the system if submitted for prediction
ConversationConfig
Configuration for multi-turn classification
ConversationManager
Data structure allowing the management of conversations and main input to the dialogue model. It contains a HashMap of conversations with UUID keys
ConversationModel
Conversation model

Enums§

ConversationOption
Abstraction that holds one particular conversation model, for any of the supported models