pub struct FakeListLLM { /* private fields */ }Expand description
Fake LLM for testing purposes.
Returns responses from a list in order, cycling back to the start when the end is reached.
Implementations§
Source§impl FakeListLLM
impl FakeListLLM
Sourcepub fn with_sleep(self, duration: Duration) -> Self
pub fn with_sleep(self, duration: Duration) -> Self
Set the sleep duration between responses.
Sourcepub fn with_config(self, config: LLMConfig) -> Self
pub fn with_config(self, config: LLMConfig) -> Self
Set the configuration.
Sourcepub fn current_index(&self) -> usize
pub fn current_index(&self) -> usize
Get the current index.
Trait Implementations§
Source§impl BaseLLM for FakeListLLM
impl BaseLLM for FakeListLLM
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: Sync + '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: Sync + '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 FakeListLLM
impl BaseLanguageModel for FakeListLLM
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 FakeListLLM
impl Clone for FakeListLLM
Source§impl Debug for FakeListLLM
impl Debug for FakeListLLM
Source§impl LLM for FakeListLLM
impl LLM for FakeListLLM
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 FakeListLLM
impl RefUnwindSafe for FakeListLLM
impl Send for FakeListLLM
impl Sync for FakeListLLM
impl Unpin for FakeListLLM
impl UnwindSafe for FakeListLLM
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