pub struct CallStream { /* private fields */ }Expand description
extract’s rules, applied one token at a time.
Fed every generated token in order, it answers what to put on the wire for
it. The outcome matches what extract would have produced from the
concatenated reply, with one unavoidable difference: extract trims the
prose that framed a removed block, and a stream has already sent that
whitespace by the time the block it framed appears.
Pure and clock-free like the rest of the module, so the state machine is pinned by unit tests rather than by a live model.
The other difference is [find_close]’s string awareness, which has no
streaming equivalent and does not need one. A </tool_call> written inside
an argument string reaches extract as twelve characters of a JSON
literal; it reaches here as CLOSE_TAG_ID, the id the model chose to
sample, and an id is not text. Closing there is the honest reading of what
the model emitted, and it is also the only reading available: the fallback
that makes the buffered scan safe — search the rest of the reply — is a
rest that does not exist yet.
Implementations§
Source§impl CallStream
impl CallStream
Sourcepub fn new(enabled: bool) -> Self
pub fn new(enabled: bool) -> Self
A stream that recovers calls, or one that passes everything through.
Trait Implementations§
Source§impl Clone for CallStream
impl Clone for CallStream
Auto Trait Implementations§
impl Freeze for CallStream
impl RefUnwindSafe for CallStream
impl Send for CallStream
impl Sync for CallStream
impl Unpin for CallStream
impl UnsafeUnpin for CallStream
impl UnwindSafe for CallStream
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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> ⓘ
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> ⓘ
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