pub struct FakeStreamingListLLM { /* private fields */ }Expand description
Fake streaming list LLM for testing purposes.
An LLM that will return responses from a list in order, with support for streaming character by character.
Implementations§
Source§impl FakeStreamingListLLM
impl FakeStreamingListLLM
Sourcepub fn new(responses: Vec<String>) -> Self
pub fn new(responses: Vec<String>) -> Self
Create a new FakeStreamingListLLM with the given responses.
Sourcepub fn with_sleep(self, duration: Duration) -> Self
pub fn with_sleep(self, duration: Duration) -> Self
Set the sleep duration between chunks.
Sourcepub fn with_config(self, config: LLMConfig) -> Self
pub fn with_config(self, config: LLMConfig) -> Self
Set the configuration.
Sourcepub fn with_error_on_chunk(self, chunk_number: usize) -> Self
pub fn with_error_on_chunk(self, chunk_number: usize) -> Self
Set the chunk number to error on.
Sourcepub fn current_index(&self) -> usize
pub fn current_index(&self) -> usize
Get the current index.
Trait Implementations§
Source§impl BaseLLM for FakeStreamingListLLM
impl BaseLLM for FakeStreamingListLLM
Source§fn llm_config(&self) -> &LLMConfig
fn llm_config(&self) -> &LLMConfig
Get the LLM configuration.
Source§fn generate_prompts<'life0, 'life1, 'async_trait>(
&'life0 self,
prompts: Vec<String>,
stop: Option<Vec<String>>,
run_manager: Option<&'life1 CallbackManagerForLLMRun>,
) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate_prompts<'life0, 'life1, 'async_trait>(
&'life0 self,
prompts: Vec<String>,
stop: Option<Vec<String>>,
run_manager: Option<&'life1 CallbackManagerForLLMRun>,
) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run the LLM on the given prompts. Read more
Source§fn stream_prompt<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: String,
_stop: Option<Vec<String>>,
_run_manager: Option<&'life1 CallbackManagerForLLMRun>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<GenerationChunk>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stream_prompt<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: String,
_stop: Option<Vec<String>>,
_run_manager: Option<&'life1 CallbackManagerForLLMRun>,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<GenerationChunk>> + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stream the LLM on the given prompt. Read more
Source§fn convert_input(&self, input: LanguageModelInput) -> Result<String>
fn convert_input(&self, input: LanguageModelInput) -> Result<String>
Convert input to a prompt string.
Source§fn invoke<'life0, 'async_trait>(
&'life0 self,
input: LanguageModelInput,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn invoke<'life0, 'async_trait>(
&'life0 self,
input: LanguageModelInput,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Invoke the model with input.
Source§fn get_llm_ls_params(&self, stop: Option<&[String]>) -> LangSmithParams
fn get_llm_ls_params(&self, stop: Option<&[String]>) -> LangSmithParams
Get standard params for tracing.
Source§impl BaseLanguageModel for FakeStreamingListLLM
impl BaseLanguageModel for FakeStreamingListLLM
Source§fn model_name(&self) -> &str
fn model_name(&self) -> &str
Get the model name/identifier.
Source§fn config(&self) -> &LanguageModelConfig
fn config(&self) -> &LanguageModelConfig
Get the configuration for this model.
Source§fn generate_prompt<'life0, 'async_trait>(
&'life0 self,
prompts: Vec<LanguageModelInput>,
stop: Option<Vec<String>>,
callbacks: Option<Callbacks>,
) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate_prompt<'life0, 'async_trait>(
&'life0 self,
prompts: Vec<LanguageModelInput>,
stop: Option<Vec<String>>,
callbacks: Option<Callbacks>,
) -> Pin<Box<dyn Future<Output = Result<LLMResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Pass a sequence of prompts to the model and return model generations. Read more
Source§fn identifying_params(&self) -> HashMap<String, Value>
fn identifying_params(&self) -> HashMap<String, Value>
Get the identifying parameters for this model.
Source§fn get_ls_params(&self, stop: Option<&[String]>) -> LangSmithParams
fn get_ls_params(&self, stop: Option<&[String]>) -> LangSmithParams
Get parameters for tracing/monitoring.
Source§fn get_token_ids(&self, text: &str) -> Vec<u32>
fn get_token_ids(&self, text: &str) -> Vec<u32>
Get the ordered IDs of tokens in a text. Read more
Source§fn get_num_tokens(&self, text: &str) -> usize
fn get_num_tokens(&self, text: &str) -> usize
Get the number of tokens present in the text. Read more
Source§fn get_num_tokens_from_messages(&self, messages: &[BaseMessage]) -> usize
fn get_num_tokens_from_messages(&self, messages: &[BaseMessage]) -> usize
Get the number of tokens in the messages. Read more
Source§impl Clone for FakeStreamingListLLM
impl Clone for FakeStreamingListLLM
Source§impl Debug for FakeStreamingListLLM
impl Debug for FakeStreamingListLLM
Source§impl LLM for FakeStreamingListLLM
impl LLM for FakeStreamingListLLM
Source§fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: String,
stop: Option<Vec<String>>,
run_manager: Option<&'life1 CallbackManagerForLLMRun>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: String,
stop: Option<Vec<String>>,
run_manager: Option<&'life1 CallbackManagerForLLMRun>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run the LLM on the given input. Read more
Auto Trait Implementations§
impl !Freeze for FakeStreamingListLLM
impl RefUnwindSafe for FakeStreamingListLLM
impl Send for FakeStreamingListLLM
impl Sync for FakeStreamingListLLM
impl Unpin for FakeStreamingListLLM
impl UnwindSafe for FakeStreamingListLLM
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