aws_sdk_comprehend/operation/classify_document/_classify_document_output.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct ClassifyDocumentOutput {
6 /// <p>The classes used by the document being analyzed. These are used for models trained in multi-class mode. Individual classes are mutually exclusive and each document is expected to have only a single class assigned to it. For example, an animal can be a dog or a cat, but not both at the same time.</p>
7 /// <p>For prompt safety classification, the response includes only two classes (SAFE_PROMPT and UNSAFE_PROMPT), along with a confidence score for each class. The value range of the score is zero to one, where one is the highest confidence.</p>
8 pub classes: ::std::option::Option<::std::vec::Vec<crate::types::DocumentClass>>,
9 /// <p>The labels used in the document being analyzed. These are used for multi-label trained models. Individual labels represent different categories that are related in some manner and are not mutually exclusive. For example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at the same time.</p>
10 pub labels: ::std::option::Option<::std::vec::Vec<crate::types::DocumentLabel>>,
11 /// <p>Extraction information about the document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
12 pub document_metadata: ::std::option::Option<crate::types::DocumentMetadata>,
13 /// <p>The document type for each page in the input document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
14 pub document_type: ::std::option::Option<::std::vec::Vec<crate::types::DocumentTypeListItem>>,
15 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
16 pub errors: ::std::option::Option<::std::vec::Vec<crate::types::ErrorsListItem>>,
17 /// <p>Warnings detected while processing the input document. The response includes a warning if there is a mismatch between the input document type and the model type associated with the endpoint that you specified. The response can also include warnings for individual pages that have a mismatch.</p>
18 /// <p>The field is empty if the system generated no warnings.</p>
19 pub warnings: ::std::option::Option<::std::vec::Vec<crate::types::WarningsListItem>>,
20 _request_id: Option<String>,
21}
22impl ClassifyDocumentOutput {
23 /// <p>The classes used by the document being analyzed. These are used for models trained in multi-class mode. Individual classes are mutually exclusive and each document is expected to have only a single class assigned to it. For example, an animal can be a dog or a cat, but not both at the same time.</p>
24 /// <p>For prompt safety classification, the response includes only two classes (SAFE_PROMPT and UNSAFE_PROMPT), along with a confidence score for each class. The value range of the score is zero to one, where one is the highest confidence.</p>
25 ///
26 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.classes.is_none()`.
27 pub fn classes(&self) -> &[crate::types::DocumentClass] {
28 self.classes.as_deref().unwrap_or_default()
29 }
30 /// <p>The labels used in the document being analyzed. These are used for multi-label trained models. Individual labels represent different categories that are related in some manner and are not mutually exclusive. For example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at the same time.</p>
31 ///
32 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.labels.is_none()`.
33 pub fn labels(&self) -> &[crate::types::DocumentLabel] {
34 self.labels.as_deref().unwrap_or_default()
35 }
36 /// <p>Extraction information about the document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
37 pub fn document_metadata(&self) -> ::std::option::Option<&crate::types::DocumentMetadata> {
38 self.document_metadata.as_ref()
39 }
40 /// <p>The document type for each page in the input document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
41 ///
42 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.document_type.is_none()`.
43 pub fn document_type(&self) -> &[crate::types::DocumentTypeListItem] {
44 self.document_type.as_deref().unwrap_or_default()
45 }
46 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
47 ///
48 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.errors.is_none()`.
49 pub fn errors(&self) -> &[crate::types::ErrorsListItem] {
50 self.errors.as_deref().unwrap_or_default()
51 }
52 /// <p>Warnings detected while processing the input document. The response includes a warning if there is a mismatch between the input document type and the model type associated with the endpoint that you specified. The response can also include warnings for individual pages that have a mismatch.</p>
53 /// <p>The field is empty if the system generated no warnings.</p>
54 ///
55 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.warnings.is_none()`.
56 pub fn warnings(&self) -> &[crate::types::WarningsListItem] {
57 self.warnings.as_deref().unwrap_or_default()
58 }
59}
60impl ::std::fmt::Debug for ClassifyDocumentOutput {
61 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
62 let mut formatter = f.debug_struct("ClassifyDocumentOutput");
63 formatter.field("classes", &"*** Sensitive Data Redacted ***");
64 formatter.field("labels", &"*** Sensitive Data Redacted ***");
65 formatter.field("document_metadata", &"*** Sensitive Data Redacted ***");
66 formatter.field("document_type", &"*** Sensitive Data Redacted ***");
67 formatter.field("errors", &"*** Sensitive Data Redacted ***");
68 formatter.field("warnings", &"*** Sensitive Data Redacted ***");
69 formatter.field("_request_id", &self._request_id);
70 formatter.finish()
71 }
72}
73impl ::aws_types::request_id::RequestId for ClassifyDocumentOutput {
74 fn request_id(&self) -> Option<&str> {
75 self._request_id.as_deref()
76 }
77}
78impl ClassifyDocumentOutput {
79 /// Creates a new builder-style object to manufacture [`ClassifyDocumentOutput`](crate::operation::classify_document::ClassifyDocumentOutput).
80 pub fn builder() -> crate::operation::classify_document::builders::ClassifyDocumentOutputBuilder {
81 crate::operation::classify_document::builders::ClassifyDocumentOutputBuilder::default()
82 }
83}
84
85/// A builder for [`ClassifyDocumentOutput`](crate::operation::classify_document::ClassifyDocumentOutput).
86#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
87#[non_exhaustive]
88pub struct ClassifyDocumentOutputBuilder {
89 pub(crate) classes: ::std::option::Option<::std::vec::Vec<crate::types::DocumentClass>>,
90 pub(crate) labels: ::std::option::Option<::std::vec::Vec<crate::types::DocumentLabel>>,
91 pub(crate) document_metadata: ::std::option::Option<crate::types::DocumentMetadata>,
92 pub(crate) document_type: ::std::option::Option<::std::vec::Vec<crate::types::DocumentTypeListItem>>,
93 pub(crate) errors: ::std::option::Option<::std::vec::Vec<crate::types::ErrorsListItem>>,
94 pub(crate) warnings: ::std::option::Option<::std::vec::Vec<crate::types::WarningsListItem>>,
95 _request_id: Option<String>,
96}
97impl ClassifyDocumentOutputBuilder {
98 /// Appends an item to `classes`.
99 ///
100 /// To override the contents of this collection use [`set_classes`](Self::set_classes).
101 ///
102 /// <p>The classes used by the document being analyzed. These are used for models trained in multi-class mode. Individual classes are mutually exclusive and each document is expected to have only a single class assigned to it. For example, an animal can be a dog or a cat, but not both at the same time.</p>
103 /// <p>For prompt safety classification, the response includes only two classes (SAFE_PROMPT and UNSAFE_PROMPT), along with a confidence score for each class. The value range of the score is zero to one, where one is the highest confidence.</p>
104 pub fn classes(mut self, input: crate::types::DocumentClass) -> Self {
105 let mut v = self.classes.unwrap_or_default();
106 v.push(input);
107 self.classes = ::std::option::Option::Some(v);
108 self
109 }
110 /// <p>The classes used by the document being analyzed. These are used for models trained in multi-class mode. Individual classes are mutually exclusive and each document is expected to have only a single class assigned to it. For example, an animal can be a dog or a cat, but not both at the same time.</p>
111 /// <p>For prompt safety classification, the response includes only two classes (SAFE_PROMPT and UNSAFE_PROMPT), along with a confidence score for each class. The value range of the score is zero to one, where one is the highest confidence.</p>
112 pub fn set_classes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DocumentClass>>) -> Self {
113 self.classes = input;
114 self
115 }
116 /// <p>The classes used by the document being analyzed. These are used for models trained in multi-class mode. Individual classes are mutually exclusive and each document is expected to have only a single class assigned to it. For example, an animal can be a dog or a cat, but not both at the same time.</p>
117 /// <p>For prompt safety classification, the response includes only two classes (SAFE_PROMPT and UNSAFE_PROMPT), along with a confidence score for each class. The value range of the score is zero to one, where one is the highest confidence.</p>
118 pub fn get_classes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DocumentClass>> {
119 &self.classes
120 }
121 /// Appends an item to `labels`.
122 ///
123 /// To override the contents of this collection use [`set_labels`](Self::set_labels).
124 ///
125 /// <p>The labels used in the document being analyzed. These are used for multi-label trained models. Individual labels represent different categories that are related in some manner and are not mutually exclusive. For example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at the same time.</p>
126 pub fn labels(mut self, input: crate::types::DocumentLabel) -> Self {
127 let mut v = self.labels.unwrap_or_default();
128 v.push(input);
129 self.labels = ::std::option::Option::Some(v);
130 self
131 }
132 /// <p>The labels used in the document being analyzed. These are used for multi-label trained models. Individual labels represent different categories that are related in some manner and are not mutually exclusive. For example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at the same time.</p>
133 pub fn set_labels(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DocumentLabel>>) -> Self {
134 self.labels = input;
135 self
136 }
137 /// <p>The labels used in the document being analyzed. These are used for multi-label trained models. Individual labels represent different categories that are related in some manner and are not mutually exclusive. For example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at the same time.</p>
138 pub fn get_labels(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DocumentLabel>> {
139 &self.labels
140 }
141 /// <p>Extraction information about the document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
142 pub fn document_metadata(mut self, input: crate::types::DocumentMetadata) -> Self {
143 self.document_metadata = ::std::option::Option::Some(input);
144 self
145 }
146 /// <p>Extraction information about the document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
147 pub fn set_document_metadata(mut self, input: ::std::option::Option<crate::types::DocumentMetadata>) -> Self {
148 self.document_metadata = input;
149 self
150 }
151 /// <p>Extraction information about the document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
152 pub fn get_document_metadata(&self) -> &::std::option::Option<crate::types::DocumentMetadata> {
153 &self.document_metadata
154 }
155 /// Appends an item to `document_type`.
156 ///
157 /// To override the contents of this collection use [`set_document_type`](Self::set_document_type).
158 ///
159 /// <p>The document type for each page in the input document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
160 pub fn document_type(mut self, input: crate::types::DocumentTypeListItem) -> Self {
161 let mut v = self.document_type.unwrap_or_default();
162 v.push(input);
163 self.document_type = ::std::option::Option::Some(v);
164 self
165 }
166 /// <p>The document type for each page in the input document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
167 pub fn set_document_type(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DocumentTypeListItem>>) -> Self {
168 self.document_type = input;
169 self
170 }
171 /// <p>The document type for each page in the input document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
172 pub fn get_document_type(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DocumentTypeListItem>> {
173 &self.document_type
174 }
175 /// Appends an item to `errors`.
176 ///
177 /// To override the contents of this collection use [`set_errors`](Self::set_errors).
178 ///
179 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
180 pub fn errors(mut self, input: crate::types::ErrorsListItem) -> Self {
181 let mut v = self.errors.unwrap_or_default();
182 v.push(input);
183 self.errors = ::std::option::Option::Some(v);
184 self
185 }
186 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
187 pub fn set_errors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ErrorsListItem>>) -> Self {
188 self.errors = input;
189 self
190 }
191 /// <p>Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors.</p>
192 pub fn get_errors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ErrorsListItem>> {
193 &self.errors
194 }
195 /// Appends an item to `warnings`.
196 ///
197 /// To override the contents of this collection use [`set_warnings`](Self::set_warnings).
198 ///
199 /// <p>Warnings detected while processing the input document. The response includes a warning if there is a mismatch between the input document type and the model type associated with the endpoint that you specified. The response can also include warnings for individual pages that have a mismatch.</p>
200 /// <p>The field is empty if the system generated no warnings.</p>
201 pub fn warnings(mut self, input: crate::types::WarningsListItem) -> Self {
202 let mut v = self.warnings.unwrap_or_default();
203 v.push(input);
204 self.warnings = ::std::option::Option::Some(v);
205 self
206 }
207 /// <p>Warnings detected while processing the input document. The response includes a warning if there is a mismatch between the input document type and the model type associated with the endpoint that you specified. The response can also include warnings for individual pages that have a mismatch.</p>
208 /// <p>The field is empty if the system generated no warnings.</p>
209 pub fn set_warnings(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::WarningsListItem>>) -> Self {
210 self.warnings = input;
211 self
212 }
213 /// <p>Warnings detected while processing the input document. The response includes a warning if there is a mismatch between the input document type and the model type associated with the endpoint that you specified. The response can also include warnings for individual pages that have a mismatch.</p>
214 /// <p>The field is empty if the system generated no warnings.</p>
215 pub fn get_warnings(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::WarningsListItem>> {
216 &self.warnings
217 }
218 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
219 self._request_id = Some(request_id.into());
220 self
221 }
222
223 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
224 self._request_id = request_id;
225 self
226 }
227 /// Consumes the builder and constructs a [`ClassifyDocumentOutput`](crate::operation::classify_document::ClassifyDocumentOutput).
228 pub fn build(self) -> crate::operation::classify_document::ClassifyDocumentOutput {
229 crate::operation::classify_document::ClassifyDocumentOutput {
230 classes: self.classes,
231 labels: self.labels,
232 document_metadata: self.document_metadata,
233 document_type: self.document_type,
234 errors: self.errors,
235 warnings: self.warnings,
236 _request_id: self._request_id,
237 }
238 }
239}
240impl ::std::fmt::Debug for ClassifyDocumentOutputBuilder {
241 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
242 let mut formatter = f.debug_struct("ClassifyDocumentOutputBuilder");
243 formatter.field("classes", &"*** Sensitive Data Redacted ***");
244 formatter.field("labels", &"*** Sensitive Data Redacted ***");
245 formatter.field("document_metadata", &"*** Sensitive Data Redacted ***");
246 formatter.field("document_type", &"*** Sensitive Data Redacted ***");
247 formatter.field("errors", &"*** Sensitive Data Redacted ***");
248 formatter.field("warnings", &"*** Sensitive Data Redacted ***");
249 formatter.field("_request_id", &self._request_id);
250 formatter.finish()
251 }
252}