[][src]Struct rust_bert::pipelines::conversation::ConversationModel

pub struct ConversationModel { /* fields omitted */ }

Conversation model

Processes a ConversationManager and generate system responses for active conversations.

Implementations

impl ConversationModel[src]

pub fn new(
    conversation_config: ConversationConfig
) -> Fallible<ConversationModel>
[src]

Build a new ConversationModel

Arguments

  • conversation_config - ConversationConfig object containing the resource references (model, vocabulary, configuration), conversation options and device placement (CPU/GPU)

Example

use rust_bert::pipelines::conversation::ConversationModel;

let conversation_model = ConversationModel::new(Default::default())?;

pub fn generate_responses<'a>(
    &self,
    conversation_manager: &'a mut ConversationManager
) -> HashMap<&'a Uuid, &'a str>
[src]

Perform a multi-turn conversation based on user input

Arguments

  • conversation_manager - &mut ConversationManager Conversation manager keeping track of active conversations

Returns

  • HashMap<&Uuid, &str> Responses from the model for each active conversation, referenced by Uuid

Example

use rust_bert::pipelines::conversation::{ConversationManager, ConversationModel};
use rust_bert::pipelines::generation::LanguageGenerator;
let model = ConversationModel::new(Default::default())?;

let mut conversation_manager = ConversationManager::new();
conversation_manager.create("Hello, how are you?");

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

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,