pub struct ChatStreamResponse {
pub id: Option<String>,
pub created: Option<u64>,
pub model: Option<String>,
pub choices: Vec<StreamChoice>,
pub usage: Option<Usage>,
}Expand description
Represents a single streaming chunk from the chat API.
This struct contains a portion of the complete response that arrives as part of an SSE stream. Multiple chunks are typically received and assembled to form the complete response.
§Fields
id- Unique identifier for the streaming session (optional)created- Unix timestamp when the chunk was created (optional)model- Name of the model generating the response (optional)choices- Array of streaming choices, usually containing one itemusage- Token usage statistics, typically only on final chunk
Fields§
§id: Option<String>Unique identifier for the streaming session.
May be a string or number in the wire format, converted to Option<String>.
created: Option<u64>Unix timestamp indicating when the chunk was created.
model: Option<String>Name of the AI model generating the response.
choices: Vec<StreamChoice>Array of streaming choices, typically containing one item per chunk.
Each choice contains a delta with partial content updates.
usage: Option<Usage>Token usage statistics.
This field typically appears only on the final chunk of the stream, providing information about prompt and completion token counts.
Trait Implementations§
Source§impl Clone for ChatStreamResponse
impl Clone for ChatStreamResponse
Source§fn clone(&self) -> ChatStreamResponse
fn clone(&self) -> ChatStreamResponse
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 ChatStreamResponse
impl Debug for ChatStreamResponse
Source§impl<'de> Deserialize<'de> for ChatStreamResponse
impl<'de> Deserialize<'de> for ChatStreamResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChatStreamResponse
impl RefUnwindSafe for ChatStreamResponse
impl Send for ChatStreamResponse
impl Sync for ChatStreamResponse
impl Unpin for ChatStreamResponse
impl UnwindSafe for ChatStreamResponse
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