pub enum Role {
System,
Developer,
User,
Assistant,
Tool,
}
Expand description
Message role in a conversation
Specifies who or what is sending a message in a chat completion. Different roles have different behaviors and restrictions.
§Examples
use openrouter_rs::types::Role;
use openrouter_rs::api::chat::Message;
let system_msg = Message::new(Role::System, "You are a helpful assistant");
let user_msg = Message::new(Role::User, "Hello, world!");
let assistant_msg = Message::new(Role::Assistant, "Hello! How can I help?");
Variants§
System
System instructions that guide the AI’s behavior
Developer
Developer/admin context (provider-specific)
User
User input or questions
Assistant
AI assistant responses
Tool
Results from tool/function calls
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Role
impl<'de> Deserialize<'de> for Role
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
Auto Trait Implementations§
impl Freeze for Role
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnwindSafe for Role
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