adk-model 3.0.0

LLM model integrations for Rust Agent Development Kit (ADK-Rust) (Gemini, OpenAI, Claude, DeepSeek, etc.)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
//! Amazon Bedrock client implementation.
//!
//! Uses the AWS SDK Converse API for both streaming and non-streaming
//! inference. Credentials are loaded automatically from the environment
//! via `aws-config` (environment variables, shared config, IMDS, etc.).

use super::config::BedrockConfig;
use super::convert::{
    adk_request_to_bedrock, bedrock_response_to_adk, bedrock_stream_content_start_to_adk,
    bedrock_stream_delta_to_adk, bedrock_stream_stop_to_adk,
};
use crate::retry::RetryConfig;
use adk_core::{AdkError, Llm, LlmRequest, LlmResponse, LlmResponseStream};
use async_stream::try_stream;
use async_trait::async_trait;
use aws_sdk_bedrockruntime::types::ConverseStreamOutput;
use tracing::{debug, info, instrument};

/// Amazon Bedrock client backed by the AWS SDK Converse API.
///
/// Supports both streaming (`converse_stream`) and non-streaming (`converse`)
/// inference. AWS credentials are loaded from the standard credential chain
/// (environment variables, `~/.aws/credentials`, IMDS, etc.).
///
/// # Example
///
/// ```rust,ignore
/// use adk_model::bedrock::{BedrockClient, BedrockConfig};
///
/// let config = BedrockConfig::new("us-east-1", "us.anthropic.claude-sonnet-5-5");
/// let client = BedrockClient::new(config).await?;
///
/// // Use via the Llm trait
/// let response = client.generate_content(request, false).await?;
/// ```
pub struct BedrockClient {
    client: aws_sdk_bedrockruntime::Client,
    model_id: String,
    region: String,
    /// The runtime endpoint: the configured URL, or the region's.
    endpoint: String,
    retry_config: RetryConfig,
    prompt_caching: Option<super::config::BedrockCacheConfig>,
    /// Bound on each wait for the next stream event.
    stream_idle: std::time::Duration,
}

impl BedrockClient {
    /// Create a new Bedrock client from the given configuration.
    ///
    /// Loads AWS credentials from the standard credential chain
    /// (environment variables, shared config, IMDS, etc.) and constructs
    /// an `aws_sdk_bedrockruntime::Client`.
    ///
    /// # Errors
    ///
    /// Returns `AdkError::Model` if the AWS SDK configuration fails to load.
    pub async fn new(config: BedrockConfig) -> Result<Self, AdkError> {
        let region = config.region.clone();
        let model_id = config.model_id.clone();
        let prompt_caching = config.prompt_caching.clone();

        let mut sdk_config_loader = aws_config::defaults(aws_config::BehaviorVersion::latest())
            .region(aws_config::Region::new(config.region.clone()))
            .timeout_config(timeout_config(crate::HttpTimeouts::default()));

        if let Some(endpoint_url) = &config.endpoint_url {
            sdk_config_loader = sdk_config_loader.endpoint_url(endpoint_url);
        }

        let sdk_config = sdk_config_loader.load().await;
        let client = aws_sdk_bedrockruntime::Client::new(&sdk_config);

        info!("bedrock client created for region={region}, model={model_id}");

        Ok(Self {
            client,
            model_id,
            endpoint: runtime_endpoint(&config),
            region,
            retry_config: RetryConfig::default(),
            prompt_caching,
            stream_idle: crate::HttpTimeouts::default().idle,
        })
    }

    /// Use an explicit Bedrock bearer key without reading the process credential chain.
    ///
    /// # Errors
    ///
    /// This constructor does not fail today; the `Result` leaves room for key validation.
    ///
    /// # Example
    ///
    /// ```
    /// use adk_model::bedrock::{BedrockClient, BedrockConfig};
    ///
    /// let config = BedrockConfig::new("us-east-1", "us.anthropic.claude-sonnet-5-5");
    /// let client = BedrockClient::new_with_api_key(config, "bedrock-api-key")?;
    /// # Ok::<(), adk_core::AdkError>(())
    /// ```
    pub fn new_with_api_key(config: BedrockConfig, api_key: &str) -> Result<Self, AdkError> {
        let mut sdk = aws_sdk_bedrockruntime::Config::builder()
            .behavior_version_latest()
            .region(aws_sdk_bedrockruntime::config::Region::new(config.region.clone()))
            .bearer_token(aws_sdk_bedrockruntime::config::Token::new(api_key, None))
            .timeout_config(timeout_config(crate::HttpTimeouts::default()));
        if let Some(endpoint) = &config.endpoint_url {
            sdk = sdk.endpoint_url(endpoint);
        }
        Ok(Self::from_client(config, aws_sdk_bedrockruntime::Client::from_conf(sdk.build())))
    }

