pub struct CreateMessageResult {
pub role: Role,
pub content: SamplingMessageContent,
pub model: String,
pub stop_reason: Option<String>,
pub meta: Option<ResultMetaObject>,
}Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
Expand description
Result for sampling/createMessage — extends SamplingMessage
(role, content, _meta) plus model and optional stopReason.
Deprecated per SEP-2577 — see module-level docs.
Fields§
§role: RoleDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
content: SamplingMessageContentDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
model: StringDeprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
stop_reason: Option<String>Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
meta: Option<ResultMetaObject>Deprecated per SEP-2577 (2026-07-28). Replacement: integrate directly with LLM provider APIs. Earliest removal: first release on/after 2027-07-28.
Implementations§
Source§impl CreateMessageResult
impl CreateMessageResult
pub fn new( role: Role, content: SamplingMessageContent, model: impl Into<String>, ) -> CreateMessageResult
Sourcepub fn single(
role: Role,
block: SamplingMessageContentBlock,
model: impl Into<String>,
) -> CreateMessageResult
pub fn single( role: Role, block: SamplingMessageContentBlock, model: impl Into<String>, ) -> CreateMessageResult
Convenience: single-block result (most common LLM response shape).
pub fn with_stop_reason(self, reason: impl Into<String>) -> CreateMessageResult
pub fn with_meta(self, meta: impl Into<ResultMetaObject>) -> CreateMessageResult
Trait Implementations§
Source§impl Clone for CreateMessageResult
impl Clone for CreateMessageResult
Source§fn clone(&self) -> CreateMessageResult
fn clone(&self) -> CreateMessageResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl CreateMessageResult for CreateMessageResult
impl CreateMessageResult for CreateMessageResult
Source§fn role(&self) -> &Role
fn role(&self) -> &Role
Deprecated per SEP-2577 (2026-07-28) with the Sampling surface. Earliest removal: first release on/after 2027-07-28.
Source§fn content(&self) -> &SamplingMessageContent
fn content(&self) -> &SamplingMessageContent
Deprecated per SEP-2577 (2026-07-28) with the Sampling surface. Earliest removal: first release on/after 2027-07-28.
Source§fn model(&self) -> &String
fn model(&self) -> &String
Deprecated per SEP-2577 (2026-07-28) with the Sampling surface. Earliest removal: first release on/after 2027-07-28.
Source§fn stop_reason(&self) -> Option<&String>
fn stop_reason(&self) -> Option<&String>
Deprecated per SEP-2577 (2026-07-28) with the Sampling surface. Earliest removal: first release on/after 2027-07-28.