pub struct PromptMessage {
pub role: String,
pub content: String,
pub reasoning_content: Option<String>,
pub name: Option<String>,
pub tool_calls: Option<Vec<PromptToolCall>>,
pub tool_call_id: Option<String>,
pub function_call: Option<ChatFunctionCall>,
}Expand description
Common prompt-message shape used by both CLI run and OpenAI serve.
Fields§
§role: String§content: String§reasoning_content: Option<String>§name: Option<String>§tool_calls: Option<Vec<PromptToolCall>>§tool_call_id: Option<String>§function_call: Option<ChatFunctionCall>Implementations§
Source§impl PromptMessage
impl PromptMessage
Sourcepub fn new(role: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(role: impl Into<String>, content: impl Into<String>) -> Self
Content is passed to the chat template verbatim — including any
<think>...</think> blocks in assistant history. Whether reasoning
is kept or stripped from history is a per-template policy (DeepSeek
strips it, Qwen3-Coder keeps it); pre-splitting here diverged from
what transformers.apply_chat_template feeds the same template.
reasoning_content is only set when the client supplies reasoning
as a separate field.
Trait Implementations§
Source§impl Clone for PromptMessage
impl Clone for PromptMessage
Source§fn clone(&self) -> PromptMessage
fn clone(&self) -> PromptMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PromptMessage
impl Debug for PromptMessage
Auto Trait Implementations§
impl Freeze for PromptMessage
impl RefUnwindSafe for PromptMessage
impl Send for PromptMessage
impl Sync for PromptMessage
impl Unpin for PromptMessage
impl UnsafeUnpin for PromptMessage
impl UnwindSafe for PromptMessage
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