#[non_exhaustive]pub struct CreateMessageResult {
pub model: String,
pub stop_reason: Option<String>,
pub message: SamplingMessage,
}Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
Expand description
Result of sampling/createMessage (SEP-1577). The result of a sampling/createMessage request containing the generated response.
This structure contains the generated message along with metadata about how the generation was performed and why it stopped.
Fields (Non-exhaustive)ยง
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model: StringSampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
The identifier of the model that generated the response
stop_reason: Option<String>Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
The reason why generation stopped (e.g., โendTurnโ, โmaxTokensโ)
message: SamplingMessageSampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577
The generated message with role and content
Implementationsยง
Sourceยงimpl CreateMessageResult
impl CreateMessageResult
pub const STOP_REASON_END_TURN: &'static str = "endTurn"
pub const STOP_REASON_END_SEQUENCE: &'static str = "stopSequence"
pub const STOP_REASON_END_MAX_TOKEN: &'static str = "maxTokens"
pub const STOP_REASON_TOOL_USE: &'static str = "toolUse"
Sourcepub fn new(message: SamplingMessage, model: String) -> CreateMessageResult
pub fn new(message: SamplingMessage, model: String) -> CreateMessageResult
Create a new CreateMessageResult with required fields.
Sourcepub fn with_stop_reason(
self,
stop_reason: impl Into<String>,
) -> CreateMessageResult
pub fn with_stop_reason( self, stop_reason: impl Into<String>, ) -> CreateMessageResult
Set the stop reason.
Sourcepub fn with_model(self, model: impl Into<String>) -> CreateMessageResult
pub fn with_model(self, model: impl Into<String>) -> CreateMessageResult
Set the model identifier.
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 Debug for CreateMessageResult
impl Debug for CreateMessageResult
Sourceยงimpl<'de> Deserialize<'de> for CreateMessageResult
impl<'de> Deserialize<'de> for CreateMessageResult
Sourceยงfn deserialize<__D>(
__deserializer: __D,
) -> Result<CreateMessageResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CreateMessageResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Sourceยงimpl From<CreateMessageResult> for ClientResult
impl From<CreateMessageResult> for ClientResult
Sourceยงfn from(value: CreateMessageResult) -> ClientResult
fn from(value: CreateMessageResult) -> ClientResult
Sourceยงimpl JsonSchema for CreateMessageResult
impl JsonSchema for CreateMessageResult
Sourceยงfn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Sourceยงfn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Sourceยงfn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSourceยงimpl PartialEq for CreateMessageResult
impl PartialEq for CreateMessageResult
Sourceยงimpl Serialize for CreateMessageResult
impl Serialize for CreateMessageResult
Sourceยงfn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for CreateMessageResult
Auto Trait Implementationsยง
impl Freeze for CreateMessageResult
impl RefUnwindSafe for CreateMessageResult
impl Send for CreateMessageResult
impl Sync for CreateMessageResult
impl Unpin for CreateMessageResult
impl UnsafeUnpin for CreateMessageResult
impl UnwindSafe for CreateMessageResult
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 more