pub struct ChatStream { /* private fields */ }Expand description
A streamed piece of a response (re-exported from the single splitter in infr-chat).
Incremental splitter for the streaming server path. Accumulates the raw decoded text and, on each
piece, emits the newly-stable Reasoning (<think>…</think>) and Content deltas — holding back a
marker-length tail so a partial <think>/</think>/<tool_call> marker is never emitted. Once a
tool-call opener appears (and tool calls are allowed) it stops streaming content — matching every
dialect finish() parses (Hermes <tool_call>, the pipe form <|tool_call>, and a Llama-3
bare-JSON {…} body), so non-Hermes calls can’t leak as content while also firing as a ToolCall.
finish() flushes the held-back tails and parses the buffered tool call(s) into ToolCall deltas.
Implementations§
Auto Trait Implementations§
impl Forget for ChatStream
impl Freeze for ChatStream
impl Move for ChatStream
impl RefUnwindSafe for ChatStream
impl Send for ChatStream
impl Sync for ChatStream
impl Unpin for ChatStream
impl UnsafeUnpin for ChatStream
impl UnwindSafe for ChatStream
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
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