pub struct StreamTextResult {
pub stream: Pin<Box<dyn Stream<Item = Result<StreamPart, AiMuxError>> + Send>>,
pub request_body: Option<Value>,
pub response_headers: Option<HashMap<String, String>>,
}Expand description
Result of stream_text (user-facing).
Fields§
§stream: Pin<Box<dyn Stream<Item = Result<StreamPart, AiMuxError>> + Send>>The stream of StreamPart items.
request_body: Option<Value>The request body that was sent (for debugging / cache probing, RFC-0015).
response_headers: Option<HashMap<String, String>>Response headers.
Implementations§
Source§impl StreamTextResult
impl StreamTextResult
Sourcepub async fn text(self) -> Result<String, AiMuxError>
pub async fn text(self) -> Result<String, AiMuxError>
Consume the stream and collect all text deltas into a single String.
§Errors
Returns the stream’s error part or transport error, propagated from the underlying model stream.
Sourcepub async fn consume(self) -> Result<StreamTextResultAggregated, AiMuxError>
pub async fn consume(self) -> Result<StreamTextResultAggregated, AiMuxError>
Consume the full stream and return an aggregated result (M11).
Unlike text (which returns only the concatenated text),
this collects reasoning, tool calls, sources, files, usage, finish
reason, and builds response_messages for the next turn.
§Errors
Returns the stream’s error part or transport error, propagated from the underlying model stream.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StreamTextResult
impl !Sync for StreamTextResult
impl !UnwindSafe for StreamTextResult
impl Freeze for StreamTextResult
impl Send for StreamTextResult
impl Unpin for StreamTextResult
impl UnsafeUnpin for StreamTextResult
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