Skip to content

Commit 0b364b3

Browse files
committed
merge origin main to refresh code
Signed-off-by: lambochen <[email protected]>
2 parents 80c2e26 + f391ff2 commit 0b364b3

File tree

171 files changed

+8909
-483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+8909
-483
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: CI/CD build
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches:
6+
- main
7+
- '*.*.x'
68

79
jobs:
810
build:

auto-configurations/models/spring-ai-autoconfigure-model-azure-openai/src/test/java/org/springframework/ai/model/azure/openai/autoconfigure/tool/FunctionCallWithFunctionBeanIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class FunctionCallWithFunctionBeanIT {
5050
// @formatter:off
5151
"spring.ai.azure.openai.api-key=" + System.getenv("AZURE_OPENAI_API_KEY"),
5252
"spring.ai.azure.openai.endpoint=" + System.getenv("AZURE_OPENAI_ENDPOINT"))
53-
// @formatter:onn
53+
// @formatter:on
5454
.withConfiguration(AutoConfigurations.of(AzureOpenAiChatAutoConfiguration.class))
5555
.withUserConfiguration(Config.class);
5656

auto-configurations/models/spring-ai-autoconfigure-model-azure-openai/src/test/java/org/springframework/ai/model/azure/openai/autoconfigure/tool/FunctionCallWithFunctionWrapperIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class FunctionCallWithFunctionWrapperIT {
4848
// @formatter:off
4949
"spring.ai.azure.openai.api-key=" + System.getenv("AZURE_OPENAI_API_KEY"),
5050
"spring.ai.azure.openai.endpoint=" + System.getenv("AZURE_OPENAI_ENDPOINT"))
51-
// @formatter:onn
51+
// @formatter:on
5252
.withConfiguration(AutoConfigurations.of(AzureOpenAiChatAutoConfiguration.class))
5353
.withUserConfiguration(Config.class);
5454

auto-configurations/models/spring-ai-autoconfigure-model-azure-openai/src/test/java/org/springframework/ai/model/azure/openai/autoconfigure/tool/FunctionCallWithPromptFunctionIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class FunctionCallWithPromptFunctionIT {
4545
// @formatter:off
4646
"spring.ai.azure.openai.api-key=" + System.getenv("AZURE_OPENAI_API_KEY"),
4747
"spring.ai.azure.openai.endpoint=" + System.getenv("AZURE_OPENAI_ENDPOINT"))
48-
// @formatter:onn
48+
// @formatter:on
4949
.withConfiguration(AutoConfigurations.of(AzureOpenAiChatAutoConfiguration.class));
5050

