pub struct Message {
pub id: String,
pub name: Option<String>,
pub role: MessageRole,
pub parts: Vec<Part>,
pub created_at: i64,
pub agent_id: Option<String>,
pub parts_metadata: Option<PartsMetadata>,
}Fields§
§id: String§name: Option<String>§role: MessageRole§parts: Vec<Part>§created_at: i64§agent_id: Option<String>The ID of the agent that generated this message (for Assistant messages)
parts_metadata: Option<PartsMetadata>Per-part metadata used to control part behavior during save.
Parts with save: false will be filtered out before saving to the database.
This field is used for processing only and is not persisted.
Implementations§
Source§impl Message
impl Message
pub fn user(task: String, name: Option<String>) -> Self
pub fn system(task: String, name: Option<String>) -> Self
pub fn assistant(task: String, name: Option<String>) -> Self
pub fn developer(task: String, name: Option<String>) -> Self
pub fn tool_response( tool_call_id: String, tool_name: String, result: &Value, ) -> Self
pub fn as_text(&self) -> Option<String>
pub fn tool_calls(&self) -> Vec<ToolCall>
pub fn tool_responses(&self) -> Vec<ToolResponse>
pub fn has_tool_response(&self) -> bool
Sourcepub fn filter_for_save(&self, parts_metadata: Option<&PartsMetadata>) -> Self
pub fn filter_for_save(&self, parts_metadata: Option<&PartsMetadata>) -> Self
Filter parts based on metadata, returning a new Message with only saveable parts.
Parts with save: false in the parts_metadata will be filtered out.
If parts_metadata is None, all parts are included.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
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<Message> for MessageMetadata
impl From<Message> for MessageMetadata
Source§impl JsonSchema for Message
impl JsonSchema for Message
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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