pub struct Message {
pub id: String,
pub container: Option<ContainerInfo>,
pub content: Vec<ContentBlock>,
pub model: Model,
pub role: MessageRole,
pub stop_reason: Option<StopReason>,
pub stop_sequence: Option<String>,
pub type: String,
pub usage: Usage,
}anthropic-client only.Expand description
A message generated by the assistant.
Fields§
§id: StringUnique object identifier.
The format and length of IDs may change over time.
container: Option<ContainerInfo>Container information for code execution tool reuse.
content: Vec<ContentBlock>Content generated by the model.
This is an array of content blocks, each of which has a type that determines
its shape.
model: ModelThe model that generated the message.
role: MessageRoleConversational role of the generated message.
This will always be “assistant”.
stop_reason: Option<StopReason>The reason that generation stopped.
This may be null in streaming responses until completion.
stop_sequence: Option<String>Which custom stop sequence was generated, if any.
This value will be a non-null string if one of your custom stop sequences was generated.
type: StringObject type, which is always “message”.
usage: UsageBilling and rate-limit usage information.
Implementations§
Source§impl Message
impl Message
Sourcepub fn new(
id: String,
content: Vec<ContentBlock>,
model: Model,
usage: Usage,
) -> Message
pub fn new( id: String, content: Vec<ContentBlock>, model: Model, usage: Usage, ) -> Message
Create a new Message with the given parameters.
Sourcepub fn with_stop_reason(self, stop_reason: StopReason) -> Message
pub fn with_stop_reason(self, stop_reason: StopReason) -> Message
Set the stop reason.
Sourcepub fn with_stop_sequence(self, stop_sequence: String) -> Message
pub fn with_stop_sequence(self, stop_sequence: String) -> Message
Set the stop sequence.