Skip to content

Commit ba057fe

Browse files
committed
GH-1679 Disable BedrockConverseProxyChatAutoConfiguration by default
- Set the default value for spring.ai.bedrock.anthropic.chat.enabled to false to disable the BedrockConverseProxyChatAutoConfiguration by default - This will make sure that the BedrockConverseProxy auto configuration wouldn't conflict with other related Bedrock autoconfigs (ex: BedrockAnthropic3ChatAutoConfiguration) - Update documentation for the default behaviour - Update tests Resolves #1679
1 parent 7895875 commit ba057fe

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/bedrock-converse.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The prefix `spring.ai.bedrock.converse.chat` is the property prefix that configu
7373
|====
7474
| Property | Description | Default
7575

76-
| spring.ai.bedrock.converse.chat.enabled | Enable Bedrock Converse chat model. | true
76+
| spring.ai.bedrock.converse.chat.enabled | Enable Bedrock Converse chat model. | false
7777
| spring.ai.bedrock.converse.chat.options.model | The model ID to use. You can use the https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html[Supported models and model features] | anthropic.claude-3-sonnet-20240229-v1:0
7878
| spring.ai.bedrock.converse.chat.options.temperature | Controls the randomness of the output. Values can range over [0.0,1.0] | 0.8
7979
| spring.ai.bedrock.converse.chat.options.top-p | The maximum cumulative probability of tokens to consider when sampling. | AWS Bedrock default

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/converse/BedrockConverseProxyChatAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
@EnableConfigurationProperties({ BedrockConverseProxyChatProperties.class, BedrockAwsConnectionConfiguration.class })
5454
@ConditionalOnClass({ BedrockRuntimeClient.class, BedrockRuntimeAsyncClient.class })
5555
@ConditionalOnProperty(prefix = BedrockConverseProxyChatProperties.CONFIG_PREFIX, name = "enabled",
56-
havingValue = "true", matchIfMissing = true)
56+
havingValue = "true")
5757
@Import(BedrockAwsConnectionConfiguration.class)
5858
public class BedrockConverseProxyChatAutoConfiguration {
5959

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/bedrock/converse/BedrockConverseProxyChatProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class BedrockConverseProxyChatProperties {
3535
/**
3636
* Enable Bedrock Converse chat model.
3737
*/
38-
private boolean enabled = true;
38+
private boolean enabled = false;
3939

4040
@NestedConfigurationProperty
4141
private PortableFunctionCallingOptions options = PortableFunctionCallingOptions.builder()

spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/bedrock/converse/BedrockConverseProxyChatAutoConfigurationIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class BedrockConverseProxyChatAutoConfigurationIT {
4343
private static final Log logger = LogFactory.getLog(BedrockConverseProxyChatAutoConfigurationIT.class);
4444

4545
private final ApplicationContextRunner contextRunner = BedrockTestUtils.getContextRunner()
46-
.withPropertyValues(
46+
.withPropertyValues("spring.ai.bedrock.converse.chat.enabled=true",
4747
"spring.ai.bedrock.converse.chat.options.model=" + "anthropic.claude-3-5-sonnet-20240620-v1:0",
4848
"spring.ai.bedrock.converse.chat.options.temperature=0.5")
4949
.withConfiguration(AutoConfigurations.of(BedrockConverseProxyChatAutoConfiguration.class));

spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/bedrock/converse/BedrockConverseProxyChatPropertiesTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public void chatOptionsTest() {
3535

3636
new ApplicationContextRunner().withPropertyValues(
3737
// @formatter:off
38+
"spring.ai.bedrock.converse.chat.enabled=true",
3839
"spring.ai.bedrock.converse.chat.options.model=MODEL_XYZ",
3940

4041
"spring.ai.bedrock.converse.chat.options.max-tokens=123",
@@ -65,10 +66,10 @@ public void chatOptionsTest() {
6566
@Test
6667
public void chatCompletionDisabled() {
6768

68-
// It is enabled by default
69+
// It is disabled by default
6970
new ApplicationContextRunner()
7071
.withConfiguration(AutoConfigurations.of(BedrockConverseProxyChatAutoConfiguration.class))
71-
.run(context -> assertThat(context.getBeansOfType(BedrockConverseProxyChatProperties.class)).isNotEmpty());
72+
.run(context -> assertThat(context.getBeansOfType(BedrockConverseProxyChatProperties.class)).isEmpty());
7273

7374
// Explicitly enable the chat auto-configuration.
7475
new ApplicationContextRunner().withPropertyValues("spring.ai.bedrock.converse.chat.enabled=true")

spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/bedrock/converse/tool/FunctionCallWithFunctionBeanIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class FunctionCallWithFunctionBeanIT {
5555
void functionCallTest() {
5656

5757
this.contextRunner
58-
.withPropertyValues(
58+
.withPropertyValues("spring.ai.bedrock.converse.chat.enabled=true",
5959
"spring.ai.bedrock.converse.chat.options.model=" + "anthropic.claude-3-5-sonnet-20240620-v1:0")
6060
.run(context -> {
6161

@@ -84,7 +84,7 @@ void functionCallTest() {
8484
void functionStreamTest() {
8585

8686
this.contextRunner
87-
.withPropertyValues(
87+
.withPropertyValues("spring.ai.bedrock.converse.chat.enabled=true",
8888
"spring.ai.bedrock.converse.chat.options.model=" + "anthropic.claude-3-5-sonnet-20240620-v1:0")
8989
.run(context -> {
9090

0 commit comments

Comments
 (0)