Trait BaseMessage

Source
pub trait BaseMessage: Send + Sync {
    // Required methods
    fn content(&self) -> &MessageContent;
    fn message_type(&self) -> &str;
    fn additional_kwargs(&self) -> &HashMap<String, Value>;
    fn response_metadata(&self) -> &HashMap<String, Value>;
    fn name(&self) -> Option<&str>;
    fn id(&self) -> Option<&str>;

    // Provided methods
    fn text(&self) -> String { ... }
    fn is_human(&self) -> bool { ... }
    fn is_ai(&self) -> bool { ... }
    fn is_system(&self) -> bool { ... }
    fn is_tool(&self) -> bool { ... }
}
Expand description

Base message trait that all message types implement

Required Methods§

Source

fn content(&self) -> &MessageContent

Get the content of the message

Source

fn message_type(&self) -> &str

Get the message type

Source

fn additional_kwargs(&self) -> &HashMap<String, Value>

Get additional kwargs

Source

fn response_metadata(&self) -> &HashMap<String, Value>

Get response metadata

Source

fn name(&self) -> Option<&str>

Get the message name

Source

fn id(&self) -> Option<&str>

Get the message ID

Provided Methods§

Source

fn text(&self) -> String

Convert the message content to text

Source

fn is_human(&self) -> bool

Check if this is a human message

Source

fn is_ai(&self) -> bool

Check if this is an AI message

Source

fn is_system(&self) -> bool

Check if this is a system message

Source

fn is_tool(&self) -> bool

Check if this is a tool message

Implementors§