Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 - 2024 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,6 +43,7 @@

/**
* @author Piotr Olaszewski
* @author Soby Chacko
*/
@AutoConfiguration
@ConditionalOnClass({ OpenAIClientBuilder.class, AzureOpenAiChatModel.class })
Expand Down Expand Up @@ -95,6 +96,7 @@ public OpenAIClient openAIClientWithTokenCredential(AzureOpenAiConnectionPropert
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = AzureOpenAiChatProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
matchIfMissing = true)
public AzureOpenAiChatModel azureOpenAiChatModel(OpenAIClient openAIClient,
Expand All @@ -109,6 +111,7 @@ public AzureOpenAiChatModel azureOpenAiChatModel(OpenAIClient openAIClient,
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = AzureOpenAiEmbeddingProperties.CONFIG_PREFIX, name = "enabled",
havingValue = "true", matchIfMissing = true)
public AzureOpenAiEmbeddingModel azureOpenAiEmbeddingModel(OpenAIClient openAIClient,
Expand All @@ -126,6 +129,7 @@ public FunctionCallbackContext springAiFunctionManager(ApplicationContext contex
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = AzureOpenAiImageOptionsProperties.CONFIG_PREFIX, name = "enabled",
havingValue = "true", matchIfMissing = true)
public AzureOpenAiImageModel azureOpenAiImageClient(OpenAIClient openAIClient,
Expand All @@ -135,6 +139,7 @@ public AzureOpenAiImageModel azureOpenAiImageClient(OpenAIClient openAIClient,
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = AzureOpenAiAudioTranscriptionProperties.CONFIG_PREFIX, name = "enabled",
havingValue = "true", matchIfMissing = true)
public AzureOpenAiAudioTranscriptionModel azureOpenAiAudioTranscriptionModel(OpenAIClient openAIClient,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 - 2024 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -58,6 +58,7 @@ public AnthropicChatBedrockApi anthropicApi(AwsCredentialsProvider credentialsPr
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(AnthropicChatBedrockApi.class)
public BedrockAnthropicChatModel anthropicChatModel(AnthropicChatBedrockApi anthropicApi,
BedrockAnthropicChatProperties properties) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 - 2024 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -58,6 +58,7 @@ public Anthropic3ChatBedrockApi anthropic3Api(AwsCredentialsProvider credentials
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(Anthropic3ChatBedrockApi.class)
public BedrockAnthropic3ChatModel anthropic3ChatModel(Anthropic3ChatBedrockApi anthropicApi,
BedrockAnthropic3ChatProperties properties) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 - 2024 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,6 +56,7 @@ public CohereChatBedrockApi cohereChatApi(AwsCredentialsProvider credentialsProv
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(CohereChatBedrockApi.class)
public BedrockCohereChatModel cohereChatModel(CohereChatBedrockApi cohereChatApi,
BedrockCohereChatProperties properties) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 - 2024 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 - 2024 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -58,6 +58,7 @@ public Ai21Jurassic2ChatBedrockApi ai21Jurassic2ChatBedrockApi(AwsCredentialsPro
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(Ai21Jurassic2ChatBedrockApi.class)
public BedrockAi21Jurassic2ChatModel jurassic2ChatModel(Ai21Jurassic2ChatBedrockApi ai21Jurassic2ChatBedrockApi,
BedrockAi21Jurassic2ChatProperties properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public LlamaChatBedrockApi llamaApi(AwsCredentialsProvider credentialsProvider,
}

@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(LlamaChatBedrockApi.class)
public BedrockLlamaChatModel llamaChatModel(LlamaChatBedrockApi llamaApi, BedrockLlamaChatProperties properties) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 - 2024 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,12 +21,14 @@
import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.vertexai.VertexAI;

import org.springframework.ai.autoconfigure.azure.openai.AzureOpenAiChatProperties;
import org.springframework.ai.model.function.FunctionCallback;
import org.springframework.ai.model.function.FunctionCallbackContext;
import org.springframework.ai.model.function.FunctionCallbackWrapper.Builder.SchemaType;
import org.springframework.ai.vertexai.gemini.VertexAiGeminiChatModel;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
Expand All @@ -38,6 +40,7 @@
* Auto-configuration for Vertex AI Gemini Chat.
*
* @author Christian Tzolov
* @author Soby Chacko
* @since 0.8.0
*/
@ConditionalOnClass({ VertexAI.class, VertexAiGeminiChatModel.class })
Expand Down Expand Up @@ -74,6 +77,8 @@ public VertexAI vertexAi(VertexAiGeminiConnectionProperties connectionProperties

@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = VertexAiGeminiChatProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
matchIfMissing = true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because, currently, we are using a single boot starter for all Bedrock providers, the Bedrock models should be disabled by default.

public VertexAiGeminiChatModel vertexAiGeminiChat(VertexAI vertexAi, VertexAiGeminiChatProperties chatProperties,
List<FunctionCallback> toolFunctionCallbacks, ApplicationContext context) {

Expand Down