pub struct MessageBuilder { /* private fields */ }Expand description
Accumulating builder for streaming assistant messages.
Implementations§
Source§impl MessageBuilder
impl MessageBuilder
Sourcepub fn new(role: Role) -> Self
pub fn new(role: Role) -> Self
Create a new builder for the given role (typically Role::Assistant).
Sourcepub fn accept(&mut self, chunk: &ChatCompletionChunk) -> bool
pub fn accept(&mut self, chunk: &ChatCompletionChunk) -> bool
Accept one streaming chunk.
Returns true if this chunk contributed visible text content.
Sourcepub fn peek_tool_calls(&self) -> Vec<ToolCall>
pub fn peek_tool_calls(&self) -> Vec<ToolCall>
Snapshot of tool calls accumulated so far.
Auto Trait Implementations§
impl Freeze for MessageBuilder
impl RefUnwindSafe for MessageBuilder
impl Send for MessageBuilder
impl Sync for MessageBuilder
impl Unpin for MessageBuilder
impl UnsafeUnpin for MessageBuilder
impl UnwindSafe for MessageBuilder
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