    /// Supply a configured SDK client, preserving its identity and transport ownership.
    ///
    /// ADK retries are disabled because the supplied client carries its own retry
    /// configuration. The client keeps its own connect and read timeouts; the default idle
    /// timeout bounds each stream event, and `with_timeouts` sets all three.
    ///
    /// # Example
    ///
    /// ```no_run
    /// use adk_model::bedrock::{BedrockClient, BedrockConfig};
    ///
    /// # async fn example() {
    /// let sdk_config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await;
    /// let sdk = aws_sdk_bedrockruntime::Client::new(&sdk_config);
    /// let config = BedrockConfig::new("us-east-1", "us.anthropic.claude-sonnet-5-5");
    /// let client = BedrockClient::from_client(config, sdk);
    /// # }
    /// ```
    pub fn from_client(config: BedrockConfig, client: aws_sdk_bedrockruntime::Client) -> Self {
        Self {
            client,
            endpoint: runtime_endpoint(&config),
            model_id: config.model_id,
            region: config.region,
            retry_config: RetryConfig::disabled(),
            prompt_caching: config.prompt_caching,
            stream_idle: crate::HttpTimeouts::default().idle,
        }
    }

    /// Sets the connect timeout and the idle timeout, so a stalled stream fails with a
    /// `Timeout` error instead of holding the run.
    ///
    /// The idle timeout bounds the wait for the first response byte and for each stream
    /// event; see [`HttpTimeouts`](crate::HttpTimeouts) for the defaults. The SDK client is
    /// rebuilt with the connect bound, keeping the rest of its configuration.
    ///
    /// # Example
    ///
    /// ```
    /// use std::time::Duration;
    ///
    /// use adk_model::bedrock::{BedrockClient, BedrockConfig};
    /// use adk_model::HttpTimeouts;
    ///
    /// let config = BedrockConfig::new("us-east-1", "us.anthropic.claude-sonnet-5-5");
    /// let client = BedrockClient::new_with_api_key(config, "bedrock-api-key")?
    ///     .with_timeouts(HttpTimeouts::new(Duration::from_secs(5), Duration::from_secs(120)))?;
    /// # let _ = client;
    /// # Ok::<(), adk_core::AdkError>(())
    /// ```
    ///
    /// # Errors
    ///
    /// This method does not fail today; the `Result` matches the other clients'
    /// `with_timeouts`.
    pub fn with_timeouts(mut self, timeouts: crate::HttpTimeouts) -> Result<Self, AdkError> {
        self.client = aws_sdk_bedrockruntime::Client::from_conf(
            self.client.config().to_builder().timeout_config(timeout_config(timeouts)).build(),
        );
        self.stream_idle = timeouts.idle;
        Ok(self)
    }

    /// Set the retry configuration, consuming and returning `self`.
    #[must_use]
    pub fn with_retry_config(mut self, retry_config: RetryConfig) -> Self {
        self.retry_config = retry_config;
        self
    }

    /// Set the retry configuration by mutable reference.
    pub fn set_retry_config(&mut self, retry_config: RetryConfig) {
        self.retry_config = retry_config;
    }

    /// Returns a reference to the current retry configuration.
    pub fn retry_config(&self) -> &RetryConfig {
        &self.retry_config
    }
}

#[async_trait]
impl Llm for BedrockClient {
    // Only a request with `max_output_tokens` is bounded: without one Bedrock applies the model's own limit, which the catalog does not carry for Claude.
    fn max_cost_micro_usd(&self, request: &adk_core::LlmRequest) -> Option<u64> {
        crate::pricing::PricingCatalog::standard().max_cost_micro_usd(
            Some("bedrock"),
            self.name(),
            request,
            crate::pricing::request_output_cap(request),
        )
    }

    fn context_window(&self) -> Option<u64> {
        crate::pricing::PricingCatalog::standard().context_window(Some("bedrock"), self.name())
    }

    fn data_destinations(&self) -> Vec<adk_core::DataDestination> {
        vec![adk_core::DataDestination::of_url("bedrock", &self.endpoint)]
    }

    fn name(&self) -> &str {
        &self.model_id
    }

