pub struct Message {
pub role: MessageRole,
pub parts: Vec<Part>,
pub metadata: BTreeMap<String, Value>,
}Expand description
A message exchanged between a client and an agent.
The wire form is { "role": "user" | "agent", "parts": [<Part>, ...], "metadata"?: {...} }.
Fields§
§role: MessageRoleThe role of the message’s author. The spec fixes the two values; anything else is a wire error.
parts: Vec<Part>The message’s content. A message with no
parts is technically valid per the
OpenAPI 3.x shape, but it is not
useful — a message with no content is a
no-op on the wire.
metadata: BTreeMap<String, Value>Per-message metadata. The spec leaves the
shape open; the conventional keys are
"trace_id", "session_id", and the
custom names a particular deployment
uses. The map is BTreeMap so the wire
form is deterministic (alphabetical by
key), which keeps test fixtures readable.
Implementations§
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
impl Eq for Message
Source§impl From<Message> for SendMessageResponse
impl From<Message> for SendMessageResponse
impl StructuralPartialEq for Message
Auto 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