pub struct CreateMessageResult {
pub content: SamplingContent,
pub role: Role,
pub model: String,
pub stop_reason: StopReason,
}Expand description
sampling/createMessage response result.
Returned by the client with the LLM completion.
Fields§
§content: SamplingContentGenerated content.
role: RoleRole of the generated message (always “assistant”).
model: StringModel that was used.
stop_reason: StopReasonReason generation stopped.
Implementations§
Source§impl CreateMessageResult
impl CreateMessageResult
Sourcepub fn text(text: impl Into<String>, model: impl Into<String>) -> Self
pub fn text(text: impl Into<String>, model: impl Into<String>) -> Self
Creates a new text completion result.
Sourcepub fn with_stop_reason(self, reason: StopReason) -> Self
pub fn with_stop_reason(self, reason: StopReason) -> Self
Sets the stop reason.
Sourcepub fn text_content(&self) -> Option<&str>
pub fn text_content(&self) -> Option<&str>
Returns the text content if this is a text response.
Trait Implementations§
Source§impl Clone for CreateMessageResult
impl Clone for CreateMessageResult
Source§fn clone(&self) -> CreateMessageResult
fn clone(&self) -> CreateMessageResult
Returns a duplicate of the value. Read more
1.0.0 · 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 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<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
Auto Trait Implementations§
impl Freeze for CreateMessageResult
impl RefUnwindSafe for CreateMessageResult
impl Send for CreateMessageResult
impl Sync for CreateMessageResult
impl Unpin 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).