Public declaration syntax from forge-rs/crates/forge-core/src/message.rs Original source SHA-256: dada14769180f58bebe5e4fe0436c2f09b3002b0e6637161984651a18f18b290 Function bodies and constant values are omitted. This is not the complete implementation. Source line 21 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Role { /// System instructions that configure agent behavior. System, /// User-provided input. User, /// Model-generated output. Assistant, /// Tool execution results. Tool, } Source line 34 pub fn as_str(&self) -> &'static str; Source line 65 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] pub enum MessagePart { /// Plain text content. Text { /// The text content. text: String, }, /// An image (base64 or URL). Image { /// Base64-encoded image data, or a URL. data: String, /// MIME type (e.g., "image/png"). media_type: String, }, /// A tool call request from the model. ToolCall { /// Unique identifier for this tool call. id: String, /// The tool name. name: String, /// JSON arguments for the tool. arguments: serde_json::Value, }, /// A result from a tool execution. ToolResult { /// The tool call ID this result corresponds to. tool_call_id: String, /// The tool name. name: String, /// The result content (typically stringified). content: String, /// Whether the tool execution resulted in an error. is_error: bool, }, } Source line 117 pub fn text(text: impl Into) -> Self; Source line 127 pub fn image(data: impl Into, media_type: impl Into) -> Self; Source line 141 pub fn tool_call( id: impl Into, name: impl Into, arguments: serde_json::Value, ) -> Self; Source line 161 pub fn tool_result( tool_call_id: impl Into, name: impl Into, content: impl Into, is_error: bool, ) -> Self; Source line 176 pub fn is_tool_call(&self) -> bool; Source line 181 pub fn is_tool_result(&self) -> bool; Source line 198 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ModelMessage { } Source line 210 pub fn new(role: Role, parts: Vec) -> Self; Source line 228 pub fn text(role: Role, text: impl Into) -> Self; Source line 236 pub fn role(&self) -> Role; Source line 241 pub fn parts(&self) -> &[MessagePart]; Source line 246 pub fn parts_mut(&mut self) -> &mut Vec; Source line 251 pub fn tool_calls(&self) -> Vec<&MessagePart>; Source line 256 pub fn text_content(&self) -> String;