From b80ac15f7d39ef72a07a458e94df70dd954c3d13 Mon Sep 17 00:00:00 2001 From: "Dustin H." Date: Sun, 18 May 2025 23:46:57 +0200 Subject: [PATCH 1/2] adds instructions for CreateSpeechRequest --- .../openai/audio/CreateSpeechRequest.java | 2 ++ .../com/theokanning/openai/service/AudioTest.java | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/api/src/main/java/com/theokanning/openai/audio/CreateSpeechRequest.java b/api/src/main/java/com/theokanning/openai/audio/CreateSpeechRequest.java index 80f9590..9a60f02 100644 --- a/api/src/main/java/com/theokanning/openai/audio/CreateSpeechRequest.java +++ b/api/src/main/java/com/theokanning/openai/audio/CreateSpeechRequest.java @@ -37,4 +37,6 @@ public class CreateSpeechRequest { * The speed of the generated audio. Select a value from 0.25 to 4.0. Defaults to 1.0. */ Double speed; + + String instructions; } diff --git a/service/src/test/java/com/theokanning/openai/service/AudioTest.java b/service/src/test/java/com/theokanning/openai/service/AudioTest.java index 6371770..956a553 100644 --- a/service/src/test/java/com/theokanning/openai/service/AudioTest.java +++ b/service/src/test/java/com/theokanning/openai/service/AudioTest.java @@ -85,4 +85,19 @@ void createSpeech() throws IOException { assertEquals(MediaType.get("audio/mpeg"), speech.contentType()); assertTrue(speech.bytes().length > 0); } + + @Test + void createSpeechWithInstructions() throws IOException { + CreateSpeechRequest createSpeechRequest = CreateSpeechRequest.builder() + .model("tts-1") + .input("Hello World.") + .voice("alloy") + .instructions("Please read the text in a normal voice.") + .build(); + + final ResponseBody speech = service.createSpeech(createSpeechRequest); + assertNotNull(speech); + assertEquals(MediaType.get("audio/mpeg"), speech.contentType()); + assertTrue(speech.bytes().length > 0); + } } From f6bff6de97300948a0e9de36caaa26d002341c13 Mon Sep 17 00:00:00 2001 From: "Dustin H." Date: Sun, 18 May 2025 23:46:28 +0200 Subject: [PATCH 2/2] update the build version to 0.22.93 --- README-zh.md | 6 +++--- README.md | 6 +++--- api/pom.xml | 2 +- client/pom.xml | 2 +- example/pom.xml | 4 ++-- pom.xml | 2 +- service/pom.xml | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README-zh.md b/README-zh.md index 0328362..47ac266 100644 --- a/README-zh.md +++ b/README-zh.md @@ -21,14 +21,14 @@ OpenAi4J是一个非官方的Java库,旨在帮助java开发者与OpenAI的GPT ## 导入依赖 ### Gradle -`implementation 'io.github.lambdua::0.22.92'` +`implementation 'io.github.lambdua::0.22.93'` ### Maven ```xml io.github.lambdua service - 0.22.92 + 0.22.93 ``` @@ -61,7 +61,7 @@ static void simpleChat() { io.github.lambdua api - 0.22.92 + 0.22.93 ``` diff --git a/README.md b/README.md index 2ad7007..e3319a1 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,14 @@ applications effortlessly. ## Import ### Gradle -`implementation 'io.github.lambdua::0.22.92'` +`implementation 'io.github.lambdua::0.22.93'` ### Maven ```xml io.github.lambdua service - 0.22.92 + 0.22.93 ``` @@ -67,7 +67,7 @@ To utilize pojos, import the api module: io.github.lambdua api - 0.22.92 + 0.22.93 ``` diff --git a/api/pom.xml b/api/pom.xml index 2a7a610..2f966c2 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -6,7 +6,7 @@ io.github.lambdua openai-java - 0.22.92 + 0.22.93 jar api diff --git a/client/pom.xml b/client/pom.xml index 86b448b..64ab4ae 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -6,7 +6,7 @@ io.github.lambdua openai-java - 0.22.92 + 0.22.93 jar diff --git a/example/pom.xml b/example/pom.xml index 135176c..65c6d4e 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -6,7 +6,7 @@ io.github.lambdua example - 0.22.92 + 0.22.93 example @@ -17,7 +17,7 @@ io.github.lambdua service - 0.22.92 + 0.22.93 diff --git a/pom.xml b/pom.xml index abf3e05..4137b35 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ io.github.lambdua openai-java - 0.22.92 + 0.22.93 pom openai java 版本 https://github.com/Lambdua/openai-java diff --git a/service/pom.xml b/service/pom.xml index 7abb611..94cfb96 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -6,7 +6,7 @@ io.github.lambdua openai-java - 0.22.92 + 0.22.93 jar