pub struct LocalLlmProvider { /* private fields */ }Expand description
Wraps a CandleEngine behind the LlmProvider trait using a byte-level
tokenizer. A production build would swap in a HuggingFace tokenizer loaded
from the model file.
Implementations§
Trait Implementations§
Source§impl LlmProvider for LocalLlmProvider
impl LlmProvider for LocalLlmProvider
Source§fn chat(&self, req: &ChatRequest) -> Result<ChatResponse>
fn chat(&self, req: &ChatRequest) -> Result<ChatResponse>
Blocking, non-streaming chat completion.
Source§fn chat_stream(
&self,
req: &ChatRequest,
on_token: &mut dyn FnMut(ChatToken),
) -> Result<()>
fn chat_stream( &self, req: &ChatRequest, on_token: &mut dyn FnMut(ChatToken), ) -> Result<()>
Streaming chat: calls
on_token for each fragment as it arrives.
Returns when generation is complete or on error. The final call will
have ChatToken::is_final == true.Auto Trait Implementations§
impl !Freeze for LocalLlmProvider
impl RefUnwindSafe for LocalLlmProvider
impl Send for LocalLlmProvider
impl Sync for LocalLlmProvider
impl Unpin for LocalLlmProvider
impl UnsafeUnpin for LocalLlmProvider
impl UnwindSafe for LocalLlmProvider
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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