From 4334f83179d00c23e1189ba651b05bff4ca40d75 Mon Sep 17 00:00:00 2001 From: Disaster <58838568+disaster1-tesk@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:49:26 +0800 Subject: [PATCH 1/2] :busts_in_silhouette: Add autoconfig module module and pom :busts_in_silhouette: Add autoconfig module update pom file :busts_in_silhouette: Update module name update autoconfig name :arrow_up: Update dependency change autoconfig name :busts_in_silhouette: Update module name name change --- pom.xml | 3 +- spring-ai-alibaba-autoconfig/pom.xml | 56 ++++ ...DashScopeAudioTranscriptionProperties.java | 0 .../dashscope/DashScopeAutoConfiguration.java | 41 +-- .../dashscope/DashScopeChatProperties.java | 0 .../DashScopeConnectionProperties.java | 0 .../DashScopeEmbeddingProperties.java | 1 - .../dashscope/DashScopeImageProperties.java | 1 - .../dashscope/DashScopeParentProperties.java | 0 .../dashscope/DashScopeRerankProperties.java | 0 .../DashScopeSpeechSynthesisProperties.java | 0 .../PromptTemplateAutoConfiguration.java | 5 +- .../cloud/ai/agent/DashScopeAgentIT.java | 2 +- ...DashScopeAudioTranscriptionProperties.java | 54 +++ .../dashscope/DashScopeAutoConfiguration.java | 313 ++++++++++++++++++ .../dashscope/DashScopeChatProperties.java | 85 +++++ .../DashScopeConnectionProperties.java | 52 +++ .../DashScopeEmbeddingProperties.java | 66 ++++ .../dashscope/DashScopeImageProperties.java | 76 +++++ .../dashscope/DashScopeParentProperties.java | 60 ++++ .../dashscope/DashScopeRerankProperties.java | 81 +++++ .../DashScopeSpeechSynthesisProperties.java | 55 +++ .../PromptTemplateAutoConfiguration.java | 42 +++ .../DashScopeAudioTranscriptionModelIT.java | 2 +- .../audio/DashScopeSpeechSynthesisIT.java | 2 +- .../chat/client/DashScopeChatClientIT.java | 2 +- .../ai/dashscope/embedding/EmbeddingIT.java | 2 +- spring-ai-alibaba-starter/pom.xml | 7 +- 28 files changed, 968 insertions(+), 40 deletions(-) create mode 100644 spring-ai-alibaba-autoconfig/pom.xml rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java (100%) rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java (87%) rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java (100%) rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java (100%) rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java (99%) rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java (99%) rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java (100%) rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java (100%) rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java (100%) rename {spring-ai-alibaba-core => spring-ai-alibaba-autoconfig}/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java (86%) create mode 100644 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeAudioTranscriptionProperties.java create mode 100644 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeAutoConfiguration.java create mode 100644 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeChatProperties.java create mode 100644 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeConnectionProperties.java create mode 100755 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeEmbeddingProperties.java create mode 100644 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeImageProperties.java create mode 100644 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeParentProperties.java create mode 100644 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeRerankProperties.java create mode 100644 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeSpeechSynthesisProperties.java create mode 100644 spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/prompt/PromptTemplateAutoConfiguration.java diff --git a/pom.xml b/pom.xml index 1cda2152..df1f5fc7 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,8 @@ spring-ai-alibaba-core spring-ai-alibaba-starter - + spring-ai-alibaba-autoconfig + 1.0.0-M3.2 diff --git a/spring-ai-alibaba-autoconfig/pom.xml b/spring-ai-alibaba-autoconfig/pom.xml new file mode 100644 index 00000000..60a46d2d --- /dev/null +++ b/spring-ai-alibaba-autoconfig/pom.xml @@ -0,0 +1,56 @@ + + + + + + 4.0.0 + + com.alibaba.cloud.ai + spring-ai-alibaba + ${revision} + ../pom.xml + + + spring-ai-alibaba-autoconfig + jar + + spring-ai-autoconfig + https://github.com/alibaba/spring-ai-alibaba + + https://github.com/alibaba/spring-ai-alibaba + git://github.com/alibaba/spring-ai-alibaba.git + git@github.com:alibaba/spring-ai-alibaba.git + + + + UTF-8 + + + + + com.alibaba.cloud.ai + spring-ai-alibaba-core + ${project.parent.version} + + + + org.springframework.boot + spring-boot-starter + + + diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java similarity index 100% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java similarity index 87% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java index 89865a2e..01ba2082 100644 --- a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java +++ b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java @@ -16,13 +16,9 @@ package com.alibaba.cloud.ai.autoconfigure.dashscope; -import com.alibaba.cloud.ai.dashscope.api.DashScopeAgentApi; -import com.alibaba.cloud.ai.dashscope.api.DashScopeApi; -import com.alibaba.cloud.ai.dashscope.api.DashScopeSpeechSynthesisApi; -import com.alibaba.cloud.ai.dashscope.api.DashScopeAudioTranscriptionApi; -import com.alibaba.cloud.ai.dashscope.api.DashScopeImageApi; -import com.alibaba.cloud.ai.dashscope.audio.DashScopeSpeechSynthesisModel; +import com.alibaba.cloud.ai.dashscope.api.*; import com.alibaba.cloud.ai.dashscope.audio.DashScopeAudioTranscriptionModel; +import com.alibaba.cloud.ai.dashscope.audio.DashScopeSpeechSynthesisModel; import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatModel; import com.alibaba.cloud.ai.dashscope.common.DashScopeApiConstants; import com.alibaba.cloud.ai.dashscope.embedding.DashScopeEmbeddingModel; @@ -121,8 +117,7 @@ public DashScopeApi dashscopeChatApi(DashScopeConnectionProperties commonPropert DashScopeChatProperties chatProperties, RestClient.Builder restClientBuilder, WebClient.Builder webClientBuilder, ResponseErrorHandler responseErrorHandler) { - DashScopeAutoConfiguration.ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, - chatProperties, "chat"); + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, chatProperties, "chat"); return new DashScopeApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), restClientBuilder, webClientBuilder, responseErrorHandler); @@ -147,8 +142,8 @@ public DashScopeEmbeddingModel dashscopeEmbeddingModel(DashScopeConnectionProper public DashScopeApi dashscopeEmbeddingApi(DashScopeConnectionProperties commonProperties, DashScopeEmbeddingProperties embeddingProperties, RestClient.Builder restClientBuilder, WebClient.Builder webClientBuilder, ResponseErrorHandler responseErrorHandler) { - DashScopeAutoConfiguration.ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, - embeddingProperties, "embedding"); + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, embeddingProperties, + "embedding"); return new DashScopeApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), restClientBuilder, webClientBuilder, responseErrorHandler); @@ -161,8 +156,8 @@ public DashScopeApi dashscopeEmbeddingApi(DashScopeConnectionProperties commonPr public DashScopeSpeechSynthesisApi dashScopeSpeechSynthesisApi(DashScopeConnectionProperties commonProperties, DashScopeSpeechSynthesisProperties speechSynthesisProperties) { - DashScopeAutoConfiguration.ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, - speechSynthesisProperties, "speechsynthesis"); + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, speechSynthesisProperties, + "speechsynthesis"); return new DashScopeSpeechSynthesisApi(resolved.apiKey()); } @@ -174,7 +169,7 @@ public DashScopeSpeechSynthesisApi dashScopeSpeechSynthesisApi(DashScopeConnecti public DashScopeAudioTranscriptionApi dashScopeAudioTranscriptionApi(DashScopeConnectionProperties commonProperties, DashScopeAudioTranscriptionProperties audioTranscriptionProperties) { - DashScopeAutoConfiguration.ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, audioTranscriptionProperties, "audiotranscription"); return new DashScopeAudioTranscriptionApi(resolved.apiKey()); @@ -188,8 +183,7 @@ public DashScopeAgentApi dashscopeAgentApi(DashScopeConnectionProperties commonP DashScopeChatProperties chatProperties, RestClient.Builder restClientBuilder, WebClient.Builder webClientBuilder, ResponseErrorHandler responseErrorHandler) { - DashScopeAutoConfiguration.ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, - chatProperties, "chat"); + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, chatProperties, "chat"); return new DashScopeAgentApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), restClientBuilder, webClientBuilder, responseErrorHandler); @@ -211,8 +205,7 @@ public DashScopeImageModel dashScopeImageModel(DashScopeConnectionProperties com WebClient.Builder webClientBuilder, RetryTemplate retryTemplate, ResponseErrorHandler responseErrorHandler) { - DashScopeAutoConfiguration.ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, - imageProperties, "image"); + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, imageProperties, "image"); var dashScopeImageApi = new DashScopeImageApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), restClientBuilder, webClientBuilder, responseErrorHandler); @@ -228,8 +221,8 @@ public DashScopeRerankModel dashscopeRerankModel(DashScopeConnectionProperties c DashScopeRerankProperties rerankProperties, RestClient.Builder restClientBuilder, WebClient.Builder webClientBuilder, RetryTemplate retryTemplate, ResponseErrorHandler responseErrorHandler) { - DashScopeAutoConfiguration.ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, - rerankProperties, "rerank"); + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, rerankProperties, + "rerank"); var dashscopeApi = new DashScopeApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), restClientBuilder, webClientBuilder, responseErrorHandler); @@ -244,8 +237,8 @@ public DashScopeRerankModel dashscopeRerankModel(DashScopeConnectionProperties c public DashScopeSpeechSynthesisModel dashScopeSpeechSynthesisModel(DashScopeConnectionProperties commonProperties, DashScopeSpeechSynthesisProperties speechSynthesisProperties, RetryTemplate retryTemplate) { - DashScopeAutoConfiguration.ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, - speechSynthesisProperties, "speechsynthesis"); + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, speechSynthesisProperties, + "speechsynthesis"); var dashScopeSpeechSynthesisApi = dashScopeSpeechSynthesisApi(commonProperties, speechSynthesisProperties); @@ -261,7 +254,7 @@ public DashScopeAudioTranscriptionModel dashScopeAudioTranscriptionModel( DashScopeConnectionProperties commonProperties, DashScopeAudioTranscriptionProperties audioTranscriptionProperties, RetryTemplate retryTemplate) { - DashScopeAutoConfiguration.ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, audioTranscriptionProperties, "audiotranscription"); var dashScopeSpeechSynthesisApi = dashScopeAudioTranscriptionApi(commonProperties, @@ -284,7 +277,7 @@ private record ResolvedConnectionProperties(String baseUrl, String apiKey, Strin MultiValueMap headers) { } - private static @NotNull DashScopeAutoConfiguration.ResolvedConnectionProperties resolveConnectionProperties( + private static @NotNull ResolvedConnectionProperties resolveConnectionProperties( DashScopeParentProperties commonProperties, DashScopeParentProperties modelProperties, String modelType) { String baseUrl = StringUtils.hasText(modelProperties.getBaseUrl()) ? modelProperties.getBaseUrl() @@ -313,7 +306,7 @@ private record ResolvedConnectionProperties(String baseUrl, String apiKey, Strin "DashScope API key must be set. Use the connection property: spring.ai.dashscope.api-key or spring.ai.dashscope." + modelType + ".api-key property."); - return new DashScopeAutoConfiguration.ResolvedConnectionProperties(baseUrl, apiKey, workspaceId, + return new ResolvedConnectionProperties(baseUrl, apiKey, workspaceId, CollectionUtils.toMultiValueMap(connectionHeaders)); } diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java similarity index 100% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java similarity index 100% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java similarity index 99% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java index d4ceb348..3174e6eb 100755 --- a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java +++ b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java @@ -16,7 +16,6 @@ package com.alibaba.cloud.ai.autoconfigure.dashscope; import com.alibaba.cloud.ai.dashscope.embedding.DashScopeEmbeddingOptions; - import org.springframework.ai.document.MetadataMode; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java similarity index 99% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java index 06697a6c..f65ad573 100644 --- a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java +++ b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java @@ -18,7 +18,6 @@ import com.alibaba.cloud.ai.dashscope.image.DashScopeImageOptions; import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesis; - import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.NestedConfigurationProperty; diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java similarity index 100% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java similarity index 100% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java similarity index 100% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java diff --git a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java similarity index 86% rename from spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java rename to spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java index 2ac3a837..9197f2ac 100644 --- a/spring-ai-alibaba-core/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java +++ b/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java @@ -30,10 +30,11 @@ public class PromptTemplateAutoConfiguration { + private final static String TEMPLATE_PREFIX = "spring.ai.nacos.prompt.template"; + @Bean @ConditionalOnMissingBean - @ConditionalOnProperty(prefix = "spring.ai.nacos.prompt.template", name = "enabled", havingValue = "true", - matchIfMissing = true) + @ConditionalOnProperty(prefix = TEMPLATE_PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true) public ConfigurablePromptTemplateFactory configurablePromptTemplateFactory() { return new ConfigurablePromptTemplateFactory(); } diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/agent/DashScopeAgentIT.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/agent/DashScopeAgentIT.java index fd0329ca..90466f81 100644 --- a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/agent/DashScopeAgentIT.java +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/agent/DashScopeAgentIT.java @@ -16,7 +16,7 @@ package com.alibaba.cloud.ai.agent; -import com.alibaba.cloud.ai.autoconfigure.dashscope.DashScopeAutoConfiguration; +import com.alibaba.cloud.ai.autoconfig.dashscope.DashScopeAutoConfiguration; import com.alibaba.cloud.ai.dashscope.agent.DashScopeAgent; import com.alibaba.cloud.ai.dashscope.agent.DashScopeAgentOptions; import com.alibaba.cloud.ai.dashscope.api.DashScopeAgentApi; diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeAudioTranscriptionProperties.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeAudioTranscriptionProperties.java new file mode 100644 index 00000000..4e382797 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeAudioTranscriptionProperties.java @@ -0,0 +1,54 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.cloud.ai.autoconfig.dashscope; + +import com.alibaba.cloud.ai.dashscope.audio.DashScopeAudioTranscriptionOptions; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +import static com.alibaba.cloud.ai.dashscope.common.DashScopeApiConstants.DEFAULT_BASE_URL; + +/** + * @author xYLiu + * @author yuluo + * @author kevinlin09 + */ + +@ConfigurationProperties(DashScopeAudioTranscriptionProperties.CONFIG_PREFIX) +public class DashScopeAudioTranscriptionProperties extends DashScopeParentProperties { + + /** + * Spring AI Alibaba configuration prefix. + */ + public static final String CONFIG_PREFIX = "spring.ai.dashscope.audio.transcription"; + + @NestedConfigurationProperty + private DashScopeAudioTranscriptionOptions options = DashScopeAudioTranscriptionOptions.builder().build(); + + public DashScopeAudioTranscriptionProperties() { + super.setBaseUrl(DEFAULT_BASE_URL); + } + + public DashScopeAudioTranscriptionOptions getOptions() { + return this.options; + } + + public void setOptions(DashScopeAudioTranscriptionOptions options) { + this.options = options; + } + +} diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeAutoConfiguration.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeAutoConfiguration.java new file mode 100644 index 00000000..00269e14 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeAutoConfiguration.java @@ -0,0 +1,313 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.cloud.ai.autoconfig.dashscope; + +import com.alibaba.cloud.ai.dashscope.api.*; +import com.alibaba.cloud.ai.dashscope.audio.DashScopeAudioTranscriptionModel; +import com.alibaba.cloud.ai.dashscope.audio.DashScopeSpeechSynthesisModel; +import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatModel; +import com.alibaba.cloud.ai.dashscope.common.DashScopeApiConstants; +import com.alibaba.cloud.ai.dashscope.embedding.DashScopeEmbeddingModel; +import com.alibaba.cloud.ai.dashscope.image.DashScopeImageModel; +import com.alibaba.cloud.ai.dashscope.rerank.DashScopeRerankModel; +import com.alibaba.dashscope.audio.asr.transcription.Transcription; +import com.alibaba.dashscope.audio.tts.SpeechSynthesizer; +import org.jetbrains.annotations.NotNull; +import org.springframework.ai.autoconfigure.retry.SpringAiRetryAutoConfiguration; +import org.springframework.ai.model.function.FunctionCallback; +import org.springframework.ai.model.function.FunctionCallbackContext; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.ImportAutoConfiguration; +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.autoconfigure.web.client.RestClientAutoConfiguration; +import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.web.client.ClientHttpRequestFactories; +import org.springframework.boot.web.client.ClientHttpRequestFactorySettings; +import org.springframework.boot.web.client.RestClientCustomizer; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Scope; +import org.springframework.retry.support.RetryTemplate; +import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; +import org.springframework.util.MultiValueMap; +import org.springframework.util.StringUtils; +import org.springframework.web.client.ResponseErrorHandler; +import org.springframework.web.client.RestClient; +import org.springframework.web.reactive.function.client.WebClient; + +import java.time.Duration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @author nuocheng.lxm + * @author yuluo + * @since 2024/8/16 11:45 + */ +@ConditionalOnClass(DashScopeApi.class) +@AutoConfiguration(after = { RestClientAutoConfiguration.class, WebClientAutoConfiguration.class, + SpringAiRetryAutoConfiguration.class }) +@EnableConfigurationProperties({ DashScopeConnectionProperties.class, DashScopeChatProperties.class, + DashScopeImageProperties.class, DashScopeSpeechSynthesisProperties.class, + DashScopeAudioTranscriptionProperties.class, DashScopeEmbeddingProperties.class, + DashScopeRerankProperties.class }) +@ImportAutoConfiguration(classes = { SpringAiRetryAutoConfiguration.class, RestClientAutoConfiguration.class, + WebClientAutoConfiguration.class }) +public class DashScopeAutoConfiguration { + + @Bean + @Scope("prototype") + @ConditionalOnMissingBean + public SpeechSynthesizer speechSynthesizer() { + return new SpeechSynthesizer(); + } + + @Bean + @ConditionalOnMissingBean + public Transcription transcription() { + return new Transcription(); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeChatProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true", + matchIfMissing = true) + public DashScopeChatModel dashscopeChatModel(DashScopeConnectionProperties commonProperties, + DashScopeChatProperties chatProperties, RestClient.Builder restClientBuilder, + WebClient.Builder webClientBuilder, List toolFunctionCallbacks, + FunctionCallbackContext functionCallbackContext, RetryTemplate retryTemplate, + ResponseErrorHandler responseErrorHandler) { + + if (!CollectionUtils.isEmpty(toolFunctionCallbacks)) { + chatProperties.getOptions().getFunctionCallbacks().addAll(toolFunctionCallbacks); + } + + var dashscopeApi = dashscopeChatApi(commonProperties, chatProperties, restClientBuilder, webClientBuilder, + responseErrorHandler); + + return new DashScopeChatModel(dashscopeApi, chatProperties.getOptions(), functionCallbackContext, + retryTemplate); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeEmbeddingProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true", + matchIfMissing = true) + public DashScopeApi dashscopeChatApi(DashScopeConnectionProperties commonProperties, + DashScopeChatProperties chatProperties, RestClient.Builder restClientBuilder, + WebClient.Builder webClientBuilder, ResponseErrorHandler responseErrorHandler) { + + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, chatProperties, "chat"); + + return new DashScopeApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), restClientBuilder, + webClientBuilder, responseErrorHandler); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeEmbeddingProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true", + matchIfMissing = true) + public DashScopeEmbeddingModel dashscopeEmbeddingModel(DashScopeConnectionProperties commonProperties, + DashScopeEmbeddingProperties embeddingProperties, RestClient.Builder restClientBuilder, + WebClient.Builder webClientBuilder, RetryTemplate retryTemplate, + ResponseErrorHandler responseErrorHandler) { + + var dashScopeApi = dashscopeEmbeddingApi(commonProperties, embeddingProperties, restClientBuilder, + webClientBuilder, responseErrorHandler); + + return new DashScopeEmbeddingModel(dashScopeApi, embeddingProperties.getMetadataMode(), + embeddingProperties.getOptions(), retryTemplate); + } + + public DashScopeApi dashscopeEmbeddingApi(DashScopeConnectionProperties commonProperties, + DashScopeEmbeddingProperties embeddingProperties, RestClient.Builder restClientBuilder, + WebClient.Builder webClientBuilder, ResponseErrorHandler responseErrorHandler) { + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, embeddingProperties, + "embedding"); + + return new DashScopeApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), restClientBuilder, + webClientBuilder, responseErrorHandler); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeSpeechSynthesisProperties.CONFIG_PREFIX, name = "enabled", + havingValue = "true", matchIfMissing = true) + public DashScopeSpeechSynthesisApi dashScopeSpeechSynthesisApi(DashScopeConnectionProperties commonProperties, + DashScopeSpeechSynthesisProperties speechSynthesisProperties) { + + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, speechSynthesisProperties, + "speechsynthesis"); + + return new DashScopeSpeechSynthesisApi(resolved.apiKey()); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeAudioTranscriptionProperties.CONFIG_PREFIX, name = "enabled", + havingValue = "true", matchIfMissing = true) + public DashScopeAudioTranscriptionApi dashScopeAudioTranscriptionApi(DashScopeConnectionProperties commonProperties, + DashScopeAudioTranscriptionProperties audioTranscriptionProperties) { + + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, + audioTranscriptionProperties, "audiotranscription"); + + return new DashScopeAudioTranscriptionApi(resolved.apiKey()); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeEmbeddingProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true", + matchIfMissing = true) + public DashScopeAgentApi dashscopeAgentApi(DashScopeConnectionProperties commonProperties, + DashScopeChatProperties chatProperties, RestClient.Builder restClientBuilder, + WebClient.Builder webClientBuilder, ResponseErrorHandler responseErrorHandler) { + + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, chatProperties, "chat"); + + return new DashScopeAgentApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), restClientBuilder, + webClientBuilder, responseErrorHandler); + } + + @Bean + public RestClientCustomizer restClientCustomizer(DashScopeConnectionProperties commonProperties) { + return restClientBuilder -> restClientBuilder + .requestFactory(ClientHttpRequestFactories.get(ClientHttpRequestFactorySettings.DEFAULTS + .withReadTimeout(Duration.ofSeconds(commonProperties.getReadTimeout())))); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeImageProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true", + matchIfMissing = true) + public DashScopeImageModel dashScopeImageModel(DashScopeConnectionProperties commonProperties, + DashScopeImageProperties imageProperties, RestClient.Builder restClientBuilder, + WebClient.Builder webClientBuilder, RetryTemplate retryTemplate, + ResponseErrorHandler responseErrorHandler) { + + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, imageProperties, "image"); + + var dashScopeImageApi = new DashScopeImageApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), + restClientBuilder, webClientBuilder, responseErrorHandler); + + return new DashScopeImageModel(dashScopeImageApi, imageProperties.getOptions(), retryTemplate); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeRerankProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true", + matchIfMissing = true) + public DashScopeRerankModel dashscopeRerankModel(DashScopeConnectionProperties commonProperties, + DashScopeRerankProperties rerankProperties, RestClient.Builder restClientBuilder, + WebClient.Builder webClientBuilder, RetryTemplate retryTemplate, + ResponseErrorHandler responseErrorHandler) { + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, rerankProperties, + "rerank"); + + var dashscopeApi = new DashScopeApi(resolved.baseUrl(), resolved.apiKey(), resolved.workspaceId(), + restClientBuilder, webClientBuilder, responseErrorHandler); + + return new DashScopeRerankModel(dashscopeApi, rerankProperties.getOptions(), retryTemplate); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeSpeechSynthesisProperties.CONFIG_PREFIX, name = "enabled", + havingValue = "true", matchIfMissing = true) + public DashScopeSpeechSynthesisModel dashScopeSpeechSynthesisModel(DashScopeConnectionProperties commonProperties, + DashScopeSpeechSynthesisProperties speechSynthesisProperties, RetryTemplate retryTemplate) { + + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, speechSynthesisProperties, + "speechsynthesis"); + + var dashScopeSpeechSynthesisApi = dashScopeSpeechSynthesisApi(commonProperties, speechSynthesisProperties); + + return new DashScopeSpeechSynthesisModel(dashScopeSpeechSynthesisApi, speechSynthesisProperties.getOptions(), + retryTemplate); + } + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = DashScopeAudioTranscriptionProperties.CONFIG_PREFIX, name = "enabled", + havingValue = "true", matchIfMissing = true) + public DashScopeAudioTranscriptionModel dashScopeAudioTranscriptionModel( + DashScopeConnectionProperties commonProperties, + DashScopeAudioTranscriptionProperties audioTranscriptionProperties, RetryTemplate retryTemplate) { + + ResolvedConnectionProperties resolved = resolveConnectionProperties(commonProperties, + audioTranscriptionProperties, "audiotranscription"); + + var dashScopeSpeechSynthesisApi = dashScopeAudioTranscriptionApi(commonProperties, + audioTranscriptionProperties); + + return new DashScopeAudioTranscriptionModel(dashScopeSpeechSynthesisApi, + audioTranscriptionProperties.getOptions(), retryTemplate); + } + + @Bean + @ConditionalOnMissingBean + public FunctionCallbackContext springAiFunctionManager(ApplicationContext context) { + + FunctionCallbackContext manager = new FunctionCallbackContext(); + manager.setApplicationContext(context); + return manager; + } + + private record ResolvedConnectionProperties(String baseUrl, String apiKey, String workspaceId, + MultiValueMap headers) { + } + + private static @NotNull ResolvedConnectionProperties resolveConnectionProperties( + DashScopeParentProperties commonProperties, DashScopeParentProperties modelProperties, String modelType) { + + String baseUrl = StringUtils.hasText(modelProperties.getBaseUrl()) ? modelProperties.getBaseUrl() + : commonProperties.getBaseUrl(); + String apiKey = StringUtils.hasText(modelProperties.getApiKey()) ? modelProperties.getApiKey() + : commonProperties.getApiKey(); + String workspaceId = StringUtils.hasText(modelProperties.getWorkspaceId()) ? modelProperties.getWorkspaceId() + : commonProperties.getWorkspaceId(); + + Map> connectionHeaders = new HashMap<>(); + if (StringUtils.hasText(workspaceId)) { + connectionHeaders.put("DashScope-Workspace", List.of(workspaceId)); + } + + // get apikey from system env. + if (Objects.isNull(apiKey)) { + if (Objects.nonNull(System.getenv(DashScopeApiConstants.DASHSCOPE_API_KEY))) { + apiKey = System.getenv(DashScopeApiConstants.DASHSCOPE_API_KEY); + } + } + + Assert.hasText(baseUrl, + "DashScope base URL must be set. Use the connection property: spring.ai.dashscope.base-url or spring.ai.dashscope." + + modelType + ".base-url property."); + Assert.hasText(apiKey, + "DashScope API key must be set. Use the connection property: spring.ai.dashscope.api-key or spring.ai.dashscope." + + modelType + ".api-key property."); + + return new ResolvedConnectionProperties(baseUrl, apiKey, workspaceId, + CollectionUtils.toMultiValueMap(connectionHeaders)); + } + +} diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeChatProperties.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeChatProperties.java new file mode 100644 index 00000000..dda0aeb3 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeChatProperties.java @@ -0,0 +1,85 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.cloud.ai.autoconfig.dashscope; + +import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions; +import com.alibaba.dashscope.aigc.generation.Generation; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +import static com.alibaba.cloud.ai.dashscope.common.DashScopeApiConstants.DEFAULT_BASE_URL; + +/** + * @author yuluo + * @author yuluo + * @since 2023.0.1.0 + */ + +@ConfigurationProperties(DashScopeChatProperties.CONFIG_PREFIX) +public class DashScopeChatProperties extends DashScopeParentProperties { + + /** + * Spring AI Alibaba configuration prefix. + */ + public static final String CONFIG_PREFIX = "spring.ai.dashscope.chat"; + + /** + * Default DashScope Chat model. + */ + public static final String DEFAULT_DEPLOYMENT_NAME = Generation.Models.QWEN_PLUS; + + /** + * Default temperature speed. + */ + private static final Double DEFAULT_TEMPERATURE = 0.8d; + + /** + * Enable Dashscope ai chat client. + */ + private boolean enabled = true; + + @NestedConfigurationProperty + private DashScopeChatOptions options = DashScopeChatOptions.builder() + .withModel(DEFAULT_DEPLOYMENT_NAME) + .withTemperature(DEFAULT_TEMPERATURE) + .build(); + + public DashScopeChatProperties() { + super.setBaseUrl(DEFAULT_BASE_URL); + } + + public DashScopeChatOptions getOptions() { + + return this.options; + } + + public void setOptions(DashScopeChatOptions options) { + + this.options = options; + } + + public boolean isEnabled() { + + return this.enabled; + } + + public void setEnabled(boolean enabled) { + + this.enabled = enabled; + } + +} diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeConnectionProperties.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeConnectionProperties.java new file mode 100644 index 00000000..6c1f9de1 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeConnectionProperties.java @@ -0,0 +1,52 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.cloud.ai.autoconfig.dashscope; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +import static com.alibaba.cloud.ai.dashscope.common.DashScopeApiConstants.DEFAULT_BASE_URL; +import static com.alibaba.cloud.ai.dashscope.common.DashScopeApiConstants.DEFAULT_READ_TIMEOUT; + +/** + * Spring AI Alibaba TongYi LLM connection properties. + * + * @author yuluo + * @author yuluo + * @since 2023.0.1.0 + */ + +@ConfigurationProperties(DashScopeConnectionProperties.CONFIG_PREFIX) +public class DashScopeConnectionProperties extends DashScopeParentProperties { + + public static final String CONFIG_PREFIX = "spring.ai.dashscope"; + + private Integer readTimeout; + + public DashScopeConnectionProperties() { + super.setBaseUrl(DEFAULT_BASE_URL); + readTimeout = DEFAULT_READ_TIMEOUT; + } + + public Integer getReadTimeout() { + return readTimeout; + } + + public void setReadTimeout(Integer readTimeout) { + this.readTimeout = readTimeout; + } + +} diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeEmbeddingProperties.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeEmbeddingProperties.java new file mode 100755 index 00000000..a1253793 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeEmbeddingProperties.java @@ -0,0 +1,66 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.cloud.ai.autoconfig.dashscope; + +import com.alibaba.cloud.ai.dashscope.embedding.DashScopeEmbeddingOptions; +import org.springframework.ai.document.MetadataMode; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +@ConfigurationProperties(DashScopeEmbeddingProperties.CONFIG_PREFIX) +public class DashScopeEmbeddingProperties extends DashScopeParentProperties { + + public static final String CONFIG_PREFIX = "spring.ai.dashscope.embedding"; + + public static final String DEFAULT_EMBEDDING_MODEL = "text-embedding-v1"; + + /** + * Enable Dashscope embedding client. + */ + private boolean enabled = true; + + private MetadataMode metadataMode = MetadataMode.EMBED; + + @NestedConfigurationProperty + private DashScopeEmbeddingOptions options = DashScopeEmbeddingOptions.builder() + .withModel(DEFAULT_EMBEDDING_MODEL) + .build(); + + public DashScopeEmbeddingOptions getOptions() { + return this.options; + } + + public void setOptions(DashScopeEmbeddingOptions options) { + this.options = options; + } + + public MetadataMode getMetadataMode() { + return this.metadataMode; + } + + public void setMetadataMode(MetadataMode metadataMode) { + this.metadataMode = metadataMode; + } + + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + +} diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeImageProperties.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeImageProperties.java new file mode 100644 index 00000000..054c2749 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeImageProperties.java @@ -0,0 +1,76 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.cloud.ai.autoconfig.dashscope; + +import com.alibaba.cloud.ai.dashscope.image.DashScopeImageOptions; +import com.alibaba.dashscope.aigc.imagesynthesis.ImageSynthesis; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * TongYi Image API properties. + * + * @author yuluo + * @author yuluo + * @since 2023.0.1.0 + */ + +@ConfigurationProperties(DashScopeImageProperties.CONFIG_PREFIX) +public class DashScopeImageProperties extends DashScopeParentProperties { + + /** + * Spring AI Alibaba configuration prefix. + */ + public static final String CONFIG_PREFIX = "spring.ai.dashscope.image"; + + /** + * Default DashScope Chat model. + */ + public static final String DEFAULT_IMAGES_MODEL_NAME = ImageSynthesis.Models.WANX_V1; + + /** + * Enable DashScope ai images client. + */ + private boolean enabled = true; + + @NestedConfigurationProperty + private DashScopeImageOptions options = DashScopeImageOptions.builder() + .withModel(DEFAULT_IMAGES_MODEL_NAME) + .withN(1) + .build(); + + public DashScopeImageOptions getOptions() { + + return this.options; + } + + public void setOptions(DashScopeImageOptions options) { + + this.options = options; + } + + public boolean isEnabled() { + + return this.enabled; + } + + public void setEnabled(boolean enabled) { + + this.enabled = enabled; + } + +} diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeParentProperties.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeParentProperties.java new file mode 100644 index 00000000..d8c18e67 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeParentProperties.java @@ -0,0 +1,60 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.cloud.ai.autoconfig.dashscope; + +class DashScopeParentProperties { + + private String apiKey; + + private String secretKey; + + private String baseUrl; + + private String workspaceId; + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getBaseUrl() { + return baseUrl; + } + + public void setBaseUrl(String baseUrl) { + this.baseUrl = baseUrl; + } + + public String getWorkspaceId() { + return workspaceId; + } + + public void setWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + } + +} diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeRerankProperties.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeRerankProperties.java new file mode 100644 index 00000000..4cbe0698 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeRerankProperties.java @@ -0,0 +1,81 @@ +/* +* Copyright 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. +* You may obtain a copy of the License at +* +* https://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package com.alibaba.cloud.ai.autoconfig.dashscope; + +import com.alibaba.cloud.ai.dashscope.rerank.DashScopeRerankOptions; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +/** + * Title DashScope rerank properties.
+ * Description DashScope rerank properties.
+ * + * @author yuanci.ytb + * @since 1.0.0-M2 + */ + +@ConfigurationProperties(DashScopeRerankProperties.CONFIG_PREFIX) +public class DashScopeRerankProperties extends DashScopeParentProperties { + + /** + * Spring AI Alibaba configuration prefix. + */ + public static final String CONFIG_PREFIX = "spring.ai.dashscope.rerank"; + + /** + * Default DashScope rerank model. + */ + public static final String DEFAULT_RERANK_MODEL = "gte-rerank"; + + /** + * Top n rerank results. + */ + private Integer topN = 5; + + /** + * If need to return original documents. + */ + private Boolean returnDocuments = false; + + @NestedConfigurationProperty + private DashScopeRerankOptions options = DashScopeRerankOptions.builder().withModel(DEFAULT_RERANK_MODEL).build(); + + public DashScopeRerankOptions getOptions() { + return this.options; + } + + public void setOptions(DashScopeRerankOptions options) { + this.options = options; + } + + public Integer getTopN() { + return topN; + } + + public void setTopN(Integer topN) { + this.topN = topN; + } + + public Boolean getReturnDocuments() { + return returnDocuments; + } + + public void setReturnDocuments(Boolean returnDocuments) { + this.returnDocuments = returnDocuments; + } + +} diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeSpeechSynthesisProperties.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeSpeechSynthesisProperties.java new file mode 100644 index 00000000..ad9168a2 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/dashscope/DashScopeSpeechSynthesisProperties.java @@ -0,0 +1,55 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.cloud.ai.autoconfig.dashscope; + +import com.alibaba.cloud.ai.dashscope.audio.DashScopeSpeechSynthesisOptions; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.NestedConfigurationProperty; + +import static com.alibaba.cloud.ai.dashscope.common.DashScopeApiConstants.DEFAULT_BASE_URL; + +/** + * @author kevinlin09 + */ + +@ConfigurationProperties(DashScopeSpeechSynthesisProperties.CONFIG_PREFIX) +public class DashScopeSpeechSynthesisProperties extends DashScopeParentProperties { + + /** + * Spring AI Alibaba configuration prefix. + */ + public static final String CONFIG_PREFIX = "spring.ai.dashscope.audio.synthesis"; + + @NestedConfigurationProperty + private DashScopeSpeechSynthesisOptions options = DashScopeSpeechSynthesisOptions.builder() + .withModel("cosyvoice-v1") + .withVoice("longhua") + .build(); + + public DashScopeSpeechSynthesisProperties() { + super.setBaseUrl(DEFAULT_BASE_URL); + } + + public DashScopeSpeechSynthesisOptions getOptions() { + return this.options; + } + + public void setOptions(DashScopeSpeechSynthesisOptions options) { + this.options = options; + } + +} diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/prompt/PromptTemplateAutoConfiguration.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/prompt/PromptTemplateAutoConfiguration.java new file mode 100644 index 00000000..57ee10a7 --- /dev/null +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/autoconfig/prompt/PromptTemplateAutoConfiguration.java @@ -0,0 +1,42 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.alibaba.cloud.ai.autoconfig.prompt; + +import com.alibaba.cloud.ai.prompt.ConfigurablePromptTemplateFactory; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; + +/** + * . + * + * @since 2024-09-20 + * @author KrakenZJC + **/ + +public class PromptTemplateAutoConfiguration { + + private final static String TEMPLATE_PREFIX = "spring.ai.nacos.prompt.template"; + + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = TEMPLATE_PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true) + public ConfigurablePromptTemplateFactory configurablePromptTemplateFactory() { + return new ConfigurablePromptTemplateFactory(); + } + +} \ No newline at end of file diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/audio/DashScopeAudioTranscriptionModelIT.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/audio/DashScopeAudioTranscriptionModelIT.java index e13191dc..ef8fdd72 100644 --- a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/audio/DashScopeAudioTranscriptionModelIT.java +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/audio/DashScopeAudioTranscriptionModelIT.java @@ -16,7 +16,7 @@ package com.alibaba.cloud.ai.dashscope.audio; -import com.alibaba.cloud.ai.autoconfigure.dashscope.DashScopeAutoConfiguration; +import com.alibaba.cloud.ai.autoconfig.dashscope.DashScopeAutoConfiguration; import com.alibaba.cloud.ai.dashscope.api.DashScopeAudioTranscriptionApi; import com.alibaba.cloud.ai.dashscope.common.DashScopeException; import org.springframework.ai.audio.transcription.AudioTranscriptionPrompt; diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/audio/DashScopeSpeechSynthesisIT.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/audio/DashScopeSpeechSynthesisIT.java index 3c954a57..2dca8fdc 100644 --- a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/audio/DashScopeSpeechSynthesisIT.java +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/audio/DashScopeSpeechSynthesisIT.java @@ -16,7 +16,7 @@ package com.alibaba.cloud.ai.dashscope.audio; -import com.alibaba.cloud.ai.autoconfigure.dashscope.DashScopeAutoConfiguration; +import com.alibaba.cloud.ai.autoconfig.dashscope.DashScopeAutoConfiguration; import com.alibaba.cloud.ai.dashscope.audio.synthesis.SpeechSynthesisPrompt; import com.alibaba.cloud.ai.dashscope.audio.synthesis.SpeechSynthesisResponse; diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/chat/client/DashScopeChatClientIT.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/chat/client/DashScopeChatClientIT.java index d718cb05..d0065561 100644 --- a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/chat/client/DashScopeChatClientIT.java +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/chat/client/DashScopeChatClientIT.java @@ -18,7 +18,7 @@ import com.alibaba.cloud.ai.advisor.DocumentRetrievalAdvisor; import com.alibaba.cloud.ai.advisor.RetrievalRerankAdvisor; -import com.alibaba.cloud.ai.autoconfigure.dashscope.DashScopeAutoConfiguration; +import com.alibaba.cloud.ai.autoconfig.dashscope.DashScopeAutoConfiguration; import com.alibaba.cloud.ai.dashscope.api.DashScopeApi; import com.alibaba.cloud.ai.dashscope.api.DashScopeApi.ChatCompletionFinishReason; import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions; diff --git a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/embedding/EmbeddingIT.java b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/embedding/EmbeddingIT.java index 10ade5f4..d4b2956e 100755 --- a/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/embedding/EmbeddingIT.java +++ b/spring-ai-alibaba-core/src/test/java/com/alibaba/cloud/ai/dashscope/embedding/EmbeddingIT.java @@ -2,7 +2,7 @@ import java.util.List; -import com.alibaba.cloud.ai.autoconfigure.dashscope.DashScopeAutoConfiguration; +import com.alibaba.cloud.ai.autoconfig.dashscope.DashScopeAutoConfiguration; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/spring-ai-alibaba-starter/pom.xml b/spring-ai-alibaba-starter/pom.xml index e87ef7e9..305bf5e1 100644 --- a/spring-ai-alibaba-starter/pom.xml +++ b/spring-ai-alibaba-starter/pom.xml @@ -39,14 +39,9 @@ - - org.springframework.boot - spring-boot-starter - - com.alibaba.cloud.ai - spring-ai-alibaba-core + spring-ai-alibaba-autoconfig ${project.parent.version} From f3118406eb471649dd8376689358d94bad59ee4e Mon Sep 17 00:00:00 2001 From: Disaster <58838568+disaster1-tesk@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:32:51 +0800 Subject: [PATCH 2/2] :busts_in_silhouette: Changing the module Name spring-ai-alibaba-autoconfig -> spring-ai-alibaba-autoconfigure --- pom.xml | 2 +- .../pom.xml | 2 +- .../dashscope/DashScopeAudioTranscriptionProperties.java | 0 .../ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java | 0 .../ai/autoconfigure/dashscope/DashScopeChatProperties.java | 0 .../autoconfigure/dashscope/DashScopeConnectionProperties.java | 0 .../autoconfigure/dashscope/DashScopeEmbeddingProperties.java | 0 .../ai/autoconfigure/dashscope/DashScopeImageProperties.java | 0 .../ai/autoconfigure/dashscope/DashScopeParentProperties.java | 0 .../ai/autoconfigure/dashscope/DashScopeRerankProperties.java | 0 .../dashscope/DashScopeSpeechSynthesisProperties.java | 0 .../autoconfigure/prompt/PromptTemplateAutoConfiguration.java | 0 spring-ai-alibaba-starter/pom.xml | 2 +- 13 files changed, 3 insertions(+), 3 deletions(-) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/pom.xml (97%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java (100%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java (100%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java (100%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java (100%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java (100%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java (100%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java (100%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java (100%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java (100%) rename {spring-ai-alibaba-autoconfig => spring-ai-alibaba-autoconfigure}/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java (100%) diff --git a/pom.xml b/pom.xml index df1f5fc7..1ae9e9cf 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ spring-ai-alibaba-core spring-ai-alibaba-starter - spring-ai-alibaba-autoconfig + spring-ai-alibaba-autoconfigure diff --git a/spring-ai-alibaba-autoconfig/pom.xml b/spring-ai-alibaba-autoconfigure/pom.xml similarity index 97% rename from spring-ai-alibaba-autoconfig/pom.xml rename to spring-ai-alibaba-autoconfigure/pom.xml index 60a46d2d..bae2d983 100644 --- a/spring-ai-alibaba-autoconfig/pom.xml +++ b/spring-ai-alibaba-autoconfigure/pom.xml @@ -26,7 +26,7 @@ ../pom.xml - spring-ai-alibaba-autoconfig + spring-ai-alibaba-autoconfigure jar spring-ai-autoconfig diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAudioTranscriptionProperties.java diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeAutoConfiguration.java diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeChatProperties.java diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeConnectionProperties.java diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeEmbeddingProperties.java diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeImageProperties.java diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeParentProperties.java diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeRerankProperties.java diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/dashscope/DashScopeSpeechSynthesisProperties.java diff --git a/spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java b/spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java similarity index 100% rename from spring-ai-alibaba-autoconfig/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java rename to spring-ai-alibaba-autoconfigure/src/main/java/com/alibaba/cloud/ai/autoconfigure/prompt/PromptTemplateAutoConfiguration.java diff --git a/spring-ai-alibaba-starter/pom.xml b/spring-ai-alibaba-starter/pom.xml index 305bf5e1..deba3cb0 100644 --- a/spring-ai-alibaba-starter/pom.xml +++ b/spring-ai-alibaba-starter/pom.xml @@ -41,7 +41,7 @@ com.alibaba.cloud.ai - spring-ai-alibaba-autoconfig + spring-ai-alibaba-autoconfigure ${project.parent.version}