pub struct ScriptedUserSimulator { /* private fields */ }Expand description
A simulator that replays a fixed sequence of user utterances. The
first entry is returned from UserSimulator::initial_message; each
subsequent call to UserSimulator::respond returns the next entry,
UserAction::Say-wrapped, until the script is exhausted — at which
point the simulator returns UserAction::EndConversation.
Useful for tests, reproducible evaluation runs, and conversation-loop smoke paths where no LLM should be involved on the user side.
Implementations§
Trait Implementations§
Source§impl UserSimulator for ScriptedUserSimulator
impl UserSimulator for ScriptedUserSimulator
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,
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,
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.Auto Trait Implementations§
impl !Freeze for ScriptedUserSimulator
impl RefUnwindSafe for ScriptedUserSimulator
impl Send for ScriptedUserSimulator
impl Sync for ScriptedUserSimulator
impl Unpin for ScriptedUserSimulator
impl UnsafeUnpin for ScriptedUserSimulator
impl UnwindSafe for ScriptedUserSimulator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more