    #[instrument(name = "model.generate_content", skip_all, fields(model_id = %self.model_id, region = %self.region, stream))]
    async fn generate_content(
        &self,
        mut request: LlmRequest,
        stream: bool,
    ) -> Result<LlmResponseStream, AdkError> {
        // Native items reach this provider only from the turns its own origin marks.
        adk_core::history::retain_replayable(
            &mut request.contents,
            &adk_core::history::ProviderOrigin::new("bedrock", &self.model_id),
        );
        {
            use crate::generation_config::{Supports, reject_unsupported};
            let supports = Supports {
                stop_sequences: true,
                seed: false,
                penalties: false,
                top_logprobs: false,
            };
            reject_unsupported("bedrock", request.config.as_ref(), supports)?;
        }
        // This client sends no reasoning configuration (spec 3.1 §7.23).
        if let Some(level) = request.config.as_ref().and_then(|config| config.effort) {
            tracing::debug!(
                model.name = %self.model_id,
                effort = %level,
                "bedrock takes no reasoning effort from this client; the request's effort is ignored"
            );
        }
        let usage_span =
            crate::telemetry::inference_span("bedrock", &self.model_id, stream, &request);
        let bedrock_input = adk_request_to_bedrock(
            &request.contents,
            &request.tools,
            request.config.as_ref(),
            self.prompt_caching.as_ref(),
        )
        .map_err(|e| {
            AdkError::model(format!(
                "Bedrock request conversion failed for region={}, model={}: {e}",
                self.region, self.model_id
            ))
        })?;

        if stream && request.tools.is_empty() {
            let result = self.generate_streaming(bedrock_input).await?;
            Ok(crate::usage_tracking::with_priced_usage_tracking(
                result,
                usage_span,
                "bedrock",
                &self.model_id,
            ))
        } else {
            let result = self.generate_non_streaming(bedrock_input).await?;
            Ok(crate::usage_tracking::with_priced_usage_tracking(
                result,
                usage_span,
                "bedrock",
                &self.model_id,
            ))
        }
    }
}

/// The configured endpoint URL, or the Bedrock runtime endpoint of the configured region.
fn runtime_endpoint(config: &BedrockConfig) -> String {
    config.endpoint_url.clone().unwrap_or_else(|| {
        let domain =
            if config.region.starts_with("cn-") { "amazonaws.com.cn" } else { "amazonaws.com" };
        format!("https://bedrock-runtime.{}.{domain}", config.region)
    })
}

/// The SDK timeouts for `timeouts`: `connect`, and `idle` as the wait for the response.
fn timeout_config(timeouts: crate::HttpTimeouts) -> aws_smithy_types::timeout::TimeoutConfig {
    aws_smithy_types::timeout::TimeoutConfig::builder()
        .connect_timeout(timeouts.connect)
        .read_timeout(timeouts.idle)
        .build()
}

/// A failed Converse call, as `Timeout` when the connect or read timeout expired.
fn send_error<E, R>(
    error: &aws_sdk_bedrockruntime::error::SdkError<E, R>,
    region: &str,
    model_id: &str,
) -> AdkError
where
    aws_sdk_bedrockruntime::error::SdkError<E, R>: std::fmt::Display,
{
    use aws_sdk_bedrockruntime::error::SdkError;

    let message = format!("Bedrock API error for region={region}, model={model_id}: {error}");
    let timed_out = matches!(error, SdkError::TimeoutError(_))
        || matches!(error, SdkError::DispatchFailure(failure) if failure.is_timeout());
    if timed_out {
        AdkError::new(
            adk_core::ErrorComponent::Model,
            adk_core::ErrorCategory::Timeout,
            "model.bedrock.timeout",
            message,
        )
        .with_provider("bedrock")
    } else {
        AdkError::model(message)
    }
}

impl BedrockClient {
    /// Non-streaming: call `converse` and wrap the single response in a stream.
    async fn generate_non_streaming(
        &self,
        input: super::convert::BedrockConverseInput,
    ) -> Result<LlmResponseStream, AdkError> {
        debug!("bedrock non-streaming converse for model={}", self.model_id);

        let response = self
            .client
            .converse()
            .model_id(&self.model_id)
            .set_messages(Some(input.messages))
            .set_system(Some(input.system))
            .set_inference_config(input.inference_config)
            .set_tool_config(input.tool_config)
            .send()
            .await
            .map_err(|e| send_error(&e, &self.region, &self.model_id))?;

        let output = response.output.ok_or_else(|| {
            AdkError::model(format!("Bedrock response missing output for model={}", self.model_id))
        })?;

        let adk_response =
            bedrock_response_to_adk(&output, &response.stop_reason, response.usage.as_ref());

        let response_stream = try_stream! {
            yield adk_response;
        };

        Ok(Box::pin(response_stream))
    }

