Skip to content

Commit 6d0ac08

Browse files
committed
feat: Add default call method for TextToSpeechModel
Signed-off-by: guanxu <1510424541@qq.com>
1 parent 4f1ab6a commit 6d0ac08

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spring-ai-model/src/main/java/org/springframework/ai/audio/tts/TextToSpeechModel.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ default byte[] call(String text) {
3636
return (output != null) ? output : new byte[0];
3737
}
3838

39+
default byte[] call(String text, TextToSpeechOptions options) {
40+
TextToSpeechPrompt prompt = new TextToSpeechPrompt(text, options);
41+
ModelResult<byte[]> result = call(prompt).getResult();
42+
if (result == null) {
43+
return new byte[0];
44+
}
45+
byte[] output = result.getOutput();
46+
return (output != null) ? output : new byte[0];
47+
}
48+
3949
@Override
4050
TextToSpeechResponse call(TextToSpeechPrompt prompt);
4151

0 commit comments

Comments
 (0)