Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix chat mode unit test #37

Merged
merged 1 commit into from
Sep 29, 2024
Merged
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
Expand Up @@ -23,6 +23,7 @@
import java.util.Objects;

import com.alibaba.cloud.ai.dashscope.api.DashScopeAgentApi;
import com.alibaba.cloud.ai.dashscope.api.DashScopeAudioApi;
import com.alibaba.cloud.ai.dashscope.api.DashScopeImageApi;
import com.alibaba.cloud.ai.dashscope.embedding.DashScopeEmbeddingModel;
import com.alibaba.cloud.ai.dashscope.api.DashScopeApi;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.alibaba.cloud.ai.dashscope;

import com.alibaba.cloud.ai.dashscope.api.DashScopeApi;
import com.alibaba.cloud.ai.dashscope.api.DashScopeAudioApi;
import com.alibaba.cloud.ai.dashscope.api.DashScopeImageApi;
import com.alibaba.cloud.ai.dashscope.audio.DashScopeAudioSpeechModelOpenAPI;
import com.alibaba.cloud.ai.dashscope.audio.DashScopeAudioSpeechOptions;
Expand Down Expand Up @@ -36,6 +37,11 @@ public DashScopeApi dashscopeApi() {
return newDashScopeApi(getApiKey());
}

@Bean
public DashScopeAudioApi dashScopeAudioApi() {
return newDashScopeAudioApi(getApiKey());
}

@Bean
public DashScopeApi dashscopeChatApi() {
return newDashScopeChatApi(getApiKey());
Expand All @@ -49,6 +55,10 @@ private DashScopeApi newDashScopeApi(String apiKey) {
return new DashScopeApi(apiKey);
}

private DashScopeAudioApi newDashScopeAudioApi(String apiKey) {
return new DashScopeAudioApi(apiKey);
}

private DashScopeImageApi newDashScopeImageApi(String apiKey) {
return new DashScopeImageApi(apiKey);
}
Expand Down Expand Up @@ -79,14 +89,16 @@ public DashScopeImageModel dashscopeImageModel(DashScopeImageApi dashscopeImageA
}

@Bean
public DashScopeAudioSpeechModelOpenAPI dashscopeAudioSpeechModel(SpeechSynthesizer speechSynthesizer) {
return new DashScopeAudioSpeechModelOpenAPI(null,
public DashScopeAudioSpeechModelOpenAPI dashscopeAudioSpeechModel(DashScopeAudioApi dashScopeAudioApi,
SpeechSynthesizer speechSynthesizer) {
return new DashScopeAudioSpeechModelOpenAPI(dashScopeAudioApi,
DashScopeAudioSpeechOptions.builder().withModel("sambert-zhichu-v1").build());
}

@Bean
public DashScopeAudioTranscriptionModelOpenAPI dashscopeAudioTranscriptionModel(Transcription transcription) {
return new DashScopeAudioTranscriptionModelOpenAPI(null,
public DashScopeAudioTranscriptionModelOpenAPI dashscopeAudioTranscriptionModel(DashScopeAudioApi dashScopeAudioApi,
Transcription transcription) {
return new DashScopeAudioTranscriptionModelOpenAPI(dashScopeAudioApi,
DashScopeAudioTranscriptionOptions.builder().withModel("paraformer-v2").build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<!-- Other spring dependecies -->
<!-- Other spring dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
Expand Down