pub struct StreamAccumulator { /* private fields */ }Expand description
Manages the accumulation and merging of content deltas for streaming responses
Implementations§
Source§impl StreamAccumulator
 
impl StreamAccumulator
Sourcepub fn add_partial(
    &mut self,
    partial: PartialModelResponse,
) -> Result<(), String>
 
pub fn add_partial( &mut self, partial: PartialModelResponse, ) -> Result<(), String>
Adds a chunk of content deltas to the accumulator
§Errors
Returns an error if delta types mismatch for the same index
Sourcepub fn compute_response(self) -> LanguageModelResult<ModelResponse>
 
pub fn compute_response(self) -> LanguageModelResult<ModelResponse>
Computes the final response from accumulated deltas
§Errors
Returns an error if required fields are missing or format is unsupported
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StreamAccumulator
impl RefUnwindSafe for StreamAccumulator
impl Send for StreamAccumulator
impl Sync for StreamAccumulator
impl Unpin for StreamAccumulator
impl UnwindSafe for StreamAccumulator
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