pub struct LlmMessage {
pub role: LlmMessageRole,
pub content: LlmMessageContent,
pub tool_calls: Option<Vec<ToolCall>>,
pub tool_call_id: Option<String>,
pub phase: Option<ExecutionPhase>,
pub thinking: Option<String>,
pub thinking_signature: Option<String>,
}Expand description
Message format for LLM calls (provider-agnostic)
Fields§
§role: LlmMessageRole§content: LlmMessageContent§tool_calls: Option<Vec<ToolCall>>§tool_call_id: Option<String>§phase: Option<ExecutionPhase>Execution phase for assistant messages.
Helps models distinguish between intermediate working commentary (Commentary)
and completed answers (FinalAnswer) in multi-step tool-calling flows.
Only set on assistant messages. Must be preserved when replaying conversation history.
thinking: Option<String>Thinking content from extended thinking models (Anthropic Claude) Must be included in subsequent API calls when thinking is enabled
thinking_signature: Option<String>Cryptographic signature for thinking content (Anthropic Claude) Required when sending thinking back in subsequent API calls
Implementations§
Source§impl LlmMessage
impl LlmMessage
Sourcepub fn text(role: LlmMessageRole, content: impl Into<String>) -> LlmMessage
pub fn text(role: LlmMessageRole, content: impl Into<String>) -> LlmMessage
Create a message with text content
Sourcepub fn parts(role: LlmMessageRole, parts: Vec<LlmContentPart>) -> LlmMessage
pub fn parts(role: LlmMessageRole, parts: Vec<LlmContentPart>) -> LlmMessage
Create a message with content parts (text, images, audio)
Sourcepub fn content_as_text(&self) -> String
pub fn content_as_text(&self) -> String
Get content as plain text string (for simple cases)
Sourcepub fn prepend_text_prefix(&mut self, prefix: &str)
pub fn prepend_text_prefix(&mut self, prefix: &str)
Prepend a prefix to the first text content.
Used by ReasonAtom to inject external actor identity (e.g. "[Alice] ")
into user messages from external channels.
Trait Implementations§
Source§impl Clone for LlmMessage
impl Clone for LlmMessage
Source§fn clone(&self) -> LlmMessage
fn clone(&self) -> LlmMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LlmMessage
impl RefUnwindSafe for LlmMessage
impl Send for LlmMessage
impl Sync for LlmMessage
impl Unpin for LlmMessage
impl UnsafeUnpin for LlmMessage
impl UnwindSafe for LlmMessage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request