1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A single conversation turn.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Message {
/// <p>The role of the participant that produced this turn. Valid values:</p>
/// <ul>
/// <li>
/// <p><code>USER</code> - The user asked or said this turn.</p></li>
/// <li>
/// <p><code>ASSISTANT</code> - The assistant answered in this turn.</p></li>
/// </ul>
pub role: crate::types::MessageRole,
/// <p>The turn's text content.</p>
pub content: ::std::string::String,
}
impl Message {
/// <p>The role of the participant that produced this turn. Valid values:</p>
/// <ul>
/// <li>
/// <p><code>USER</code> - The user asked or said this turn.</p></li>
/// <li>
/// <p><code>ASSISTANT</code> - The assistant answered in this turn.</p></li>
/// </ul>
pub fn role(&self) -> &crate::types::MessageRole {
&self.role
}
/// <p>The turn's text content.</p>
pub fn content(&self) -> &str {
use std::ops::Deref;
self.content.deref()
}
}
impl ::std::fmt::Debug for Message {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("Message");
formatter.field("role", &self.role);
formatter.field("content", &"*** Sensitive Data Redacted ***");
formatter.finish()
}
}
impl Message {
/// Creates a new builder-style object to manufacture [`Message`](crate::types::Message).
pub fn builder() -> crate::types::builders::MessageBuilder {
crate::types::builders::MessageBuilder::default()
}
}
/// A builder for [`Message`](crate::types::Message).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct MessageBuilder {
pub(crate) role: ::std::option::Option<crate::types::MessageRole>,
pub(crate) content: ::std::option::Option<::std::string::String>,
}
impl MessageBuilder {
/// <p>The role of the participant that produced this turn. Valid values:</p>
/// <ul>
/// <li>
/// <p><code>USER</code> - The user asked or said this turn.</p></li>
/// <li>
/// <p><code>ASSISTANT</code> - The assistant answered in this turn.</p></li>
/// </ul>
/// This field is required.
pub fn role(mut self, input: crate::types::MessageRole) -> Self {
self.role = ::std::option::Option::Some(input);
self
}
/// <p>The role of the participant that produced this turn. Valid values:</p>
/// <ul>
/// <li>
/// <p><code>USER</code> - The user asked or said this turn.</p></li>
/// <li>
/// <p><code>ASSISTANT</code> - The assistant answered in this turn.</p></li>
/// </ul>
pub fn set_role(mut self, input: ::std::option::Option<crate::types::MessageRole>) -> Self {
self.role = input;
self
}
/// <p>The role of the participant that produced this turn. Valid values:</p>
/// <ul>
/// <li>
/// <p><code>USER</code> - The user asked or said this turn.</p></li>
/// <li>
/// <p><code>ASSISTANT</code> - The assistant answered in this turn.</p></li>
/// </ul>
pub fn get_role(&self) -> &::std::option::Option<crate::types::MessageRole> {
&self.role
}
/// <p>The turn's text content.</p>
/// This field is required.
pub fn content(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.content = ::std::option::Option::Some(input.into());
self
}
/// <p>The turn's text content.</p>
pub fn set_content(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.content = input;
self
}
/// <p>The turn's text content.</p>
pub fn get_content(&self) -> &::std::option::Option<::std::string::String> {
&self.content
}
/// Consumes the builder and constructs a [`Message`](crate::types::Message).
/// This method will fail if any of the following fields are not set:
/// - [`role`](crate::types::builders::MessageBuilder::role)
/// - [`content`](crate::types::builders::MessageBuilder::content)
pub fn build(self) -> ::std::result::Result<crate::types::Message, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Message {
role: self.role.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"role",
"role was not specified but it is required when building Message",
)
})?,
content: self.content.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"content",
"content was not specified but it is required when building Message",
)
})?,
})
}
}
impl ::std::fmt::Debug for MessageBuilder {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("MessageBuilder");
formatter.field("role", &self.role);
formatter.field("content", &"*** Sensitive Data Redacted ***");
formatter.finish()
}
}