|
39 | 39 | import java.net.URI; |
40 | 40 | import java.util.ArrayList; |
41 | 41 | import java.util.List; |
42 | | -import java.util.concurrent.ExecutionException; |
43 | 42 | import java.util.function.Consumer; |
44 | 43 | import java.util.stream.Stream; |
45 | 44 | import org.junit.jupiter.api.Test; |
@@ -669,7 +668,7 @@ void testConverseToolCall() { |
669 | 668 | } |
670 | 669 |
|
671 | 670 | @Test |
672 | | - void testConverseToolCallStream() throws InterruptedException, ExecutionException { |
| 671 | + void testConverseToolCallStream() { |
673 | 672 | BedrockRuntimeAsyncClientBuilder builder = BedrockRuntimeAsyncClient.builder(); |
674 | 673 | builder.overrideConfiguration(createOverrideConfigurationBuilder().build()); |
675 | 674 | configureClient(builder); |
@@ -730,7 +729,7 @@ void testConverseToolCallStream() throws InterruptedException, ExecutionExceptio |
730 | 729 | .toolConfig(currentWeatherToolConfig()) |
731 | 730 | .build(), |
732 | 731 | responseHandler) |
733 | | - .get(); |
| 732 | + .join(); |
734 | 733 |
|
735 | 734 | if (currentToolArgs.length() > 0 && !responseChunksTools.isEmpty()) { |
736 | 735 | JsonNode node = JsonNode.parser().parse(currentToolArgs.toString()); |
@@ -922,7 +921,7 @@ void testConverseToolCallStream() throws InterruptedException, ExecutionExceptio |
922 | 921 | .toolConfig(currentWeatherToolConfig()) |
923 | 922 | .build(), |
924 | 923 | responseHandler1) |
925 | | - .get(); |
| 924 | + .join(); |
926 | 925 |
|
927 | 926 | assertThat(String.join("", responseChunks)) |
928 | 927 | .contains( |
@@ -1103,7 +1102,7 @@ private static ToolConfiguration currentWeatherToolConfig() { |
1103 | 1102 | } |
1104 | 1103 |
|
1105 | 1104 | @Test |
1106 | | - void testConverseStream() throws InterruptedException, ExecutionException { |
| 1105 | + void testConverseStream() { |
1107 | 1106 | BedrockRuntimeAsyncClientBuilder builder = BedrockRuntimeAsyncClient.builder(); |
1108 | 1107 | builder.overrideConfiguration(createOverrideConfigurationBuilder().build()); |
1109 | 1108 | configureClient(builder); |
@@ -1135,7 +1134,7 @@ void testConverseStream() throws InterruptedException, ExecutionException { |
1135 | 1134 | .build()) |
1136 | 1135 | .build(), |
1137 | 1136 | responseHandler) |
1138 | | - .get(); |
| 1137 | + .join(); |
1139 | 1138 |
|
1140 | 1139 | assertThat(String.join("", responseChunks)).isEqualTo("\"Test, test\""); |
1141 | 1140 |
|
@@ -1222,7 +1221,7 @@ void testConverseStream() throws InterruptedException, ExecutionException { |
1222 | 1221 | } |
1223 | 1222 |
|
1224 | 1223 | @Test |
1225 | | - void testConverseStreamOptions() throws InterruptedException, ExecutionException { |
| 1224 | + void testConverseStreamOptions() { |
1226 | 1225 | BedrockRuntimeAsyncClientBuilder builder = BedrockRuntimeAsyncClient.builder(); |
1227 | 1226 | builder.overrideConfiguration(createOverrideConfigurationBuilder().build()); |
1228 | 1227 | configureClient(builder); |
@@ -1261,7 +1260,7 @@ void testConverseStreamOptions() throws InterruptedException, ExecutionException |
1261 | 1260 | .build()) |
1262 | 1261 | .build(), |
1263 | 1262 | responseHandler) |
1264 | | - .get(); |
| 1263 | + .join(); |
1265 | 1264 |
|
1266 | 1265 | assertThat(String.join("", responseChunks)).isEqualTo("This model"); |
1267 | 1266 |
|
@@ -1439,8 +1438,7 @@ void testInvokeModelAmazonTitan() { |
1439 | 1438 | } |
1440 | 1439 |
|
1441 | 1440 | @Test |
1442 | | - void testInvokeModelWithResponseStreamAmazonTitan() |
1443 | | - throws InterruptedException, ExecutionException { |
| 1441 | + void testInvokeModelWithResponseStreamAmazonTitan() { |
1444 | 1442 | BedrockRuntimeAsyncClientBuilder builder = BedrockRuntimeAsyncClient.builder(); |
1445 | 1443 | builder.overrideConfiguration(createOverrideConfigurationBuilder().build()); |
1446 | 1444 | configureClient(builder); |
@@ -1488,7 +1486,7 @@ void testInvokeModelWithResponseStreamAmazonTitan() |
1488 | 1486 | .build()) |
1489 | 1487 | .build(); |
1490 | 1488 |
|
1491 | | - client.invokeModelWithResponseStream(request, responseHandler).get(); |
| 1489 | + client.invokeModelWithResponseStream(request, responseHandler).join(); |
1492 | 1490 |
|
1493 | 1491 | assertThat(text.toString()).contains("Here is the list of every country in the world"); |
1494 | 1492 |
|
@@ -1736,8 +1734,7 @@ void testInvokeModelAmazonNova() { |
1736 | 1734 | } |
1737 | 1735 |
|
1738 | 1736 | @Test |
1739 | | - void testInvokeModelWithResponseStreamAmazonNova() |
1740 | | - throws InterruptedException, ExecutionException { |
| 1737 | + void testInvokeModelWithResponseStreamAmazonNova() { |
1741 | 1738 | BedrockRuntimeAsyncClientBuilder builder = BedrockRuntimeAsyncClient.builder(); |
1742 | 1739 | builder.overrideConfiguration(createOverrideConfigurationBuilder().build()); |
1743 | 1740 | configureClient(builder); |
@@ -1804,7 +1801,7 @@ void testInvokeModelWithResponseStreamAmazonNova() |
1804 | 1801 | .build()) |
1805 | 1802 | .build(); |
1806 | 1803 |
|
1807 | | - client.invokeModelWithResponseStream(request, responseHandler).get(); |
| 1804 | + client.invokeModelWithResponseStream(request, responseHandler).join(); |
1808 | 1805 |
|
1809 | 1806 | assertThat(text.toString()) |
1810 | 1807 | .contains("Listing every country in the world is a comprehensive task"); |
@@ -2278,8 +2275,7 @@ void testInvokeModelMistralMistral() { |
2278 | 2275 | } |
2279 | 2276 |
|
2280 | 2277 | @Test |
2281 | | - void testInvokeModelWithResponseStreamAnthropicClaude() |
2282 | | - throws InterruptedException, ExecutionException { |
| 2278 | + void testInvokeModelWithResponseStreamAnthropicClaude() { |
2283 | 2279 | BedrockRuntimeAsyncClientBuilder builder = BedrockRuntimeAsyncClient.builder(); |
2284 | 2280 | builder.overrideConfiguration(createOverrideConfigurationBuilder().build()); |
2285 | 2281 | configureClient(builder); |
@@ -2340,7 +2336,7 @@ void testInvokeModelWithResponseStreamAnthropicClaude() |
2340 | 2336 | .build()) |
2341 | 2337 | .build(); |
2342 | 2338 |
|
2343 | | - client.invokeModelWithResponseStream(request, responseHandler).get(); |
| 2339 | + client.invokeModelWithResponseStream(request, responseHandler).join(); |
2344 | 2340 |
|
2345 | 2341 | assertThat(text.toString()).contains("Unfortunately I do not have a complete list of every"); |
2346 | 2342 |
|
@@ -2860,8 +2856,7 @@ void testInvokeModelToolCallAmazonNova() { |
2860 | 2856 | } |
2861 | 2857 |
|
2862 | 2858 | @Test |
2863 | | - void testInvokeModelWithResponseStreamToolCallAmazonNova() |
2864 | | - throws InterruptedException, ExecutionException { |
| 2859 | + void testInvokeModelWithResponseStreamToolCallAmazonNova() { |
2865 | 2860 | BedrockRuntimeAsyncClientBuilder builder = BedrockRuntimeAsyncClient.builder(); |
2866 | 2861 | builder.overrideConfiguration(createOverrideConfigurationBuilder().build()); |
2867 | 2862 | configureClient(builder); |
@@ -2999,7 +2994,7 @@ public void accept(PayloadPart chunk) { |
2999 | 2994 | .build()) |
3000 | 2995 | .build(); |
3001 | 2996 |
|
3002 | | - client.invokeModelWithResponseStream(request0, responseHandler0).get(); |
| 2997 | + client.invokeModelWithResponseStream(request0, responseHandler0).join(); |
3003 | 2998 |
|
3004 | 2999 | String seattleToolUseId0 = ""; |
3005 | 3000 | String sanFranciscoToolUseId0 = ""; |
@@ -3233,7 +3228,7 @@ public void accept(PayloadPart chunk) { |
3233 | 3228 | .build()) |
3234 | 3229 | .build(); |
3235 | 3230 |
|
3236 | | - client.invokeModelWithResponseStream(request1, responseHandler1).get(); |
| 3231 | + client.invokeModelWithResponseStream(request1, responseHandler1).join(); |
3237 | 3232 |
|
3238 | 3233 | assertThat(text.toString()) |
3239 | 3234 | .contains( |
@@ -3770,8 +3765,7 @@ void testInvokeModelToolCallAnthropicClaude() { |
3770 | 3765 | } |
3771 | 3766 |
|
3772 | 3767 | @Test |
3773 | | - void testInvokeModelWithResponseStreamToolCallAnthropicClaude() |
3774 | | - throws InterruptedException, ExecutionException { |
| 3768 | + void testInvokeModelWithResponseStreamToolCallAnthropicClaude() { |
3775 | 3769 | BedrockRuntimeAsyncClientBuilder builder = BedrockRuntimeAsyncClient.builder(); |
3776 | 3770 | builder.overrideConfiguration(createOverrideConfigurationBuilder().build()); |
3777 | 3771 | configureClient(builder); |
@@ -3912,7 +3906,7 @@ public void accept(PayloadPart chunk) { |
3912 | 3906 | .build()) |
3913 | 3907 | .build(); |
3914 | 3908 |
|
3915 | | - client.invokeModelWithResponseStream(request0, responseHandler0).get(); |
| 3909 | + client.invokeModelWithResponseStream(request0, responseHandler0).join(); |
3916 | 3910 |
|
3917 | 3911 | String seattleToolUseId0 = ""; |
3918 | 3912 | String sanFranciscoToolUseId0 = ""; |
@@ -4120,7 +4114,7 @@ public void accept(PayloadPart chunk) { |
4120 | 4114 | .build()) |
4121 | 4115 | .build(); |
4122 | 4116 |
|
4123 | | - client.invokeModelWithResponseStream(request1, responseHandler1).get(); |
| 4117 | + client.invokeModelWithResponseStream(request1, responseHandler1).join(); |
4124 | 4118 |
|
4125 | 4119 | assertThat(text.toString()) |
4126 | 4120 | .contains( |
|
0 commit comments