aws_sdk_transcribe/operation/create_language_model/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_language_model::_create_language_model_output::CreateLanguageModelOutputBuilder;
3
4pub use crate::operation::create_language_model::_create_language_model_input::CreateLanguageModelInputBuilder;
5
6impl crate::operation::create_language_model::builders::CreateLanguageModelInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_language_model::CreateLanguageModelOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_language_model::CreateLanguageModelError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_language_model();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateLanguageModel`.
24///
25/// <p>Creates a new custom language model.</p>
26/// <p>When creating a new custom language model, you must specify:</p>
27/// <ul>
28/// <li>
29/// <p>If you want a Wideband (audio sample rates over 16,000 Hz) or Narrowband (audio sample rates under 16,000 Hz) base model</p></li>
30/// <li>
31/// <p>The location of your training and tuning files (this must be an Amazon S3 URI)</p></li>
32/// <li>
33/// <p>The language of your model</p></li>
34/// <li>
35/// <p>A unique name for your model</p></li>
36/// </ul>
37#[derive(::std::clone::Clone, ::std::fmt::Debug)]
38pub struct CreateLanguageModelFluentBuilder {
39    handle: ::std::sync::Arc<crate::client::Handle>,
40    inner: crate::operation::create_language_model::builders::CreateLanguageModelInputBuilder,
41    config_override: ::std::option::Option<crate::config::Builder>,
42}
43impl
44    crate::client::customize::internal::CustomizableSend<
45        crate::operation::create_language_model::CreateLanguageModelOutput,
46        crate::operation::create_language_model::CreateLanguageModelError,
47    > for CreateLanguageModelFluentBuilder
48{
49    fn send(
50        self,
51        config_override: crate::config::Builder,
52    ) -> crate::client::customize::internal::BoxFuture<
53        crate::client::customize::internal::SendResult<
54            crate::operation::create_language_model::CreateLanguageModelOutput,
55            crate::operation::create_language_model::CreateLanguageModelError,
56        >,
57    > {
58        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
59    }
60}
61impl CreateLanguageModelFluentBuilder {
62    /// Creates a new `CreateLanguageModelFluentBuilder`.
63    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
64        Self {
65            handle,
66            inner: ::std::default::Default::default(),
67            config_override: ::std::option::Option::None,
68        }
69    }
70    /// Access the CreateLanguageModel as a reference.
71    pub fn as_input(&self) -> &crate::operation::create_language_model::builders::CreateLanguageModelInputBuilder {
72        &self.inner
73    }
74    /// Sends the request and returns the response.
75    ///
76    /// If an error occurs, an `SdkError` will be returned with additional details that
77    /// can be matched against.
78    ///
79    /// By default, any retryable failures will be retried twice. Retry behavior
80    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
81    /// set when configuring the client.
82    pub async fn send(
83        self,
84    ) -> ::std::result::Result<
85        crate::operation::create_language_model::CreateLanguageModelOutput,
86        ::aws_smithy_runtime_api::client::result::SdkError<
87            crate::operation::create_language_model::CreateLanguageModelError,
88            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
89        >,
90    > {
91        let input = self
92            .inner
93            .build()
94            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
95        let runtime_plugins = crate::operation::create_language_model::CreateLanguageModel::operation_runtime_plugins(
96            self.handle.runtime_plugins.clone(),
97            &self.handle.conf,
98            self.config_override,
99        );
100        crate::operation::create_language_model::CreateLanguageModel::orchestrate(&runtime_plugins, input).await
101    }
102
103    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
104    pub fn customize(
105        self,
106    ) -> crate::client::customize::CustomizableOperation<
107        crate::operation::create_language_model::CreateLanguageModelOutput,
108        crate::operation::create_language_model::CreateLanguageModelError,
109        Self,
110    > {
111        crate::client::customize::CustomizableOperation::new(self)
112    }
113    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
114        self.set_config_override(::std::option::Option::Some(config_override.into()));
115        self
116    }
117
118    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
119        self.config_override = config_override;
120        self
121    }
122    /// <p>The language code that represents the language of your model. Each custom language model must contain terms in only one language, and the language you select for your custom language model must match the language of your training and tuning data.</p>
123    /// <p>For a list of supported languages and their associated language codes, refer to the <a href="https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html">Supported languages</a> table. Note that US English (<code>en-US</code>) is the only language supported with Amazon Transcribe Medical.</p>
124    /// <p>A custom language model can only be used to transcribe files in the same language as the model. For example, if you create a custom language model using US English (<code>en-US</code>), you can only apply this model to files that contain English audio.</p>
125    pub fn language_code(mut self, input: crate::types::ClmLanguageCode) -> Self {
126        self.inner = self.inner.language_code(input);
127        self
128    }
129    /// <p>The language code that represents the language of your model. Each custom language model must contain terms in only one language, and the language you select for your custom language model must match the language of your training and tuning data.</p>
130    /// <p>For a list of supported languages and their associated language codes, refer to the <a href="https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html">Supported languages</a> table. Note that US English (<code>en-US</code>) is the only language supported with Amazon Transcribe Medical.</p>
131    /// <p>A custom language model can only be used to transcribe files in the same language as the model. For example, if you create a custom language model using US English (<code>en-US</code>), you can only apply this model to files that contain English audio.</p>
132    pub fn set_language_code(mut self, input: ::std::option::Option<crate::types::ClmLanguageCode>) -> Self {
133        self.inner = self.inner.set_language_code(input);
134        self
135    }
136    /// <p>The language code that represents the language of your model. Each custom language model must contain terms in only one language, and the language you select for your custom language model must match the language of your training and tuning data.</p>
137    /// <p>For a list of supported languages and their associated language codes, refer to the <a href="https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html">Supported languages</a> table. Note that US English (<code>en-US</code>) is the only language supported with Amazon Transcribe Medical.</p>
138    /// <p>A custom language model can only be used to transcribe files in the same language as the model. For example, if you create a custom language model using US English (<code>en-US</code>), you can only apply this model to files that contain English audio.</p>
139    pub fn get_language_code(&self) -> &::std::option::Option<crate::types::ClmLanguageCode> {
140        self.inner.get_language_code()
141    }
142    /// <p>The Amazon Transcribe standard language model, or base model, used to create your custom language model. Amazon Transcribe offers two options for base models: Wideband and Narrowband.</p>
143    /// <p>If the audio you want to transcribe has a sample rate of 16,000 Hz or greater, choose <code>WideBand</code>. To transcribe audio with a sample rate less than 16,000 Hz, choose <code>NarrowBand</code>.</p>
144    pub fn base_model_name(mut self, input: crate::types::BaseModelName) -> Self {
145        self.inner = self.inner.base_model_name(input);
146        self
147    }
148    /// <p>The Amazon Transcribe standard language model, or base model, used to create your custom language model. Amazon Transcribe offers two options for base models: Wideband and Narrowband.</p>
149    /// <p>If the audio you want to transcribe has a sample rate of 16,000 Hz or greater, choose <code>WideBand</code>. To transcribe audio with a sample rate less than 16,000 Hz, choose <code>NarrowBand</code>.</p>
150    pub fn set_base_model_name(mut self, input: ::std::option::Option<crate::types::BaseModelName>) -> Self {
151        self.inner = self.inner.set_base_model_name(input);
152        self
153    }
154    /// <p>The Amazon Transcribe standard language model, or base model, used to create your custom language model. Amazon Transcribe offers two options for base models: Wideband and Narrowband.</p>
155    /// <p>If the audio you want to transcribe has a sample rate of 16,000 Hz or greater, choose <code>WideBand</code>. To transcribe audio with a sample rate less than 16,000 Hz, choose <code>NarrowBand</code>.</p>
156    pub fn get_base_model_name(&self) -> &::std::option::Option<crate::types::BaseModelName> {
157        self.inner.get_base_model_name()
158    }
159    /// <p>A unique name, chosen by you, for your custom language model.</p>
160    /// <p>This name is case sensitive, cannot contain spaces, and must be unique within an Amazon Web Services account. If you try to create a new custom language model with the same name as an existing custom language model, you get a <code>ConflictException</code> error.</p>
161    pub fn model_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162        self.inner = self.inner.model_name(input.into());
163        self
164    }
165    /// <p>A unique name, chosen by you, for your custom language model.</p>
166    /// <p>This name is case sensitive, cannot contain spaces, and must be unique within an Amazon Web Services account. If you try to create a new custom language model with the same name as an existing custom language model, you get a <code>ConflictException</code> error.</p>
167    pub fn set_model_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.inner = self.inner.set_model_name(input);
169        self
170    }
171    /// <p>A unique name, chosen by you, for your custom language model.</p>
172    /// <p>This name is case sensitive, cannot contain spaces, and must be unique within an Amazon Web Services account. If you try to create a new custom language model with the same name as an existing custom language model, you get a <code>ConflictException</code> error.</p>
173    pub fn get_model_name(&self) -> &::std::option::Option<::std::string::String> {
174        self.inner.get_model_name()
175    }
176    /// <p>Contains the Amazon S3 location of the training data you want to use to create a new custom language model, and permissions to access this location.</p>
177    /// <p>When using <code>InputDataConfig</code>, you must include these sub-parameters: <code>S3Uri</code>, which is the Amazon S3 location of your training data, and <code>DataAccessRoleArn</code>, which is the Amazon Resource Name (ARN) of the role that has permission to access your specified Amazon S3 location. You can optionally include <code>TuningDataS3Uri</code>, which is the Amazon S3 location of your tuning data. If you specify different Amazon S3 locations for training and tuning data, the ARN you use must have permissions to access both locations.</p>
178    pub fn input_data_config(mut self, input: crate::types::InputDataConfig) -> Self {
179        self.inner = self.inner.input_data_config(input);
180        self
181    }
182    /// <p>Contains the Amazon S3 location of the training data you want to use to create a new custom language model, and permissions to access this location.</p>
183    /// <p>When using <code>InputDataConfig</code>, you must include these sub-parameters: <code>S3Uri</code>, which is the Amazon S3 location of your training data, and <code>DataAccessRoleArn</code>, which is the Amazon Resource Name (ARN) of the role that has permission to access your specified Amazon S3 location. You can optionally include <code>TuningDataS3Uri</code>, which is the Amazon S3 location of your tuning data. If you specify different Amazon S3 locations for training and tuning data, the ARN you use must have permissions to access both locations.</p>
184    pub fn set_input_data_config(mut self, input: ::std::option::Option<crate::types::InputDataConfig>) -> Self {
185        self.inner = self.inner.set_input_data_config(input);
186        self
187    }
188    /// <p>Contains the Amazon S3 location of the training data you want to use to create a new custom language model, and permissions to access this location.</p>
189    /// <p>When using <code>InputDataConfig</code>, you must include these sub-parameters: <code>S3Uri</code>, which is the Amazon S3 location of your training data, and <code>DataAccessRoleArn</code>, which is the Amazon Resource Name (ARN) of the role that has permission to access your specified Amazon S3 location. You can optionally include <code>TuningDataS3Uri</code>, which is the Amazon S3 location of your tuning data. If you specify different Amazon S3 locations for training and tuning data, the ARN you use must have permissions to access both locations.</p>
190    pub fn get_input_data_config(&self) -> &::std::option::Option<crate::types::InputDataConfig> {
191        self.inner.get_input_data_config()
192    }
193    ///
194    /// Appends an item to `Tags`.
195    ///
196    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
197    ///
198    /// <p>Adds one or more custom tags, each in the form of a key:value pair, to a new custom language model at the time you create this new model.</p>
199    /// <p>To learn more about using tags with Amazon Transcribe, refer to <a href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging resources</a>.</p>
200    pub fn tags(mut self, input: crate::types::Tag) -> Self {
201        self.inner = self.inner.tags(input);
202        self
203    }
204    /// <p>Adds one or more custom tags, each in the form of a key:value pair, to a new custom language model at the time you create this new model.</p>
205    /// <p>To learn more about using tags with Amazon Transcribe, refer to <a href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging resources</a>.</p>
206    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
207        self.inner = self.inner.set_tags(input);
208        self
209    }
210    /// <p>Adds one or more custom tags, each in the form of a key:value pair, to a new custom language model at the time you create this new model.</p>
211    /// <p>To learn more about using tags with Amazon Transcribe, refer to <a href="https://docs.aws.amazon.com/transcribe/latest/dg/tagging.html">Tagging resources</a>.</p>
212    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
213        self.inner.get_tags()
214    }
215}