#[non_exhaustive]pub enum PromptMessage {
System {
content: String,
provider_options: Option<ProviderOptions>,
},
User {
content: Vec<UserPromptPart>,
provider_options: Option<ProviderOptions>,
},
Assistant {
content: Vec<AssistantPromptPart>,
provider_options: Option<ProviderOptions>,
},
Tool {
content: Vec<ToolPromptPart>,
provider_options: Option<ProviderOptions>,
},
}Expand description
A message in a specification prompt, tagged by role.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
System
System instructions.
Fields
§
provider_options: Option<ProviderOptions>Provider-specific options for this message.
User
User input.
Fields
§
content: Vec<UserPromptPart>Text and file parts.
§
provider_options: Option<ProviderOptions>Provider-specific options for this message.
Assistant
Previous assistant output.
Fields
§
content: Vec<AssistantPromptPart>Assistant parts, including tool calls and provider-executed results.
§
provider_options: Option<ProviderOptions>Provider-specific options for this message.
Tool
Tool results and approval responses.
Fields
§
content: Vec<ToolPromptPart>Tool parts.
§
provider_options: Option<ProviderOptions>Provider-specific options for this message.
Implementations§
Source§impl PromptMessage
impl PromptMessage
Sourcepub fn user_text(text: impl Into<String>) -> Self
pub fn user_text(text: impl Into<String>) -> Self
Creates a user message with a single text part.
Sourcepub fn user(content: Vec<UserPromptPart>) -> Self
pub fn user(content: Vec<UserPromptPart>) -> Self
Creates a user message from parts.
Sourcepub fn assistant_text(text: impl Into<String>) -> Self
pub fn assistant_text(text: impl Into<String>) -> Self
Creates an assistant message with a single text part.
Sourcepub fn assistant(content: Vec<AssistantPromptPart>) -> Self
pub fn assistant(content: Vec<AssistantPromptPart>) -> Self
Creates an assistant message from parts.
Sourcepub fn tool(content: Vec<ToolPromptPart>) -> Self
pub fn tool(content: Vec<ToolPromptPart>) -> Self
Creates a tool message from parts.
Sourcepub fn provider_options(&self) -> Option<&ProviderOptions>
pub fn provider_options(&self) -> Option<&ProviderOptions>
Returns the provider options attached to the message.
Trait Implementations§
Source§impl Clone for PromptMessage
impl Clone for PromptMessage
Source§fn clone(&self) -> PromptMessage
fn clone(&self) -> PromptMessage
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 PromptMessage
impl Debug for PromptMessage
Source§impl<'de> Deserialize<'de> for PromptMessage
impl<'de> Deserialize<'de> for PromptMessage
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 PromptMessage
impl PartialEq for PromptMessage
Source§impl Serialize for PromptMessage
impl Serialize for PromptMessage
impl StructuralPartialEq for PromptMessage
Auto Trait Implementations§
impl Freeze for PromptMessage
impl RefUnwindSafe for PromptMessage
impl Send for PromptMessage
impl Sync for PromptMessage
impl Unpin for PromptMessage
impl UnsafeUnpin for PromptMessage
impl UnwindSafe for PromptMessage
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