pub struct PartialResponse { /* private fields */ }Expand description
Accumulates streaming deltas into a complete response.
Implementations§
Source§impl PartialResponse
impl PartialResponse
Sourcepub fn apply_text_delta(&mut self, index: usize, content: &str)
pub fn apply_text_delta(&mut self, index: usize, content: &str)
Apply a text delta.
Sourcepub fn apply_tool_delta(
&mut self,
index: usize,
name: Option<&str>,
args_delta: Option<&str>,
id: Option<&str>,
)
pub fn apply_tool_delta( &mut self, index: usize, name: Option<&str>, args_delta: Option<&str>, id: Option<&str>, )
Apply a tool call delta.
Sourcepub fn apply_thinking_delta(
&mut self,
index: usize,
content: &str,
signature: Option<&str>,
)
pub fn apply_thinking_delta( &mut self, index: usize, content: &str, signature: Option<&str>, )
Apply a thinking delta.
Sourcepub fn set_model_name(&mut self, name: impl Into<String>)
pub fn set_model_name(&mut self, name: impl Into<String>)
Set the model name.
Sourcepub fn set_usage(&mut self, usage: RequestUsage)
pub fn set_usage(&mut self, usage: RequestUsage)
Set the usage.
Sourcepub fn set_finish_reason(&mut self, reason: FinishReason)
pub fn set_finish_reason(&mut self, reason: FinishReason)
Set the finish reason.
Sourcepub fn set_vendor_id(&mut self, id: impl Into<String>)
pub fn set_vendor_id(&mut self, id: impl Into<String>)
Set the vendor ID.
Sourcepub fn text_content(&self) -> String
pub fn text_content(&self) -> String
Get accumulated text content.
Sourcepub fn finalize(self) -> ModelResponse
pub fn finalize(self) -> ModelResponse
Finalize into a complete response (consumes self).
Sourcepub fn as_response(&self) -> ModelResponse
pub fn as_response(&self) -> ModelResponse
Get a snapshot as a response (clones data).
Source§impl PartialResponse
impl PartialResponse
Sourcepub fn apply_delta(&mut self, delta: &ResponseDelta)
pub fn apply_delta(&mut self, delta: &ResponseDelta)
Apply a delta to the response.
Trait Implementations§
Source§impl Clone for PartialResponse
impl Clone for PartialResponse
Source§fn clone(&self) -> PartialResponse
fn clone(&self) -> PartialResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PartialResponse
impl Debug for PartialResponse
Auto Trait Implementations§
impl Freeze for PartialResponse
impl RefUnwindSafe for PartialResponse
impl Send for PartialResponse
impl Sync for PartialResponse
impl Unpin for PartialResponse
impl UnwindSafe for PartialResponse
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