Struct openai_rust::chat::stream::ChatResponseEvent
source · pub struct ChatResponseEvent {
pub id: String,
pub created: u32,
pub model: String,
pub choices: Vec<Choice>,
}
Expand description
This is the partial chat result received when streaming.
It implements Display as a shortcut to easily extract the content.
let msg = &res.choices[0].delta.content;
// or
let msg = res.to_string();
Fields§
§id: String
§created: u32
§model: String
§choices: Vec<Choice>
Trait Implementations§
source§impl Clone for ChatResponseEvent
impl Clone for ChatResponseEvent
source§fn clone(&self) -> ChatResponseEvent
fn clone(&self) -> ChatResponseEvent
Returns a copy 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 ChatResponseEvent
impl Debug for ChatResponseEvent
source§impl<'de> Deserialize<'de> for ChatResponseEvent
impl<'de> Deserialize<'de> for ChatResponseEvent
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 RefUnwindSafe for ChatResponseEvent
impl Send for ChatResponseEvent
impl Sync for ChatResponseEvent
impl Unpin for ChatResponseEvent
impl UnwindSafe for ChatResponseEvent
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