aws_sdk_comprehend/client/classify_document.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3 /// Constructs a fluent builder for the [`ClassifyDocument`](crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder) operation.
4 ///
5 /// - The fluent builder is configurable:
6 /// - [`text(impl Into<String>)`](crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder::text) / [`set_text(Option<String>)`](crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder::set_text):<br>required: **false**<br><p>The document text to be analyzed. If you enter text using this parameter, do not use the <code>Bytes</code> parameter.</p><br>
7 /// - [`endpoint_arn(impl Into<String>)`](crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder::endpoint_arn) / [`set_endpoint_arn(Option<String>)`](crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder::set_endpoint_arn):<br>required: **true**<br><p>The Amazon Resource Number (ARN) of the endpoint.</p> <p>For prompt safety classification, Amazon Comprehend provides the endpoint ARN. For more information about prompt safety classifiers, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/trust-safety.html#prompt-classification">Prompt safety classification</a> in the <i>Amazon Comprehend Developer Guide</i></p> <p>For custom classification, you create an endpoint for your custom model. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/using-endpoints.html">Using Amazon Comprehend endpoints</a>.</p><br>
8 /// - [`bytes(Blob)`](crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder::bytes) / [`set_bytes(Option<Blob>)`](crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder::set_bytes):<br>required: **false**<br><p>Use the <code>Bytes</code> parameter to input a text, PDF, Word or image file.</p> <p>When you classify a document using a custom model, you can also use the <code>Bytes</code> parameter to input an Amazon Textract <code>DetectDocumentText</code> or <code>AnalyzeDocument</code> output file.</p> <p>To classify a document using the prompt safety classifier, use the <code>Text</code> parameter for input.</p> <p>Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to classify documents, the SDK may encode the document file bytes for you.</p> <p>The maximum length of this field depends on the input document type. For details, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/idp-inputs-sync.html"> Inputs for real-time custom analysis</a> in the Comprehend Developer Guide.</p> <p>If you use the <code>Bytes</code> parameter, do not use the <code>Text</code> parameter.</p><br>
9 /// - [`document_reader_config(DocumentReaderConfig)`](crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder::document_reader_config) / [`set_document_reader_config(Option<DocumentReaderConfig>)`](crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder::set_document_reader_config):<br>required: **false**<br><p>Provides configuration parameters to override the default actions for extracting text from PDF documents and image files.</p><br>
10 /// - On success, responds with [`ClassifyDocumentOutput`](crate::operation::classify_document::ClassifyDocumentOutput) with field(s):
11 /// - [`classes(Option<Vec::<DocumentClass>>)`](crate::operation::classify_document::ClassifyDocumentOutput::classes): <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> <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>
12 /// - [`labels(Option<Vec::<DocumentLabel>>)`](crate::operation::classify_document::ClassifyDocumentOutput::labels): <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>
13 /// - [`document_metadata(Option<DocumentMetadata>)`](crate::operation::classify_document::ClassifyDocumentOutput::document_metadata): <p>Extraction information about the document. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
14 /// - [`document_type(Option<Vec::<DocumentTypeListItem>>)`](crate::operation::classify_document::ClassifyDocumentOutput::document_type): <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>
15 /// - [`errors(Option<Vec::<ErrorsListItem>>)`](crate::operation::classify_document::ClassifyDocumentOutput::errors): <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 /// - [`warnings(Option<Vec::<WarningsListItem>>)`](crate::operation::classify_document::ClassifyDocumentOutput::warnings): <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> <p>The field is empty if the system generated no warnings.</p>
17 /// - On failure, responds with [`SdkError<ClassifyDocumentError>`](crate::operation::classify_document::ClassifyDocumentError)
18 pub fn classify_document(&self) -> crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder {
19 crate::operation::classify_document::builders::ClassifyDocumentFluentBuilder::new(self.handle.clone())
20 }
21}