#[non_exhaustive]pub struct StreamingModelInvocation {
pub inner: ModelInvocation,
}Expand description
Streaming-side counterpart to ModelInvocation — the same
request + ctx payload but a distinct request type so the
tower::Service trait’s associated Response can resolve to
ModelStream for the streaming spine while ModelInvocation
keeps resolving to ModelResponse for the one-shot spine.
Rust’s Service<Request> carries Response as an associated
type — one trait impl per (Self, Request) pair. The wrapper
here is the cleanest way to expose two response types from one
leaf service: the same InnerChatModel<C, T> implements
Service<ModelInvocation, Response = ModelResponse> and
Service<StreamingModelInvocation, Response = ModelStream>,
and layers stack onto each independently.
#[non_exhaustive] to keep room for streaming-only knobs
(chunk size hints, partial-output buffers) post-1.0 without
breaking callers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.inner: ModelInvocationThe wrapped one-shot invocation. Streaming layers read
request and ctx through this — same fields, same
semantics, different Service shape.
Implementations§
Source§impl StreamingModelInvocation
impl StreamingModelInvocation
Sourcepub const fn new(inner: ModelInvocation) -> Self
pub const fn new(inner: ModelInvocation) -> Self
Wrap a ModelInvocation.
Sourcepub const fn request(&self) -> &ModelRequest
pub const fn request(&self) -> &ModelRequest
Borrow the request — read-side shortcut so layers don’t
have to write invocation.inner.request.
Sourcepub const fn ctx(&self) -> &ExecutionContext
pub const fn ctx(&self) -> &ExecutionContext
Borrow the context — read-side shortcut.
Trait Implementations§
Source§impl Clone for StreamingModelInvocation
impl Clone for StreamingModelInvocation
Source§fn clone(&self) -> StreamingModelInvocation
fn clone(&self) -> StreamingModelInvocation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamingModelInvocation
impl Debug for StreamingModelInvocation
Source§impl From<ModelInvocation> for StreamingModelInvocation
impl From<ModelInvocation> for StreamingModelInvocation
Source§fn from(inner: ModelInvocation) -> Self
fn from(inner: ModelInvocation) -> Self
Source§impl Retryable for StreamingModelInvocation
impl Retryable for StreamingModelInvocation
Source§fn ctx(&self) -> &ExecutionContext
fn ctx(&self) -> &ExecutionContext
ExecutionContext
the retry loop checks for cancellation between attempts.Source§fn ctx_mut(&mut self) -> &mut ExecutionContext
fn ctx_mut(&mut self) -> &mut ExecutionContext
RetryService can stamp an idempotency
key on first entry — every clone of the request that follows
shares the stamped key, so vendor-side dedupe sees one
logical call across N attempts.