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 with_on_complete(self, notify: Arc<Notify>) -> Self
pub fn with_on_complete(self, notify: Arc<Notify>) -> Self
Attach a notifier that fires once per complete() call, after the
completion is dequeued and immediately before it is returned. Tests
use this to deterministically synchronise external side-effects
(e.g. cancellation) with agent progress, avoiding wall-clock sleeps.
Sourcepub fn with_on_complete_fn<F>(self, hook: F) -> Self
pub fn with_on_complete_fn<F>(self, hook: F) -> Self
Attach a synchronous hook that runs once per complete() call, after
the completion is dequeued and immediately before it is returned.
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
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,
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,
Source§fn complete_with_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
eager_tools: &'life2 [(ToolSpec, Option<String>)],
deferred_tools: &'life3 [(ToolSpec, Option<String>)],
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn complete_with_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
eager_tools: &'life2 [(ToolSpec, Option<String>)],
deferred_tools: &'life3 [(ToolSpec, Option<String>)],
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
defer_loading: true + tool_reference content
blocks) override this. The default implementation concatenates
the two lists (dropping the hints) and calls complete() —
i.e., it ignores the partition and behaves identically to the
legacy interface. Read moreSource§fn complete_simple<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
_temperature: f32,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete_simple<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
_temperature: f32,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !Freeze for MockProvider
impl !RefUnwindSafe for MockProvider
impl !UnwindSafe for MockProvider
impl Send for MockProvider
impl Sync for MockProvider
impl Unpin for MockProvider
impl UnsafeUnpin 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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more