pub struct MockLlmClient { /* private fields */ }Expand description
Mock LLM client for testing.
This client uses a MockQueue to return pre-configured responses
instead of making real API calls.
Implementations§
Source§impl MockLlmClient
impl MockLlmClient
Sourcepub fn with_responses(responses: Vec<MockResponse>) -> Self
pub fn with_responses(responses: Vec<MockResponse>) -> Self
Create a mock client with the given responses.
Sourcepub async fn infer_string(&self, _prompt: &str) -> SageResult<String>
pub async fn infer_string(&self, _prompt: &str) -> SageResult<String>
Call the mock LLM with a prompt and return the raw string response.
Returns an error if no mock responses are queued.
Sourcepub async fn infer<T>(&self, _prompt: &str) -> SageResult<T>where
T: DeserializeOwned,
pub async fn infer<T>(&self, _prompt: &str) -> SageResult<T>where
T: DeserializeOwned,
Call the mock LLM with a prompt and parse the response as the given type.
Returns an error if no mock responses are queued.
Sourcepub async fn infer_structured<T>(
&self,
_prompt: &str,
_schema: &str,
) -> SageResult<T>where
T: DeserializeOwned,
pub async fn infer_structured<T>(
&self,
_prompt: &str,
_schema: &str,
) -> SageResult<T>where
T: DeserializeOwned,
Call the mock LLM with schema-injected prompt for structured output.
Returns an error if no mock responses are queued.
Trait Implementations§
Source§impl Clone for MockLlmClient
impl Clone for MockLlmClient
Source§fn clone(&self) -> MockLlmClient
fn clone(&self) -> MockLlmClient
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 Debug for MockLlmClient
impl Debug for MockLlmClient
Auto Trait Implementations§
impl Freeze for MockLlmClient
impl RefUnwindSafe for MockLlmClient
impl Send for MockLlmClient
impl Sync for MockLlmClient
impl Unpin for MockLlmClient
impl UnsafeUnpin for MockLlmClient
impl UnwindSafe for MockLlmClient
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