pub struct LlmResponseBuilder { /* private fields */ }Implementations§
Source§impl LlmResponseBuilder
impl LlmResponseBuilder
pub fn new() -> Self
pub fn text(self, chunks: &[&str]) -> Self
pub fn reasoning(self, chunks: &[&str]) -> Self
pub fn tool_call(self, id: &str, name: &str, argument_chunks: &[&str]) -> Self
pub fn usage(self, input_tokens: u64, output_tokens: u64) -> Self
pub fn tool_call_with_invalid_json(self, id: &str, name: &str) -> Self
pub fn build(self) -> Vec<LlmResponse>
pub fn build_with_stop_reason(self, stop_reason: StopReason) -> Vec<LlmResponse>
pub fn build_results(self) -> Vec<Result<LlmResponse, LlmError>>
Sourcepub fn build_with_error(
self,
error: impl Into<LlmError>,
) -> Vec<Result<LlmResponse, LlmError>>
pub fn build_with_error( self, error: impl Into<LlmError>, ) -> Vec<Result<LlmResponse, LlmError>>
The stream surfaces error after the frames built so far, then closes
with Done — a provider that reports a failure before ending cleanly.
Sourcepub fn build_interrupted(
self,
error: impl Into<LlmError>,
) -> Vec<Result<LlmResponse, LlmError>>
pub fn build_interrupted( self, error: impl Into<LlmError>, ) -> Vec<Result<LlmResponse, LlmError>>
The stream dies on error instead of delivering Done — a connection
lost mid-flight.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LlmResponseBuilder
impl RefUnwindSafe for LlmResponseBuilder
impl Send for LlmResponseBuilder
impl Sync for LlmResponseBuilder
impl Unpin for LlmResponseBuilder
impl UnsafeUnpin for LlmResponseBuilder
impl UnwindSafe for LlmResponseBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.