pub struct ChatRequestBuilder<'a> { /* private fields */ }Expand description
Builder for chat requests.
Implementations§
Source§impl<'a> ChatRequestBuilder<'a>
impl<'a> ChatRequestBuilder<'a>
Sourcepub fn temperature(self, temp: f64) -> Self
pub fn temperature(self, temp: f64) -> Self
Set temperature.
Sourcepub fn max_tokens(self, max: u32) -> Self
pub fn max_tokens(self, max: u32) -> Self
Set max tokens.
Sourcepub fn tools(self, tools: Vec<ToolDefinition>) -> Self
pub fn tools(self, tools: Vec<ToolDefinition>) -> Self
Set tools for function calling.
Sourcepub fn tool_choice(self, tool_choice: Value) -> Self
pub fn tool_choice(self, tool_choice: Value) -> Self
Set tool_choice (OpenAI-style).
Sourcepub async fn execute_stream(
self,
) -> Result<Pin<Box<dyn Stream<Item = Result<StreamingEvent>> + Send + 'static>>>
pub async fn execute_stream( self, ) -> Result<Pin<Box<dyn Stream<Item = Result<StreamingEvent>> + Send + 'static>>>
Execute the request and return a stream of events.
Sourcepub async fn execute_stream_with_cancel_and_stats(
self,
) -> Result<(Pin<Box<dyn Stream<Item = Result<StreamingEvent>> + Send + 'static>>, CancelHandle, CallStats)>
pub async fn execute_stream_with_cancel_and_stats( self, ) -> Result<(Pin<Box<dyn Stream<Item = Result<StreamingEvent>> + Send + 'static>>, CancelHandle, CallStats)>
Execute the request and return a cancellable stream of events plus per-call stats.
Streaming semantics:
- retry/fallback may happen only before any event is emitted to the caller
- once an event is emitted, we will not retry automatically to avoid duplicate output
Sourcepub async fn execute_stream_with_cancel(
self,
) -> Result<(Pin<Box<dyn Stream<Item = Result<StreamingEvent>> + Send + 'static>>, CancelHandle)>
pub async fn execute_stream_with_cancel( self, ) -> Result<(Pin<Box<dyn Stream<Item = Result<StreamingEvent>> + Send + 'static>>, CancelHandle)>
Execute the request and return a cancellable stream of events.
Sourcepub async fn execute(self) -> Result<UnifiedResponse>
pub async fn execute(self) -> Result<UnifiedResponse>
Execute the request and return the complete response.
Auto Trait Implementations§
impl<'a> Freeze for ChatRequestBuilder<'a>
impl<'a> !RefUnwindSafe for ChatRequestBuilder<'a>
impl<'a> Send for ChatRequestBuilder<'a>
impl<'a> Sync for ChatRequestBuilder<'a>
impl<'a> Unpin for ChatRequestBuilder<'a>
impl<'a> !UnwindSafe for ChatRequestBuilder<'a>
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