    /// Streaming: call `converse_stream` and convert each event to an `LlmResponse`.
    async fn generate_streaming(
        &self,
        input: super::convert::BedrockConverseInput,
    ) -> Result<LlmResponseStream, AdkError> {
        debug!("bedrock streaming converse for model={}", self.model_id);

        let mut stream_output = self
            .client
            .converse_stream()
            .model_id(&self.model_id)
            .set_messages(Some(input.messages))
            .set_system(Some(input.system))
            .set_inference_config(input.inference_config)
            .set_tool_config(input.tool_config)
            .send()
            .await
            .map_err(|e| send_error(&e, &self.region, &self.model_id))?;

        let model_id = self.model_id.clone();
        let region = self.region.clone();
        let stream_idle = self.stream_idle;

        let response_stream = try_stream! {
            // Track tool use state for accumulating partial JSON arguments.
            let mut tool_name: Option<String> = None;
            let mut tool_id: Option<String> = None;
            let mut tool_args_buf = String::new();
            // Track reasoning signature for the current reasoning content block.
            let mut reasoning_signature: Option<String> = None;
            // Buffer the stop response and usage metadata so they can be merged.
            // Bedrock sends Metadata after MessageStop, so we defer emitting
            // the final chunk until the stream ends.
            let mut pending_stop: Option<LlmResponse> = None;
            let mut pending_usage: Option<adk_core::UsageMetadata> = None;

            loop {
                let Ok(next) = tokio::time::timeout(stream_idle, stream_output.stream.recv()).await
                else {
                    Err(AdkError::new(
                        adk_core::ErrorComponent::Model,
                        adk_core::ErrorCategory::Timeout,
                        "model.bedrock.stream_idle_timeout",
                        format!(
                            "Bedrock stream for region={region}, model={model_id} sent no event within {stream_idle:?}"
                        ),
                    )
                    .with_provider("bedrock"))?;
                    break;
                };
                let Some(event) = next.map_err(|e| {
                    AdkError::model(format!(
                        "Bedrock stream error for region={region}, model={model_id}: {e}"
                    ))
                })? else {
                    break;
                };
                match event {
                    ConverseStreamOutput::ContentBlockStart(start_event) => {
                        if let Some(start) = &start_event.start {
                            // If starting a tool use block, track the name and ID.
                            if let aws_sdk_bedrockruntime::types::ContentBlockStart::ToolUse(
                                tool_start,
                            ) = start
                            {
                                tool_name = Some(tool_start.name.clone());
                                tool_id = Some(tool_start.tool_use_id.clone());
                                tool_args_buf.clear();
                            }

                            if let Some(response) = bedrock_stream_content_start_to_adk(start) {
                                yield response;
                            }
                        }
                    }
                    ConverseStreamOutput::ContentBlockDelta(delta_event) => {
                        if let Some(delta) = &delta_event.delta {
                            // Accumulate tool use argument deltas.
                            if let aws_sdk_bedrockruntime::types::ContentBlockDelta::ToolUse(
                                tool_delta,
                            ) = delta
                            {
                                tool_args_buf.push_str(&tool_delta.input);
                            }

                            // Capture reasoning signature deltas for later attachment.
                            if let aws_sdk_bedrockruntime::types::ContentBlockDelta::ReasoningContent(
                                reasoning_delta,
                            ) = delta
                                && let Ok(sig) = reasoning_delta.as_signature() {
                                    reasoning_signature = Some(sig.clone());
                                }

                            if let Some(response) = bedrock_stream_delta_to_adk(delta) {
                                yield response;
                            }
                        }
                    }
                    ConverseStreamOutput::ContentBlockStop(_) => {
                        // If we were accumulating tool arguments, emit the complete FunctionCall.
                        if let (Some(name), Some(id)) = (tool_name.take(), tool_id.take()) {
                            // A zero-argument tool streams no input, which decodes to `{}`.
                            let args = crate::tool_args::streamed_tool_arguments(
                                "bedrock",
                                &name,
                                &tool_args_buf,
                            );
                            tool_args_buf.clear();

                            yield LlmResponse {
                                content: Some(adk_core::Content {
                                    role: "model".to_string(),
                                    parts: vec![adk_core::Part::FunctionCall {
                                        name,
                                        args,
                                        id: Some(id),
                                        thought_signature: None,
                                    }],
                                }),
                                usage_metadata: None,
                                finish_reason: None,
                                citation_metadata: None,
                                partial: false,
                                turn_complete: false,
                                interrupted: false,
                                error_code: None,
                                error_message: None,
                                provider_metadata: None,
                                interaction_id: None,
                                model: None,
                                provider: None,
                            };
                        }

                        // If we accumulated a reasoning signature, emit it as a
                        // Part::Thinking with the signature so downstream consumers
                        // can attach it to the reasoning block.
                        if let Some(sig) = reasoning_signature.take() {
                            yield LlmResponse {
                                content: Some(adk_core::Content {
                                    role: "model".to_string(),
                                    parts: vec![adk_core::Part::Thinking {
                                        thinking: String::new(),
                                        signature: Some(sig),
                                    }],
                                }),
                                usage_metadata: None,
                                finish_reason: None,
                                citation_metadata: None,
                                partial: true,
                                turn_complete: false,
                                interrupted: false,
                                error_code: None,
                                error_message: None,
                                provider_metadata: None,
                                interaction_id: None,
                                model: None,
                                provider: None,
                            };
                        }
                    }
                    ConverseStreamOutput::MessageStart(_) => {
                        // MessageStart carries the role; no content to emit.
                    }
                    ConverseStreamOutput::MessageStop(stop_event) => {
                        // Buffer the stop chunk — Metadata arrives after this.
                        pending_stop = Some(bedrock_stream_stop_to_adk(&stop_event.stop_reason));
                    }
                    ConverseStreamOutput::Metadata(metadata_event) => {
                        if let Some(usage) = &metadata_event.usage {
                            pending_usage = Some(adk_core::UsageMetadata {
                                provider_usage: Some(serde_json::json!({
                                    "inputTokens":usage.input_tokens, "outputTokens":usage.output_tokens,
                                    "totalTokens":usage.total_tokens, "cacheReadInputTokens":usage.cache_read_input_tokens,
                                    "cacheWriteInputTokens":usage.cache_write_input_tokens,
                                })),
                                // Converse reports uncached input separately from cache reads and writes.
                                prompt_token_count: usage
                                    .input_tokens
                                    .saturating_add(usage.cache_read_input_tokens.unwrap_or(0))
                                    .saturating_add(usage.cache_write_input_tokens.unwrap_or(0)),
                                candidates_token_count: usage.output_tokens,
                                total_token_count: usage.total_tokens,
                                cache_read_input_token_count: usage.cache_read_input_tokens,
                                cache_creation_input_token_count: usage.cache_write_input_tokens,
                                ..Default::default()
                            });
                        }
                    }
                    _ => {
                        // Unknown event variant — skip.
                    }
                }
            }

            // Emit the final stop chunk with usage metadata merged in.
            if let Some(mut stop) = pending_stop {
                stop.usage_metadata = pending_usage.take();
                yield stop;
            } else {
                Err(AdkError::model("incomplete Bedrock event stream"))?;
            }
        };

        Ok(Box::pin(response_stream))
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::time::Duration;

    fn sdk_timeouts(client: &BedrockClient) -> (Option<Duration>, Option<Duration>) {
        let config = client.client.config().timeout_config();
        config.map_or((None, None), |config| (config.connect_timeout(), config.read_timeout()))
    }

    #[test]
    fn the_default_timeouts_bound_connecting_and_the_response() {
        let client =
            BedrockClient::new_with_api_key(BedrockConfig::new("us-east-1", "m"), "key").unwrap();
        let defaults = crate::HttpTimeouts::default();
        assert_eq!(sdk_timeouts(&client), (Some(defaults.connect), Some(defaults.idle)));

        let client = client
            .with_timeouts(crate::HttpTimeouts::new(Duration::from_secs(2), Duration::from_secs(9)))
            .unwrap();
        assert_eq!(
            sdk_timeouts(&client),
            (Some(Duration::from_secs(2)), Some(Duration::from_secs(9)))
        );
    }

    #[test]
    fn the_destination_is_the_regional_runtime_or_the_configured_endpoint() {
        let destination =
            |config| BedrockClient::new_with_api_key(config, "key").unwrap().data_destinations();
        assert_eq!(
            destination(BedrockConfig::new("eu-west-1", "m")),
            [adk_core::DataDestination::new(
                "bedrock",
                ["bedrock-runtime.eu-west-1.amazonaws.com"]
            )]
        );
        assert_eq!(
            destination(BedrockConfig::new("cn-north-1", "m")),
            [adk_core::DataDestination::new(
                "bedrock",
                ["bedrock-runtime.cn-north-1.amazonaws.com.cn"]
            )]
        );
        let vpce = "https://vpce-1.bedrock-runtime.us-west-2.vpce.amazonaws.com";
        assert_eq!(
            destination(BedrockConfig::new("us-west-2", "m").with_endpoint_url(vpce)),
            [adk_core::DataDestination::new(
                "bedrock",
                ["vpce-1.bedrock-runtime.us-west-2.vpce.amazonaws.com"]
            )]
        );
    }
}