pub struct SmartComposeStreamEvent {
pub event_type: String,
pub content: Option<String>,
pub error: Option<String>,
}Expand description
Smart Compose streaming event (SSE mode).
When using Server-Sent Events streaming, the API sends multiple events:
contentevents: contain partial message generationdoneevents: signal completionerrorevents: contain error information
§Example
let event_json = json!({
"type": "content",
"content": "Dear "
});
let event: SmartComposeStreamEvent = serde_json::from_value(event_json).unwrap();
assert_eq!(event.event_type, "content");
assert_eq!(event.content, Some("Dear ".to_string()));Fields§
§event_type: StringEvent type: “content”, “done”, or “error”.
content: Option<String>Content delta (for “content” events).
error: Option<String>Error message (for “error” events).
Trait Implementations§
Source§impl Clone for SmartComposeStreamEvent
impl Clone for SmartComposeStreamEvent
Source§fn clone(&self) -> SmartComposeStreamEvent
fn clone(&self) -> SmartComposeStreamEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SmartComposeStreamEvent
impl Debug for SmartComposeStreamEvent
Source§impl<'de> Deserialize<'de> for SmartComposeStreamEvent
impl<'de> Deserialize<'de> for SmartComposeStreamEvent
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
impl Eq for SmartComposeStreamEvent
Source§impl PartialEq for SmartComposeStreamEvent
impl PartialEq for SmartComposeStreamEvent
Source§fn eq(&self, other: &SmartComposeStreamEvent) -> bool
fn eq(&self, other: &SmartComposeStreamEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SmartComposeStreamEvent
impl Serialize for SmartComposeStreamEvent
impl StructuralPartialEq for SmartComposeStreamEvent
Auto Trait Implementations§
impl Freeze for SmartComposeStreamEvent
impl RefUnwindSafe for SmartComposeStreamEvent
impl Send for SmartComposeStreamEvent
impl Sync for SmartComposeStreamEvent
impl Unpin for SmartComposeStreamEvent
impl UnsafeUnpin for SmartComposeStreamEvent
impl UnwindSafe for SmartComposeStreamEvent
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