pub enum AgentMessage {
User(UserMessage),
Assistant(AssistantMessage),
ToolResult(ToolResultMessage),
Custom {
message_type: String,
data: Value,
},
}Expand description
Agent message - can include custom message types.
The Custom variant allows applications to inject arbitrary domain-specific
messages (e.g., artifacts, notifications) into the conversation. Custom messages
are filtered out by the default convert_to_llm implementation; provide your
own converter to handle them.
Variants§
User(UserMessage)
Assistant(AssistantMessage)
ToolResult(ToolResultMessage)
Custom
Application-specific custom message.
Ignored by the default LLM conversion; callers should provide a custom
convert_to_llm to handle these.
Trait Implementations§
Source§impl Clone for AgentMessage
impl Clone for AgentMessage
Source§fn clone(&self) -> AgentMessage
fn clone(&self) -> AgentMessage
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 AgentMessage
impl Debug for AgentMessage
Source§impl<'de> Deserialize<'de> for AgentMessage
impl<'de> Deserialize<'de> for AgentMessage
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 From<&str> for AgentMessage
Convenience: create a user text message from a &str.
impl From<&str> for AgentMessage
Convenience: create a user text message from a &str.
Source§impl From<AgentMessage> for Option<Message>
impl From<AgentMessage> for Option<Message>
Source§fn from(msg: AgentMessage) -> Self
fn from(msg: AgentMessage) -> Self
Converts to this type from the input type.
Source§impl From<AssistantMessage> for AgentMessage
impl From<AssistantMessage> for AgentMessage
Source§fn from(msg: AssistantMessage) -> Self
fn from(msg: AssistantMessage) -> Self
Converts to this type from the input type.
Source§impl From<Message> for AgentMessage
impl From<Message> for AgentMessage
Source§impl From<String> for AgentMessage
Convenience: create a user text message from a String.
impl From<String> for AgentMessage
Convenience: create a user text message from a String.
Source§impl From<ToolResultMessage> for AgentMessage
impl From<ToolResultMessage> for AgentMessage
Source§fn from(msg: ToolResultMessage) -> Self
fn from(msg: ToolResultMessage) -> Self
Converts to this type from the input type.
Source§impl From<UserMessage> for AgentMessage
impl From<UserMessage> for AgentMessage
Source§fn from(msg: UserMessage) -> Self
fn from(msg: UserMessage) -> Self
Converts to this type from the input type.
Source§impl PartialEq for AgentMessage
impl PartialEq for AgentMessage
Source§impl Serialize for AgentMessage
impl Serialize for AgentMessage
impl StructuralPartialEq for AgentMessage
Auto Trait Implementations§
impl Freeze for AgentMessage
impl RefUnwindSafe for AgentMessage
impl Send for AgentMessage
impl Sync for AgentMessage
impl Unpin for AgentMessage
impl UnsafeUnpin for AgentMessage
impl UnwindSafe for AgentMessage
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