pub struct SmartComposeRequest {
pub prompt: String,
pub message_id: Option<MessageId>,
pub temperature: Option<f32>,
}Expand description
Request for Smart Compose AI message generation.
§Example
// New message
let request = SmartComposeRequest::new(
"Write a professional email asking for a meeting next week"
);
// Reply to existing message
let reply = SmartComposeRequest::reply_to(
"Write a polite decline",
MessageId::new("msg_123")
).with_temperature(0.7);Fields§
§prompt: StringPrompt for message generation (max 1000 tokens).
message_id: Option<MessageId>Message ID to reply to (optional).
temperature: Option<f32>Temperature for generation (0.0 - 1.0). Lower values are more deterministic, higher values are more creative.
Implementations§
Source§impl SmartComposeRequest
impl SmartComposeRequest
Sourcepub fn new(prompt: impl Into<String>) -> Self
pub fn new(prompt: impl Into<String>) -> Self
Create a new Smart Compose request for generating a new message.
Sourcepub fn reply_to(prompt: impl Into<String>, message_id: MessageId) -> Self
pub fn reply_to(prompt: impl Into<String>, message_id: MessageId) -> Self
Create a Smart Compose request for replying to an existing message.
Sourcepub fn with_temperature(self, temperature: f32) -> Self
pub fn with_temperature(self, temperature: f32) -> Self
Set the temperature for generation (0.0 - 1.0).
Trait Implementations§
Source§impl Clone for SmartComposeRequest
impl Clone for SmartComposeRequest
Source§fn clone(&self) -> SmartComposeRequest
fn clone(&self) -> SmartComposeRequest
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 SmartComposeRequest
impl Debug for SmartComposeRequest
Source§impl<'de> Deserialize<'de> for SmartComposeRequest
impl<'de> Deserialize<'de> for SmartComposeRequest
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
Source§impl PartialEq for SmartComposeRequest
impl PartialEq for SmartComposeRequest
Source§fn eq(&self, other: &SmartComposeRequest) -> bool
fn eq(&self, other: &SmartComposeRequest) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SmartComposeRequest
impl Serialize for SmartComposeRequest
impl StructuralPartialEq for SmartComposeRequest
Auto Trait Implementations§
impl Freeze for SmartComposeRequest
impl RefUnwindSafe for SmartComposeRequest
impl Send for SmartComposeRequest
impl Sync for SmartComposeRequest
impl Unpin for SmartComposeRequest
impl UnsafeUnpin for SmartComposeRequest
impl UnwindSafe for SmartComposeRequest
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