Skip to main content

UserSimulator

Trait UserSimulator 

Source
pub trait UserSimulator: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn initial_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        task: &'life1 Task,
    ) -> Pin<Box<dyn Future<Output = Result<String, UserError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn respond<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        conversation: ConversationView<'life1>,
        task: &'life2 Task,
    ) -> Pin<Box<dyn Future<Output = Result<UserAction, UserError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}

Required Methods§

Source

fn name(&self) -> &str

Source

fn initial_message<'life0, 'life1, 'async_trait>( &'life0 self, task: &'life1 Task, ) -> Pin<Box<dyn Future<Output = Result<String, UserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Produce the first user message from the task. Called once at the start of a conversation loop.

Source

fn respond<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, conversation: ConversationView<'life1>, task: &'life2 Task, ) -> Pin<Box<dyn Future<Output = Result<UserAction, UserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Respond to the current conversation. Return UserAction::Say with the next user message, or UserAction::EndConversation to terminate the loop.

Implementors§