pub struct MockProvider { /* private fields */ }Implementations§
Source§impl MockProvider
impl MockProvider
Sourcepub fn with_usage(scripted: Vec<Completion>) -> Self
pub fn with_usage(scripted: Vec<Completion>) -> Self
Alias for new — both accept completions that may have usage set.
Provided for API symmetry when callers want to be explicit about usage.
Sourcepub fn new(scripted: Vec<Completion>) -> Self
pub fn new(scripted: Vec<Completion>) -> Self
Create a new MockProvider with the given scripted completions.
Sourcepub fn calls(&self) -> Vec<Vec<Message>>
pub fn calls(&self) -> Vec<Vec<Message>>
Snapshot of the transcripts the agent has sent to this provider.
Sourcepub fn with_structured_responses(self, responses: Vec<Result<Value>>) -> Self
pub fn with_structured_responses(self, responses: Vec<Result<Value>>) -> Self
Set the queue of structured responses for complete_structured.
Each call to complete_structured pops the next response.
If the queue is empty, it returns an error (fallback path).
Trait Implementations§
Source§impl Default for MockProvider
impl Default for MockProvider
Source§fn default() -> MockProvider
fn default() -> MockProvider
Returns the “default value” for a type. Read more
Source§impl LlmProvider for MockProvider
impl LlmProvider for MockProvider
fn complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
_tools: &'life2 [ToolSpec],
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn complete_structured<'life0, 'async_trait>(
&'life0 self,
_req: StructuredRequest,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete_structured<'life0, 'async_trait>(
&'life0 self,
_req: StructuredRequest,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Request a JSON response conforming to a caller-supplied schema.
Default impl returns an error. Providers that support structured
output (e.g. OpenAI-compatible) override this.
Source§fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
stream_tx: Option<StreamSender>,
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
stream_tx: Option<StreamSender>,
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stream a completion token-by-token. Read more
Auto Trait Implementations§
impl !Freeze for MockProvider
impl RefUnwindSafe for MockProvider
impl Send for MockProvider
impl Sync for MockProvider
impl Unpin for MockProvider
impl UnsafeUnpin for MockProvider
impl UnwindSafe for MockProvider
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