pub struct DummyLM {
pub api_key: String,
pub base_url: String,
pub temperature: f32,
pub max_tokens: u32,
pub cache: bool,
pub cache_handler: Option<Arc<Mutex<ResponseCache>>>,
}Expand description
In-memory LM used for deterministic tests and examples.
Fields§
§api_key: String§base_url: String§temperature: f32§max_tokens: u32§cache: bool§cache_handler: Option<Arc<Mutex<ResponseCache>>>Cache backing storage shared with the real implementation.
Implementations§
Source§impl DummyLM
impl DummyLM
Sourcepub fn builder() -> DummyLMBuilder
pub fn builder() -> DummyLMBuilder
Create an instance of DummyLM using the builder syntax
Source§impl DummyLM
impl DummyLM
Sourcepub async fn call(
&self,
example: Example,
messages: Chat,
prediction: String,
) -> Result<LMResponse>
pub async fn call( &self, example: Example, messages: Chat, prediction: String, ) -> Result<LMResponse>
Mimics LM::call without hitting a remote provider.
The provided prediction becomes the assistant output and is inserted
into the shared cache when caching is enabled.
Sourcepub async fn inspect_history(&self, n: usize) -> Vec<CallResult>
pub async fn inspect_history(&self, n: usize) -> Vec<CallResult>
Returns cached entries just like LM::inspect_history.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DummyLM
impl !RefUnwindSafe for DummyLM
impl Send for DummyLM
impl Sync for DummyLM
impl Unpin for DummyLM
impl !UnwindSafe for DummyLM
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> 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