pub struct MockLanguageModel { /* private fields */ }Expand description
Mock language model for testing
Implementations§
Source§impl MockLanguageModel
impl MockLanguageModel
Sourcepub fn with_response(
self,
prompt: impl Into<String>,
response: impl Into<String>,
) -> Self
pub fn with_response( self, prompt: impl Into<String>, response: impl Into<String>, ) -> Self
Set a specific response for a prompt
Sourcepub fn with_default_response(self, response: impl Into<String>) -> Self
pub fn with_default_response(self, response: impl Into<String>) -> Self
Set the default response for unmatched prompts
Trait Implementations§
Source§impl AsyncLanguageModel for MockLanguageModel
impl AsyncLanguageModel for MockLanguageModel
Source§type Error = GraphRAGError
type Error = GraphRAGError
The error type returned by generation operations
Source§fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate text completion
Source§fn complete_with_params<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
_params: GenerationParams,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete_with_params<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
_params: GenerationParams,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate text with custom parameters
Source§fn is_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if the model is available
Source§fn model_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ModelInfo> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn model_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ModelInfo> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get model information
Source§fn get_usage_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ModelUsageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_usage_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ModelUsageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get model usage statistics
Source§fn complete_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn complete_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Generate multiple text completions concurrently
Source§fn complete_batch_concurrent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompts: &'life1 [&'life2 str],
max_concurrent: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn complete_batch_concurrent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompts: &'life1 [&'life2 str],
max_concurrent: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Generate multiple text completions with concurrency control
Source§fn complete_streaming<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete_streaming<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Generate streaming completion (if supported)
Source§impl Clone for MockLanguageModel
impl Clone for MockLanguageModel
Source§fn clone(&self) -> MockLanguageModel
fn clone(&self) -> MockLanguageModel
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 moreAuto Trait Implementations§
impl Freeze for MockLanguageModel
impl RefUnwindSafe for MockLanguageModel
impl Send for MockLanguageModel
impl Sync for MockLanguageModel
impl Unpin for MockLanguageModel
impl UnsafeUnpin for MockLanguageModel
impl UnwindSafe for MockLanguageModel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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