aws_sdk_bedrockruntime/operation/converse_stream/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::converse_stream::_converse_stream_output::ConverseStreamOutputBuilder;
3
4pub use crate::operation::converse_stream::_converse_stream_input::ConverseStreamInputBuilder;
5
6impl crate::operation::converse_stream::builders::ConverseStreamInputBuilder {
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::converse_stream::ConverseStreamOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::converse_stream::ConverseStreamError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.converse_stream();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ConverseStream`.
24///
25/// <p>Sends messages to the specified Amazon Bedrock model and returns the response in a stream. <code>ConverseStream</code> provides a consistent API that works with all Amazon Bedrock models that support messages. This allows you to write code once and use it with different models. Should a model have unique inference parameters, you can also pass those unique parameters to the model.</p>
26/// <p>To find out if a model supports streaming, call <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetFoundationModel.html">GetFoundationModel</a> and check the <code>responseStreamingSupported</code> field in the response.</p><note>
27/// <p>The CLI doesn't support streaming operations in Amazon Bedrock, including <code>ConverseStream</code>.</p>
28/// </note>
29/// <p>Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.</p>
30/// <p>You can submit a prompt by including it in the <code>messages</code> field, specifying the <code>modelId</code> of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.</p>
31/// <p>You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the <code>promptVariables</code> field. You can append more messages to the prompt by using the <code>messages</code> field. If you use a prompt from Prompt management, you can't include the following fields in the request: <code>additionalModelRequestFields</code>, <code>inferenceConfig</code>, <code>system</code>, or <code>toolConfig</code>. Instead, these fields must be defined through Prompt management. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-use.html">Use a prompt from Prompt management</a>.</p>
32/// <p>For information about the Converse API, see <i>Use the Converse API</i> in the <i>Amazon Bedrock User Guide</i>. To use a guardrail, see <i>Use a guardrail with the Converse API</i> in the <i>Amazon Bedrock User Guide</i>. To use a tool with a model, see <i>Tool use (Function calling)</i> in the <i>Amazon Bedrock User Guide</i></p>
33/// <p>For example code, see <i>Conversation streaming example</i> in the <i>Amazon Bedrock User Guide</i>.</p>
34/// <p>This operation requires permission for the <code>bedrock:InvokeModelWithResponseStream</code> action.</p><important>
35/// <p>To deny all inference access to resources that you specify in the modelId field, you need to deny access to the <code>bedrock:InvokeModel</code> and <code>bedrock:InvokeModelWithResponseStream</code> actions. Doing this also denies access to the resource through the base inference actions (<a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html">InvokeModel</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModelWithResponseStream.html">InvokeModelWithResponseStream</a>). For more information see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-deny-inference">Deny access for inference on specific models</a>.</p>
36/// </important>
37/// <p>For troubleshooting some of the common errors you might encounter when using the <code>ConverseStream</code> API, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html">Troubleshooting Amazon Bedrock API Error Codes</a> in the Amazon Bedrock User Guide</p>
38#[derive(::std::clone::Clone, ::std::fmt::Debug)]
39pub struct ConverseStreamFluentBuilder {
40 handle: ::std::sync::Arc<crate::client::Handle>,
41 inner: crate::operation::converse_stream::builders::ConverseStreamInputBuilder,
42 config_override: ::std::option::Option<crate::config::Builder>,
43}
44impl
45 crate::client::customize::internal::CustomizableSend<
46 crate::operation::converse_stream::ConverseStreamOutput,
47 crate::operation::converse_stream::ConverseStreamError,
48 > for ConverseStreamFluentBuilder
49{
50 fn send(
51 self,
52 config_override: crate::config::Builder,
53 ) -> crate::client::customize::internal::BoxFuture<
54 crate::client::customize::internal::SendResult<
55 crate::operation::converse_stream::ConverseStreamOutput,
56 crate::operation::converse_stream::ConverseStreamError,
57 >,
58 > {
59 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
60 }
61}
62impl ConverseStreamFluentBuilder {
63 /// Creates a new `ConverseStreamFluentBuilder`.
64 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
65 Self {
66 handle,
67 inner: ::std::default::Default::default(),
68 config_override: ::std::option::Option::None,
69 }
70 }
71 /// Access the ConverseStream as a reference.
72 pub fn as_input(&self) -> &crate::operation::converse_stream::builders::ConverseStreamInputBuilder {
73 &self.inner
74 }
75 /// Sends the request and returns the response.
76 ///
77 /// If an error occurs, an `SdkError` will be returned with additional details that
78 /// can be matched against.
79 ///
80 /// By default, any retryable failures will be retried twice. Retry behavior
81 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
82 /// set when configuring the client.
83 pub async fn send(
84 self,
85 ) -> ::std::result::Result<
86 crate::operation::converse_stream::ConverseStreamOutput,
87 ::aws_smithy_runtime_api::client::result::SdkError<
88 crate::operation::converse_stream::ConverseStreamError,
89 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
90 >,
91 > {
92 let input = self
93 .inner
94 .build()
95 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
96 let runtime_plugins = crate::operation::converse_stream::ConverseStream::operation_runtime_plugins(
97 self.handle.runtime_plugins.clone(),
98 &self.handle.conf,
99 self.config_override,
100 );
101 let mut output = crate::operation::converse_stream::ConverseStream::orchestrate(&runtime_plugins, input).await?;
102
103 // Converts any error encountered beyond this point into an `SdkError` response error
104 // with an `HttpResponse`. However, since we have already exited the `orchestrate`
105 // function, the original `HttpResponse` is no longer available and cannot be restored.
106 // This means that header information from the original response has been lost.
107 //
108 // Note that the response body would have been consumed by the deserializer
109 // regardless, even if the initial message was hypothetically processed during
110 // the orchestrator's deserialization phase but later resulted in an error.
111 fn response_error(
112 err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
113 ) -> ::aws_smithy_runtime_api::client::result::SdkError<
114 crate::operation::converse_stream::ConverseStreamError,
115 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
116 > {
117 ::aws_smithy_runtime_api::client::result::SdkError::response_error(
118 err,
119 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
120 ::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
121 ::aws_smithy_types::body::SdkBody::empty(),
122 ),
123 )
124 }
125
126 let message = output.stream.try_recv_initial_response().await.map_err(response_error)?;
127
128 match message {
129 ::std::option::Option::Some(_message) => ::std::result::Result::Ok(output),
130 ::std::option::Option::None => ::std::result::Result::Ok(output),
131 }
132 }
133
134 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
135 pub fn customize(
136 self,
137 ) -> crate::client::customize::CustomizableOperation<
138 crate::operation::converse_stream::ConverseStreamOutput,
139 crate::operation::converse_stream::ConverseStreamError,
140 Self,
141 > {
142 crate::client::customize::CustomizableOperation::new(self)
143 }
144 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
145 self.set_config_override(::std::option::Option::Some(config_override.into()));
146 self
147 }
148
149 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
150 self.config_override = config_override;
151 self
152 }
153 /// <p>Specifies the model or throughput with which to run inference, or the prompt resource to use in inference. The value depends on the resource that you use:</p>
154 /// <ul>
155 /// <li>
156 /// <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>
157 /// <li>
158 /// <p>If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for cross-region inference</a> in the Amazon Bedrock User Guide.</p></li>
159 /// <li>
160 /// <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>
161 /// <li>
162 /// <p>If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li>
163 /// <li>
164 /// <p>To include a prompt that was defined in <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html">Prompt management</a>, specify the ARN of the prompt version to use.</p></li>
165 /// </ul>
166 /// <p>The Converse API doesn't support <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">imported models</a>.</p>
167 pub fn model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
168 self.inner = self.inner.model_id(input.into());
169 self
170 }
171 /// <p>Specifies the model or throughput with which to run inference, or the prompt resource to use in inference. The value depends on the resource that you use:</p>
172 /// <ul>
173 /// <li>
174 /// <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>
175 /// <li>
176 /// <p>If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for cross-region inference</a> in the Amazon Bedrock User Guide.</p></li>
177 /// <li>
178 /// <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>
179 /// <li>
180 /// <p>If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li>
181 /// <li>
182 /// <p>To include a prompt that was defined in <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html">Prompt management</a>, specify the ARN of the prompt version to use.</p></li>
183 /// </ul>
184 /// <p>The Converse API doesn't support <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">imported models</a>.</p>
185 pub fn set_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186 self.inner = self.inner.set_model_id(input);
187 self
188 }
189 /// <p>Specifies the model or throughput with which to run inference, or the prompt resource to use in inference. The value depends on the resource that you use:</p>
190 /// <ul>
191 /// <li>
192 /// <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>
193 /// <li>
194 /// <p>If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for cross-region inference</a> in the Amazon Bedrock User Guide.</p></li>
195 /// <li>
196 /// <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>
197 /// <li>
198 /// <p>If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li>
199 /// <li>
200 /// <p>To include a prompt that was defined in <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html">Prompt management</a>, specify the ARN of the prompt version to use.</p></li>
201 /// </ul>
202 /// <p>The Converse API doesn't support <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">imported models</a>.</p>
203 pub fn get_model_id(&self) -> &::std::option::Option<::std::string::String> {
204 self.inner.get_model_id()
205 }
206 ///
207 /// Appends an item to `messages`.
208 ///
209 /// To override the contents of this collection use [`set_messages`](Self::set_messages).
210 ///
211 /// <p>The messages that you want to send to the model.</p>
212 pub fn messages(mut self, input: crate::types::Message) -> Self {
213 self.inner = self.inner.messages(input);
214 self
215 }
216 /// <p>The messages that you want to send to the model.</p>
217 pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
218 self.inner = self.inner.set_messages(input);
219 self
220 }
221 /// <p>The messages that you want to send to the model.</p>
222 pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
223 self.inner.get_messages()
224 }
225 ///
226 /// Appends an item to `system`.
227 ///
228 /// To override the contents of this collection use [`set_system`](Self::set_system).
229 ///
230 /// <p>A prompt that provides instructions or context to the model about the task it should perform, or the persona it should adopt during the conversation.</p>
231 pub fn system(mut self, input: crate::types::SystemContentBlock) -> Self {
232 self.inner = self.inner.system(input);
233 self
234 }
235 /// <p>A prompt that provides instructions or context to the model about the task it should perform, or the persona it should adopt during the conversation.</p>
236 pub fn set_system(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>>) -> Self {
237 self.inner = self.inner.set_system(input);
238 self
239 }
240 /// <p>A prompt that provides instructions or context to the model about the task it should perform, or the persona it should adopt during the conversation.</p>
241 pub fn get_system(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>> {
242 self.inner.get_system()
243 }
244 /// <p>Inference parameters to pass to the model. <code>Converse</code> and <code>ConverseStream</code> support a base set of inference parameters. If you need to pass additional parameters that the model supports, use the <code>additionalModelRequestFields</code> request field.</p>
245 pub fn inference_config(mut self, input: crate::types::InferenceConfiguration) -> Self {
246 self.inner = self.inner.inference_config(input);
247 self
248 }
249 /// <p>Inference parameters to pass to the model. <code>Converse</code> and <code>ConverseStream</code> support a base set of inference parameters. If you need to pass additional parameters that the model supports, use the <code>additionalModelRequestFields</code> request field.</p>
250 pub fn set_inference_config(mut self, input: ::std::option::Option<crate::types::InferenceConfiguration>) -> Self {
251 self.inner = self.inner.set_inference_config(input);
252 self
253 }
254 /// <p>Inference parameters to pass to the model. <code>Converse</code> and <code>ConverseStream</code> support a base set of inference parameters. If you need to pass additional parameters that the model supports, use the <code>additionalModelRequestFields</code> request field.</p>
255 pub fn get_inference_config(&self) -> &::std::option::Option<crate::types::InferenceConfiguration> {
256 self.inner.get_inference_config()
257 }
258 /// <p>Configuration information for the tools that the model can use when generating a response.</p>
259 /// <p>For information about models that support streaming tool use, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features">Supported models and model features</a>.</p>
260 pub fn tool_config(mut self, input: crate::types::ToolConfiguration) -> Self {
261 self.inner = self.inner.tool_config(input);
262 self
263 }
264 /// <p>Configuration information for the tools that the model can use when generating a response.</p>
265 /// <p>For information about models that support streaming tool use, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features">Supported models and model features</a>.</p>
266 pub fn set_tool_config(mut self, input: ::std::option::Option<crate::types::ToolConfiguration>) -> Self {
267 self.inner = self.inner.set_tool_config(input);
268 self
269 }
270 /// <p>Configuration information for the tools that the model can use when generating a response.</p>
271 /// <p>For information about models that support streaming tool use, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features">Supported models and model features</a>.</p>
272 pub fn get_tool_config(&self) -> &::std::option::Option<crate::types::ToolConfiguration> {
273 self.inner.get_tool_config()
274 }
275 /// <p>Configuration information for a guardrail that you want to use in the request. If you include <code>guardContent</code> blocks in the <code>content</code> field in the <code>messages</code> field, the guardrail operates only on those messages. If you include no <code>guardContent</code> blocks, the guardrail operates on all messages in the request body and in any included prompt resource.</p>
276 pub fn guardrail_config(mut self, input: crate::types::GuardrailStreamConfiguration) -> Self {
277 self.inner = self.inner.guardrail_config(input);
278 self
279 }
280 /// <p>Configuration information for a guardrail that you want to use in the request. If you include <code>guardContent</code> blocks in the <code>content</code> field in the <code>messages</code> field, the guardrail operates only on those messages. If you include no <code>guardContent</code> blocks, the guardrail operates on all messages in the request body and in any included prompt resource.</p>
281 pub fn set_guardrail_config(mut self, input: ::std::option::Option<crate::types::GuardrailStreamConfiguration>) -> Self {
282 self.inner = self.inner.set_guardrail_config(input);
283 self
284 }
285 /// <p>Configuration information for a guardrail that you want to use in the request. If you include <code>guardContent</code> blocks in the <code>content</code> field in the <code>messages</code> field, the guardrail operates only on those messages. If you include no <code>guardContent</code> blocks, the guardrail operates on all messages in the request body and in any included prompt resource.</p>
286 pub fn get_guardrail_config(&self) -> &::std::option::Option<crate::types::GuardrailStreamConfiguration> {
287 self.inner.get_guardrail_config()
288 }
289 /// <p>Additional inference parameters that the model supports, beyond the base set of inference parameters that <code>Converse</code> and <code>ConverseStream</code> support in the <code>inferenceConfig</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Model parameters</a>.</p>
290 pub fn additional_model_request_fields(mut self, input: ::aws_smithy_types::Document) -> Self {
291 self.inner = self.inner.additional_model_request_fields(input);
292 self
293 }
294 /// <p>Additional inference parameters that the model supports, beyond the base set of inference parameters that <code>Converse</code> and <code>ConverseStream</code> support in the <code>inferenceConfig</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Model parameters</a>.</p>
295 pub fn set_additional_model_request_fields(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self {
296 self.inner = self.inner.set_additional_model_request_fields(input);
297 self
298 }
299 /// <p>Additional inference parameters that the model supports, beyond the base set of inference parameters that <code>Converse</code> and <code>ConverseStream</code> support in the <code>inferenceConfig</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Model parameters</a>.</p>
300 pub fn get_additional_model_request_fields(&self) -> &::std::option::Option<::aws_smithy_types::Document> {
301 self.inner.get_additional_model_request_fields()
302 }
303 ///
304 /// Adds a key-value pair to `promptVariables`.
305 ///
306 /// To override the contents of this collection use [`set_prompt_variables`](Self::set_prompt_variables).
307 ///
308 /// <p>Contains a map of variables in a prompt from Prompt management to objects containing the values to fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the <code>modelId</code> field.</p>
309 pub fn prompt_variables(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::PromptVariableValues) -> Self {
310 self.inner = self.inner.prompt_variables(k.into(), v);
311 self
312 }
313 /// <p>Contains a map of variables in a prompt from Prompt management to objects containing the values to fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the <code>modelId</code> field.</p>
314 pub fn set_prompt_variables(
315 mut self,
316 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>>,
317 ) -> Self {
318 self.inner = self.inner.set_prompt_variables(input);
319 self
320 }
321 /// <p>Contains a map of variables in a prompt from Prompt management to objects containing the values to fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the <code>modelId</code> field.</p>
322 pub fn get_prompt_variables(
323 &self,
324 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>> {
325 self.inner.get_prompt_variables()
326 }
327 ///
328 /// Appends an item to `additionalModelResponseFieldPaths`.
329 ///
330 /// To override the contents of this collection use [`set_additional_model_response_field_paths`](Self::set_additional_model_response_field_paths).
331 ///
332 /// <p>Additional model parameters field paths to return in the response. <code>Converse</code> and <code>ConverseStream</code> return the requested fields as a JSON Pointer object in the <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
333 /// <p><code>\[ "/stop_sequence" \]</code></p>
334 /// <p>For information about the JSON Pointer syntax, see the <a href="https://datatracker.ietf.org/doc/html/rfc6901">Internet Engineering Task Force (IETF)</a> documentation.</p>
335 /// <p><code>Converse</code> and <code>ConverseStream</code> reject an empty JSON Pointer or incorrectly structured JSON Pointer with a <code>400</code> error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by <code>Converse</code>.</p>
336 pub fn additional_model_response_field_paths(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
337 self.inner = self.inner.additional_model_response_field_paths(input.into());
338 self
339 }
340 /// <p>Additional model parameters field paths to return in the response. <code>Converse</code> and <code>ConverseStream</code> return the requested fields as a JSON Pointer object in the <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
341 /// <p><code>\[ "/stop_sequence" \]</code></p>
342 /// <p>For information about the JSON Pointer syntax, see the <a href="https://datatracker.ietf.org/doc/html/rfc6901">Internet Engineering Task Force (IETF)</a> documentation.</p>
343 /// <p><code>Converse</code> and <code>ConverseStream</code> reject an empty JSON Pointer or incorrectly structured JSON Pointer with a <code>400</code> error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by <code>Converse</code>.</p>
344 pub fn set_additional_model_response_field_paths(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
345 self.inner = self.inner.set_additional_model_response_field_paths(input);
346 self
347 }
348 /// <p>Additional model parameters field paths to return in the response. <code>Converse</code> and <code>ConverseStream</code> return the requested fields as a JSON Pointer object in the <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
349 /// <p><code>\[ "/stop_sequence" \]</code></p>
350 /// <p>For information about the JSON Pointer syntax, see the <a href="https://datatracker.ietf.org/doc/html/rfc6901">Internet Engineering Task Force (IETF)</a> documentation.</p>
351 /// <p><code>Converse</code> and <code>ConverseStream</code> reject an empty JSON Pointer or incorrectly structured JSON Pointer with a <code>400</code> error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by <code>Converse</code>.</p>
352 pub fn get_additional_model_response_field_paths(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
353 self.inner.get_additional_model_response_field_paths()
354 }
355 ///
356 /// Adds a key-value pair to `requestMetadata`.
357 ///
358 /// To override the contents of this collection use [`set_request_metadata`](Self::set_request_metadata).
359 ///
360 /// <p>Key-value pairs that you can use to filter invocation logs.</p>
361 pub fn request_metadata(
362 mut self,
363 k: impl ::std::convert::Into<::std::string::String>,
364 v: impl ::std::convert::Into<::std::string::String>,
365 ) -> Self {
366 self.inner = self.inner.request_metadata(k.into(), v.into());
367 self
368 }
369 /// <p>Key-value pairs that you can use to filter invocation logs.</p>
370 pub fn set_request_metadata(
371 mut self,
372 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
373 ) -> Self {
374 self.inner = self.inner.set_request_metadata(input);
375 self
376 }
377 /// <p>Key-value pairs that you can use to filter invocation logs.</p>
378 pub fn get_request_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
379 self.inner.get_request_metadata()
380 }
381 /// <p>Model performance settings for the request.</p>
382 pub fn performance_config(mut self, input: crate::types::PerformanceConfiguration) -> Self {
383 self.inner = self.inner.performance_config(input);
384 self
385 }
386 /// <p>Model performance settings for the request.</p>
387 pub fn set_performance_config(mut self, input: ::std::option::Option<crate::types::PerformanceConfiguration>) -> Self {
388 self.inner = self.inner.set_performance_config(input);
389 self
390 }
391 /// <p>Model performance settings for the request.</p>
392 pub fn get_performance_config(&self) -> &::std::option::Option<crate::types::PerformanceConfiguration> {
393 self.inner.get_performance_config()
394 }
395}