pub struct QwenChatProvider { /* private fields */ }Expand description
A real local chat backend: a Qwen2 GGUF model + its tokenizer, driven
through el_runtime::InferenceSession.
Each chat call renders the whole conversation to Qwen2.5 ChatML, builds a
fresh QwenEngine (candle has no public KV-cache reset), then runs the
SDK’s standard provenance-gated session: load_prompt (prefill) →
generate (grammar mask → safety steer → greedy commit). The provider holds
no mutable session state, so it is Send + Sync without locking.
Implementations§
Trait Implementations§
Source§impl LlmProvider for QwenChatProvider
impl LlmProvider for QwenChatProvider
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 QwenChatProvider
impl RefUnwindSafe for QwenChatProvider
impl Send for QwenChatProvider
impl Sync for QwenChatProvider
impl Unpin for QwenChatProvider
impl UnsafeUnpin for QwenChatProvider
impl UnwindSafe for QwenChatProvider
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