Skip to content
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
2 changes: 1 addition & 1 deletion docs/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

### 🐛 Fixed Issues

-
- [Realtime] Fixed possible race condition in Realtime API implementation
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected void sendMessage(@Nonnull final Object message) {
}
synchronized (this) {
try {
ws.sendText(JACKSON.writeValueAsString(message), true);
ws.sendText(JACKSON.writeValueAsString(message), true).join();
ws.request(1);
} catch (final JsonProcessingException e) {
throw new ClientException("Failed to serialize message", e);
Expand Down Expand Up @@ -165,6 +165,7 @@ protected synchronized void sendPing(@Nonnull final WebSocket ws) {
if (ws.isInputClosed()) {
return;
}
log.trace("Sending wss ping");
ws.sendPing(ByteBuffer.wrap("ping".getBytes(StandardCharsets.UTF_8))).join();
ws.request(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ public class RealtimeApiTest {

private static final double LOG_2 = Math.log(2.0);

private static byte[] HELLO_FIXTURE_PCM;
private static byte[] QUESTION_FIXTURE_PCM;

private final OpenAiService service = new OpenAiService();

@BeforeAll
public static void setUp() {
try (var fis = new FileInputStream("src/test/resources/fixtures/hello.pcm")) {
HELLO_FIXTURE_PCM = fis.readAllBytes();
try (var fis =
new FileInputStream(
"src/test/resources/fixtures/what-is-the-german-word-for-chicken.pcm")) {
QUESTION_FIXTURE_PCM = fis.readAllBytes();
} catch (IOException e) {
fail(e.getMessage());
}
Expand Down Expand Up @@ -90,7 +92,7 @@ void testSpeechToSpeech() {
},
RealtimeParamTurnDetection.EACH_CALL_IS_A_TURN,
systemPrompt)) {
input.inputAudio(HELLO_FIXTURE_PCM);
input.inputAudio(QUESTION_FIXTURE_PCM);
completed = monitor.await(55, TimeUnit.SECONDS);
} catch (Exception e) {
if (!(e instanceof InterruptedException)) {
Expand Down
Binary file not shown.
Binary file not shown.