aws_sdk_bedrockagentruntime/operation/optimize_prompt/
builders.rs1pub use crate::operation::optimize_prompt::_optimize_prompt_output::OptimizePromptOutputBuilder;
3
4pub use crate::operation::optimize_prompt::_optimize_prompt_input::OptimizePromptInputBuilder;
5
6impl crate::operation::optimize_prompt::builders::OptimizePromptInputBuilder {
7 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::optimize_prompt::OptimizePromptOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::optimize_prompt::OptimizePromptError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.optimize_prompt();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct OptimizePromptFluentBuilder {
28 handle: ::std::sync::Arc<crate::client::Handle>,
29 inner: crate::operation::optimize_prompt::builders::OptimizePromptInputBuilder,
30 config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33 crate::client::customize::internal::CustomizableSend<
34 crate::operation::optimize_prompt::OptimizePromptOutput,
35 crate::operation::optimize_prompt::OptimizePromptError,
36 > for OptimizePromptFluentBuilder
37{
38 fn send(
39 self,
40 config_override: crate::config::Builder,
41 ) -> crate::client::customize::internal::BoxFuture<
42 crate::client::customize::internal::SendResult<
43 crate::operation::optimize_prompt::OptimizePromptOutput,
44 crate::operation::optimize_prompt::OptimizePromptError,
45 >,
46 > {
47 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48 }
49}
50impl OptimizePromptFluentBuilder {
51 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53 Self {
54 handle,
55 inner: ::std::default::Default::default(),
56 config_override: ::std::option::Option::None,
57 }
58 }
59 pub fn as_input(&self) -> &crate::operation::optimize_prompt::builders::OptimizePromptInputBuilder {
61 &self.inner
62 }
63 pub async fn send(
72 self,
73 ) -> ::std::result::Result<
74 crate::operation::optimize_prompt::OptimizePromptOutput,
75 ::aws_smithy_runtime_api::client::result::SdkError<
76 crate::operation::optimize_prompt::OptimizePromptError,
77 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78 >,
79 > {
80 let input = self
81 .inner
82 .build()
83 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84 let runtime_plugins = crate::operation::optimize_prompt::OptimizePrompt::operation_runtime_plugins(
85 self.handle.runtime_plugins.clone(),
86 &self.handle.conf,
87 self.config_override,
88 );
89 let mut output = crate::operation::optimize_prompt::OptimizePrompt::orchestrate(&runtime_plugins, input).await?;
90
91 fn response_error(
100 err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
101 ) -> ::aws_smithy_runtime_api::client::result::SdkError<
102 crate::operation::optimize_prompt::OptimizePromptError,
103 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
104 > {
105 ::aws_smithy_runtime_api::client::result::SdkError::response_error(
106 err,
107 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
108 ::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
109 ::aws_smithy_types::body::SdkBody::empty(),
110 ),
111 )
112 }
113
114 let message = output.optimized_prompt.try_recv_initial_response().await.map_err(response_error)?;
115
116 match message {
117 ::std::option::Option::Some(_message) => ::std::result::Result::Ok(output),
118 ::std::option::Option::None => ::std::result::Result::Ok(output),
119 }
120 }
121
122 pub fn customize(
124 self,
125 ) -> crate::client::customize::CustomizableOperation<
126 crate::operation::optimize_prompt::OptimizePromptOutput,
127 crate::operation::optimize_prompt::OptimizePromptError,
128 Self,
129 > {
130 crate::client::customize::CustomizableOperation::new(self)
131 }
132 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
133 self.set_config_override(::std::option::Option::Some(config_override.into()));
134 self
135 }
136
137 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
138 self.config_override = config_override;
139 self
140 }
141 pub fn input(mut self, input: crate::types::InputPrompt) -> Self {
143 self.inner = self.inner.input(input);
144 self
145 }
146 pub fn set_input(mut self, input: ::std::option::Option<crate::types::InputPrompt>) -> Self {
148 self.inner = self.inner.set_input(input);
149 self
150 }
151 pub fn get_input(&self) -> &::std::option::Option<crate::types::InputPrompt> {
153 self.inner.get_input()
154 }
155 pub fn target_model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157 self.inner = self.inner.target_model_id(input.into());
158 self
159 }
160 pub fn set_target_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162 self.inner = self.inner.set_target_model_id(input);
163 self
164 }
165 pub fn get_target_model_id(&self) -> &::std::option::Option<::std::string::String> {
167 self.inner.get_target_model_id()
168 }
169}