Expected Behavior

When submitting large requests to Amazon Bedrock or when reading large responses, or when Amazon Bedrock is experiencing issues and is not serving from a region close to me I will experience latency that exceeds the default settings.

Current Behavior

When this occurs, the AWS SDK retries my connection four times and then returns an error which then causes an exception to be thrown.

Presently there are no mechanisms for increasing these timeout values. It would be very helpful if we could set the AWS SDK timeout values through the Spring AI Bedrock configuration (spring.ai.bedrock.aws).

Context

My project used Claude Sonnet 3.5 and we submit requests that are decently sized. On several occasions latency exceeds the 30 second "socket timeout". One hint that this is the issue is that requests are retried four times and it takes about two minutes for the request to throw an exception (4 attempts + 30s = 120s or 2m).

More information on this issue may be found on the AWS website:

https://repost.aws/articles/AR_A_6aqweQYOR5FCgvM2vdA/solving-read-timed-out-error-and-high-latencies-in-amazon-bedrock-with-aws-java-sdk-client

Comment From: cmiles74

This is my first PR to this project, please let me know if there are any style issues or other changes. Thank you! 🙂