Skip to content

Commit 462b769

Browse files
authored
Azure OpenAI: prepare for 1.0 (#132)
## Issue This is a part of langchain4j/langchain4j#3155 ## Change Removed `AzureOpenAiTokenCountEstimator` bean auto-configured by default. Please configure it yourself and explicitly specify the model name. ## General checklist - [ ] There are no breaking changes - [ ] I have added unit and/or integration tests for my change - [ ] The tests cover both positive and negative cases - [X] I have manually run all the unit and integration tests in the module I have added/changed, and they are all green - [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs) - [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features)
1 parent 51f1bec commit 462b769

File tree

1 file changed

+4
-10
lines changed
  • langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring

1 file changed

+4
-10
lines changed

langchain4j-azure-open-ai-spring-boot-starter/src/main/java/dev/langchain4j/azure/openai/spring/AutoConfig.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import dev.langchain4j.model.chat.listener.ChatModelListener;
77
import org.springframework.beans.factory.ObjectProvider;
88
import org.springframework.boot.autoconfigure.AutoConfiguration;
9-
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
109
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
1110
import org.springframework.boot.context.properties.EnableConfigurationProperties;
1211
import org.springframework.context.annotation.Bean;
@@ -53,9 +52,9 @@ AzureOpenAiChatModel openAiChatModel(Properties properties, ObjectProvider<ChatM
5352
.proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration()))
5453
.logRequestsAndResponses(chatModelProperties.logRequestsAndResponses() != null && chatModelProperties.logRequestsAndResponses())
5554
.userAgentSuffix(chatModelProperties.userAgentSuffix())
55+
.listeners(listeners.orderedStream().toList())
5656
.customHeaders(chatModelProperties.customHeaders())
57-
.supportedCapabilities(chatModelProperties.supportedCapabilities())
58-
.listeners(listeners.orderedStream().toList());
57+
.supportedCapabilities(chatModelProperties.supportedCapabilities());
5958
if (chatModelProperties.nonAzureApiKey() != null) {
6059
builder.nonAzureApiKey(chatModelProperties.nonAzureApiKey());
6160
}
@@ -98,8 +97,9 @@ AzureOpenAiStreamingChatModel openAiStreamingChatModel(Properties properties,
9897
.proxyOptions(ProxyOptions.fromConfiguration(Configuration.getGlobalConfiguration()))
9998
.logRequestsAndResponses(chatModelProperties.logRequestsAndResponses() != null && chatModelProperties.logRequestsAndResponses())
10099
.userAgentSuffix(chatModelProperties.userAgentSuffix())
100+
.listeners(listeners.orderedStream().toList())
101101
.customHeaders(chatModelProperties.customHeaders())
102-
.listeners(listeners.orderedStream().toList());
102+
.supportedCapabilities(chatModelProperties.supportedCapabilities());
103103
if (chatModelProperties.nonAzureApiKey() != null) {
104104
builder.nonAzureApiKey(chatModelProperties.nonAzureApiKey());
105105
}
@@ -173,10 +173,4 @@ AzureOpenAiImageModel openAiImageModel(Properties properties) {
173173
}
174174
return builder.build();
175175
}
176-
177-
@Bean
178-
@ConditionalOnMissingBean
179-
AzureOpenAiTokenCountEstimator azureOpenAiTokenCountEstimator() {
180-
return new AzureOpenAiTokenCountEstimator();
181-
}
182176
}

0 commit comments

Comments
 (0)