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.
Source§fn default_max_tokens(&self) -> Option<u32>
fn default_max_tokens(&self) -> Option<u32>
The output limit this model sends when a request sets none (a
providers file’s
defaults.max_tokens), so a node can tell whether the
run’s budget or this default limits its call.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