pub struct MockModel { /* private fields */ }Expand description
A model that replays scripted responses in order and records every request.
Implementations§
Source§impl MockModel
impl MockModel
Sourcepub fn tool_calls(calls: &[(&str, &str, &str)]) -> Vec<ChatDelta>
pub fn tool_calls(calls: &[(&str, &str, &str)]) -> Vec<ChatDelta>
Script a response containing tool calls (id, name, arguments).
Sourcepub fn push_error(&self, error: LlmError)
pub fn push_error(&self, error: LlmError)
Append a scripted error.
Sourcepub fn requests(&self) -> Vec<ChatRequest>
pub fn requests(&self) -> Vec<ChatRequest>
Requests received so far.
Trait Implementations§
Source§impl ChatModel for MockModel
impl ChatModel for MockModel
Source§fn chat(
&self,
request: ChatRequest,
) -> BoxFuture<'_, Result<ChatStream, LlmError>>
fn chat( &self, request: ChatRequest, ) -> BoxFuture<'_, Result<ChatStream, LlmError>>
Start a streaming chat completion.
Auto Trait Implementations§
impl !Freeze for MockModel
impl Forget for MockModel
impl Move for MockModel
impl RefUnwindSafe for MockModelwhere
Mutex<VecDeque<Result<Vec<ChatDelta>, LlmError>>>: RefUnwindSafe,
Mutex<Vec<ChatRequest>>: RefUnwindSafe,
impl Send for MockModel
impl Sync for MockModel
impl Unpin for MockModel
impl UnsafeUnpin for MockModelwhere
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Result<Vec<ChatDelta>, LlmError>>: UnsafeUnpin,
PhantomData<ChatRequest>: UnsafeUnpin,
impl UnwindSafe for MockModelwhere
Mutex<VecDeque<Result<Vec<ChatDelta>, LlmError>>>: UnwindSafe,
Mutex<Vec<ChatRequest>>: UnwindSafe,
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