5151
@Test
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>org.springframework.ai</groupId>
8+
<artifactId>spring-ai-parent</artifactId>
9+
<version>1.1.0-SNAPSHOT</version>
10+
<relativePath>../../../pom.xml</relativePath>
11+
</parent>
12+
<artifactId>spring-ai-autoconfigure-model-elevenlabs</artifactId>
13+
<packaging>jar</packaging>
14+
<name>Spring AI ElevenLabs Auto Configuration</name>
15+
<description>Spring AI ElevenLabs Auto Configuration</description>
16+
<url>https://github.com/spring-projects/spring-ai</url>
17+
18+
<scm>
19+
<url>https://github.com/spring-projects/spring-ai</url>
20+
<connection>git://github.com/spring-projects/spring-ai.git</connection>
21+
<developerConnection>[email protected]:spring-projects/spring-ai.git</developerConnection>
22+
</scm>
23+
24+
25+
<dependencies>
26+
27+
<!-- Spring AI dependencies -->
28+
29+
<dependency>
30+
<groupId>org.springframework.ai</groupId>
31+
<artifactId>spring-ai-elevenlabs</artifactId>
32+
<version>${project.parent.version}</version>
33+
<optional>true</optional>
34+
</dependency>
35+
36+
<!-- Spring AI auto configurations -->
37+
38+
<dependency>
39+
<groupId>org.springframework.ai</groupId>
40+
<artifactId>spring-ai-autoconfigure-model-tool</artifactId>
41+
<version>${project.parent.version}</version>
42+
</dependency>
43+
44+
<dependency>
45+
<groupId>org.springframework.ai</groupId>
46+
<artifactId>spring-ai-autoconfigure-retry</artifactId>
47+
<version>${project.parent.version}</version>
48+
</dependency>
49+
50+
<!-- Boot dependencies -->
51+
<dependency>
52+
<groupId>org.springframework.boot</groupId>
53+
<artifactId>spring-boot-starter</artifactId>
54+
<optional>true</optional>
55+
</dependency>
56+
57+
<dependency>
58+
<groupId>org.springframework.boot</groupId>
59+
<artifactId>spring-boot-configuration-processor</artifactId>
60+
<optional>true</optional>
61+
</dependency>
62+
63+
<dependency>
64+
<groupId>org.springframework.boot</groupId>
65+
<artifactId>spring-boot-autoconfigure-processor</artifactId>
66+
<optional>true</optional>
67+
</dependency>
68+
69+
<!-- Test dependencies -->
70+
<dependency>
71+
<groupId>org.springframework.ai</groupId>
72+
<artifactId>spring-ai-test</artifactId>
73+
<version>${project.parent.version}</version>
74+
<scope>test</scope>
75+
</dependency>
76+
77+
<dependency>
78+
<groupId>org.springframework.boot</groupId>
79+
<artifactId>spring-boot-starter-test</artifactId>
80+
<scope>test</scope>
81+
</dependency>
82+
83+
<dependency>
84+
<groupId>org.mockito</groupId>
85+
<artifactId>mockito-core</artifactId>
86+
<scope>test</scope>
87+
</dependency>
88+
</dependencies>
89+
90+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright 2025-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.ai.model.elevenlabs.autoconfigure;
18+
19+
import org.springframework.ai.elevenlabs.ElevenLabsTextToSpeechModel;
20+
import org.springframework.ai.elevenlabs.api.ElevenLabsApi;
21+
import org.springframework.ai.retry.autoconfigure.SpringAiRetryAutoConfiguration;
22+
import org.springframework.beans.factory.ObjectProvider;
23+
import org.springframework.boot.autoconfigure.AutoConfiguration;
24+
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
25+
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
26+
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
27+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
28+
import org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration;
29+
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration;
30+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
31+
import org.springframework.context.annotation.Bean;
32+
import org.springframework.retry.support.RetryTemplate;
33+
import org.springframework.web.client.ResponseErrorHandler;
34+
import org.springframework.web.client.RestClient;
35+
import org.springframework.web.reactive.function.client.WebClient;
36+
37+
/**
38+
* {@link AutoConfiguration Auto-configuration} for ElevenLabs.
39+
*
40+
* @author Alexandros Pappas
41+
*/
42+
@AutoConfiguration(after = { RestClientAutoConfiguration.class, SpringAiRetryAutoConfiguration.class,
43+
WebClientAutoConfiguration.class })
44+
@ConditionalOnClass(ElevenLabsApi.class)
45+
@EnableConfigurationProperties({ ElevenLabsSpeechProperties.class, ElevenLabsConnectionProperties.class })
46+
@ConditionalOnProperty(prefix = ElevenLabsSpeechProperties.CONFIG_PREFIX, name = "enabled", havingValue = "true",
47+
matchIfMissing = true)
48+
@ImportAutoConfiguration(classes = { SpringAiRetryAutoConfiguration.class, RestClientAutoConfiguration.class,
49+
WebClientAutoConfiguration.class })
50+
public class ElevenLabsAutoConfiguration {
51+
52+
@Bean
53+
@ConditionalOnMissingBean
54+
public ElevenLabsApi elevenLabsApi(ElevenLabsConnectionProperties connectionProperties,
55+
ObjectProvider<RestClient.Builder> restClientBuilderProvider,
56+
ObjectProvider<WebClient.Builder> webClientBuilderProvider, ResponseErrorHandler responseErrorHandler) {
57+
58+
return ElevenLabsApi.builder()
59+
.baseUrl(connectionProperties.getBaseUrl())
60+
.apiKey(connectionProperties.getApiKey())
61+
.restClientBuilder(restClientBuilderProvider.getIfAvailable(RestClient::builder))
62+
.webClientBuilder(webClientBuilderProvider.getIfAvailable(WebClient::builder))
63+
.responseErrorHandler(responseErrorHandler)
64+
.build();
65+
}
66+
67+
@Bean
68+
@ConditionalOnMissingBean
69+
public ElevenLabsTextToSpeechModel elevenLabsSpeechModel(ElevenLabsApi elevenLabsApi,
70+
ElevenLabsSpeechProperties speechProperties, RetryTemplate retryTemplate) {
71+
72+
return ElevenLabsTextToSpeechModel.builder()
73+
.elevenLabsApi(elevenLabsApi)
74+
.defaultOptions(speechProperties.getOptions())
75+
.retryTemplate(retryTemplate)
76+
.build();
77+
}
78+
79+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2025-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.ai.model.elevenlabs.autoconfigure;
18+
19+
import org.springframework.ai.elevenlabs.api.ElevenLabsApi;
20+
import org.springframework.boot.context.properties.ConfigurationProperties;
21+
22+
/**
23+
* Configuration properties for the ElevenLabs API connection.
24+
*
25+
* @author Alexandros Pappas
26+
*/
27+
@ConfigurationProperties(ElevenLabsConnectionProperties.CONFIG_PREFIX)
28+
public class ElevenLabsConnectionProperties {
29+
30+
public static final String CONFIG_PREFIX = "spring.ai.elevenlabs";
31+
32+
/**
33+
* ElevenLabs API access key.
34+
*/
35+
private String apiKey;
36+
37+
/**
38+
* ElevenLabs API base URL.
39+
*/
40+
private String baseUrl = ElevenLabsApi.DEFAULT_BASE_URL;
41+
42+
public String getApiKey() {
43+
return this.apiKey;
44+
}
45+
46+
public void setApiKey(String apiKey) {
47+
this.apiKey = apiKey;
48+
}
49+
50+
public String getBaseUrl() {
51+
return this.baseUrl;
52+
}
53+
54+
public void setBaseUrl(String baseUrl) {
55+
this.baseUrl = baseUrl;
56+
}
57+
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright 2025-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.ai.model.elevenlabs.autoconfigure;
18+
19+
import org.springframework.ai.elevenlabs.ElevenLabsTextToSpeechOptions;
20+
import org.springframework.ai.elevenlabs.api.ElevenLabsApi;
21+
import org.springframework.boot.context.properties.ConfigurationProperties;
22+
import org.springframework.boot.context.properties.NestedConfigurationProperty;
23+
24+
/**
25+
* Configuration properties for the ElevenLabs Text-to-Speech API.
26+
*
27+
* @author Alexandros Pappas
28+
*/
29+
@ConfigurationProperties(ElevenLabsSpeechProperties.CONFIG_PREFIX)
30+
public class ElevenLabsSpeechProperties {
31+
32+
public static final String CONFIG_PREFIX = "spring.ai.elevenlabs.tts";
33+
34+
public static final String DEFAULT_MODEL_ID = "eleven_turbo_v2_5";
35+
36+
private static final String DEFAULT_VOICE_ID = "9BWtsMINqrJLrRacOk9x";
37+
38+
private static final ElevenLabsApi.OutputFormat DEFAULT_OUTPUT_FORMAT = ElevenLabsApi.OutputFormat.MP3_22050_32;
39+
40+
/**
41+
* Enable ElevenLabs speech model.
42+
*/
43+
private boolean enabled = true;
44+
45+
@NestedConfigurationProperty
46+
private ElevenLabsTextToSpeechOptions options = ElevenLabsTextToSpeechOptions.builder()
47+
.modelId(DEFAULT_MODEL_ID)
48+
.voiceId(DEFAULT_VOICE_ID)
49+
.outputFormat(DEFAULT_OUTPUT_FORMAT.getValue())
50+
.build();
51+
52+
public ElevenLabsTextToSpeechOptions getOptions() {
53+
return this.options;
54+
}
55+
56+
public void setOptions(ElevenLabsTextToSpeechOptions options) {
57+
this.options = options;
58+
}
59+
60+
public boolean isEnabled() {
61+
return this.enabled;
62+
}
63+
64+
public void setEnabled(boolean enabled) {
65+
this.enabled = enabled;
66+
}
67+
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright 2025-2025 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
org.springframework.ai.model.elevenlabs.autoconfigure.elevenlabsChatAutoConfiguration

0 commit comments

Comments
 (0)