pub struct StreamingApi { /* private fields */ }Expand description
Streaming API client (extends ResponsesApi)
Implementations§
Source§impl StreamingApi
impl StreamingApi
Sourcepub fn with_base_url<S: Into<String>>(api_key: S, base_url: S) -> Result<Self>
pub fn with_base_url<S: Into<String>>(api_key: S, base_url: S) -> Result<Self>
Create a new StreamingApi client with custom base URL
Sourcepub async fn create_response_stream(
&self,
request: &ResponseRequest,
) -> Result<ResponseStream>
pub async fn create_response_stream( &self, request: &ResponseRequest, ) -> Result<ResponseStream>
Create a streaming response
Sourcepub async fn create_text_stream(
&self,
model: impl Into<String>,
prompt: impl Into<String>,
) -> Result<ResponseStream>
pub async fn create_text_stream( &self, model: impl Into<String>, prompt: impl Into<String>, ) -> Result<ResponseStream>
Create a simple text streaming response
Sourcepub async fn create_chat_stream(
&self,
model: impl Into<String>,
messages: Vec<Message>,
) -> Result<ResponseStream>
pub async fn create_chat_stream( &self, model: impl Into<String>, messages: Vec<Message>, ) -> Result<ResponseStream>
Create a streaming chat response
Sourcepub async fn create_instructed_stream(
&self,
model: impl Into<String>,
input: impl Into<String>,
instructions: impl Into<String>,
) -> Result<ResponseStream>
pub async fn create_instructed_stream( &self, model: impl Into<String>, input: impl Into<String>, instructions: impl Into<String>, ) -> Result<ResponseStream>
Create a streaming response with instructions
Sourcepub async fn collect_stream_response(stream: ResponseStream) -> Result<String>
pub async fn collect_stream_response(stream: ResponseStream) -> Result<String>
Collect all chunks from a stream into a single response
Sourcepub async fn create_channel_stream(
&self,
request: &ResponseRequest,
) -> Result<UnboundedReceiverStream<Result<StreamChunk>>>
pub async fn create_channel_stream( &self, request: &ResponseRequest, ) -> Result<UnboundedReceiverStream<Result<StreamChunk>>>
Create a channel-based stream for easier handling
Sourcepub async fn create_function_stream(
&self,
request: &ResponseRequest,
tools: Vec<Tool>,
tool_choice: Option<ToolChoice>,
) -> Result<FunctionStream>
pub async fn create_function_stream( &self, request: &ResponseRequest, tools: Vec<Tool>, tool_choice: Option<ToolChoice>, ) -> Result<FunctionStream>
Create a streaming response with function calling support
Sourcepub async fn call_function_stream(
&self,
model: impl Into<String>,
prompt: impl Into<String>,
tools: Vec<Tool>,
tool_choice: Option<ToolChoice>,
) -> Result<FunctionStream>
pub async fn call_function_stream( &self, model: impl Into<String>, prompt: impl Into<String>, tools: Vec<Tool>, tool_choice: Option<ToolChoice>, ) -> Result<FunctionStream>
Create a simple function call stream
Sourcepub fn responses_api(&self) -> &ResponsesApi
pub fn responses_api(&self) -> &ResponsesApi
Get access to the underlying ResponsesApi
Trait Implementations§
Source§impl ApiClientConstructors for StreamingApi
impl ApiClientConstructors for StreamingApi
Source§fn from_http_client(http_client: HttpClient) -> Self
fn from_http_client(http_client: HttpClient) -> Self
Create a new instance with the HTTP client
Source§impl Clone for StreamingApi
impl Clone for StreamingApi
Source§fn clone(&self) -> StreamingApi
fn clone(&self) -> StreamingApi
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 moreAuto Trait Implementations§
impl Freeze for StreamingApi
impl !RefUnwindSafe for StreamingApi
impl Send for StreamingApi
impl Sync for StreamingApi
impl Unpin for StreamingApi
impl !UnwindSafe for StreamingApi
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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