pub struct TypedModelStream<O> {
pub stream: Pin<Box<dyn Stream<Item = Result<StreamDelta, Error>> + Send>>,
pub completion: Pin<Box<dyn Future<Output = Result<O, Error>> + Send>>,
}Expand description
Streaming counterpart to a complete_typed call — raw deltas on
stream, the aggregated typed payload on completion.
The stream field is identical to ModelStream::stream: raw
StreamDeltas the consumer surfaces to the user (text
fragments, thinking deltas, …) as the model emits them. The
completion future resolves to the typed O parsed from the
aggregated final response — operators await it once the stream
has been drained.
Mirrors crate::service::ModelStream for the typed-output
path; the underlying aggregator is the same tap_aggregator
used by ChatModel::stream_deltas.
Fields§
§stream: Pin<Box<dyn Stream<Item = Result<StreamDelta, Error>> + Send>>Raw delta stream surfaced to the consumer.
completion: Pin<Box<dyn Future<Output = Result<O, Error>> + Send>>Future resolving to the typed O after the stream has been
consumed to its terminal Stop. Drops the TypedModelStream
before draining the stream to surface an Err on completion.
Trait Implementations§
Auto Trait Implementations§
impl<O> Freeze for TypedModelStream<O>
impl<O> !RefUnwindSafe for TypedModelStream<O>
impl<O> Send for TypedModelStream<O>
impl<O> !Sync for TypedModelStream<O>
impl<O> Unpin for TypedModelStream<O>
impl<O> UnsafeUnpin for TypedModelStream<O>
impl<O> !UnwindSafe for TypedModelStream<O>
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request