awsdocs / aws-doc-sdk-examples

Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BedrockRuntimeClient can't seem to set the read time and connect time

ryu6 opened this issue · comments

commented

Background story

image
It seems impossible to set the connection time and read timeout using BedrockRuntimeClient. I have tried using apiCallTimeout and apiCallAttemptTimeout and given a large enough time. When Claude does not return content for more than 30s, the read time out will be thrown. In addition, I did not see where. There are settings for connection time and read time

What does this example accomplish?

I set the reading time to avoid ending early while waiting for Claude to return content. The reading time of 30s is too little.Furthermore, the descriptions of these two methods are too confusing.

Which AWS service(s)?

aws bedrock

Which AWS SDKs or tools?

  • All languages
  • .NET
  • C++
  • Go (v2)
  • Java
  • Java (v2)
  • JavaScript
  • JavaScript (v3)
  • Kotlin
  • PHP
  • Python
  • Ruby
  • Rust
  • Swift
  • Not applicable

Are there existing code examples to leverage?

BedrockRuntimeClient client = BedrockRuntimeClient.builder()
.region(Region.US_EAST_1)
.credentialsProvider(ProfileCredentialsProvider.create())
.overrideConfiguration(c -> c.retryPolicy(RetryPolicy.none())
.apiCallAttemptTimeout(Duration.ofMillis(5))
.apiCallAttemptTimeout(Duration.ofMillis(6)))
.build();

Do you have any reference code?

BedrockRuntimeClient client = BedrockRuntimeClient.builder()
                .region(Region.US_EAST_1)
                .credentialsProvider(ProfileCredentialsProvider.create())
                .overrideConfiguration(c -> c.retryPolicy(RetryPolicy.none())
                        .apiCallAttemptTimeout(Duration.ofMillis(5))
                        .apiCallAttemptTimeout(Duration.ofMillis(6)))
                .build();