Skip to main content

MessageRole

Trait MessageRole 

Source
pub trait MessageRole: Clone + PartialEq {
    // Required methods
    fn system() -> Self;
    fn user() -> Self;
    fn assistant() -> Self;
    fn tool() -> Self;
    fn as_str(&self) -> &str;
    fn from_str(s: &str) -> Option<Self>;

    // Provided method
    fn is_system(&self) -> bool { ... }
}
Expand description

Role of a message in the agent conversation.

Required Methods§

Source

fn system() -> Self

Source

fn user() -> Self

Source

fn assistant() -> Self

Source

fn tool() -> Self

Source

fn as_str(&self) -> &str

Source

fn from_str(s: &str) -> Option<Self>

Provided Methods§

Source

fn is_system(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§