pub struct MockLlmProvider { /* private fields */ }Expand description
Mock provider for deterministic tests.
Implementations§
Source§impl MockLlmProvider
impl MockLlmProvider
Sourcepub fn with_responses(responses: Vec<CompletionResponse>) -> Self
pub fn with_responses(responses: Vec<CompletionResponse>) -> Self
Creates a mock provider seeded with responses.
Sourcepub fn with_text_responses(texts: Vec<impl Into<String>>) -> Self
pub fn with_text_responses(texts: Vec<impl Into<String>>) -> Self
Creates a mock provider from plain text responses.
Sourcepub fn with_tool_call_sequence(
tool_name: impl Into<String>,
arguments: Value,
final_text: impl Into<String>,
) -> Self
pub fn with_tool_call_sequence( tool_name: impl Into<String>, arguments: Value, final_text: impl Into<String>, ) -> Self
Creates a mock provider that first asks for a tool, then returns a final answer.
Sourcepub async fn push_response(&self, response: CompletionResponse)
pub async fn push_response(&self, response: CompletionResponse)
Queues another response.
Trait Implementations§
Source§impl Clone for MockLlmProvider
impl Clone for MockLlmProvider
Source§fn clone(&self) -> MockLlmProvider
fn clone(&self) -> MockLlmProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for MockLlmProvider
impl Default for MockLlmProvider
Source§fn default() -> MockLlmProvider
fn default() -> MockLlmProvider
Returns the “default value” for a type. Read more
Source§impl LlmProvider for MockLlmProvider
impl LlmProvider for MockLlmProvider
Source§fn complete<'life0, 'async_trait>(
&'life0 self,
_req: CompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
_req: CompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes a single non-streaming completion request.
Auto Trait Implementations§
impl Freeze for MockLlmProvider
impl !RefUnwindSafe for MockLlmProvider
impl Send for MockLlmProvider
impl Sync for MockLlmProvider
impl Unpin for MockLlmProvider
impl UnsafeUnpin for MockLlmProvider
impl !UnwindSafe for MockLlmProvider
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