From 2aa882187652179c7577204f60f1bdc1b59263f1 Mon Sep 17 00:00:00 2001 From: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com> Date: Sun, 11 Oct 2026 00:02:21 +0000 Subject: [PATCH] test(realtime): sample pending response events Poll the event count during the held transcription instead of checking\na captured value. Document the client commit and response ordering. Assisted-by: Codex:gpt-6 Signed-off-by: nexxtmobile.de (cherry picked from commit 034086d3b0d687c1038c027b54b7ab5456f33e83) Signed-off-by: Ettore Di Giacinto --- core/http/endpoints/openai/realtime_client_commit_test.go | 4 +++- docs/content/features/openai-realtime.md | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/http/endpoints/openai/realtime_client_commit_test.go b/core/http/endpoints/openai/realtime_client_commit_test.go index 272dea2de..85021ab3c 100644 --- a/core/http/endpoints/openai/realtime_client_commit_test.go +++ b/core/http/endpoints/openai/realtime_client_commit_test.go @@ -79,7 +79,9 @@ var _ = Describe("realtime client-commit LLM/STT ordering", func() { // With the fix it WAITS for the held STT: no response is created while // the transcription is in flight. session.issueClientResponse(types.ResponseCreateParams{}, conv, tr) - Consistently(tr.countEvents(types.ServerEventTypeResponseCreated), 200*time.Millisecond).Should(BeZero()) + Consistently(func() int { + return tr.countEvents(types.ServerEventTypeResponseCreated) + }, 200*time.Millisecond).Should(BeZero()) // Release the STT; the commit appends its user item and the waiting // response now starts on the real transcript. diff --git a/docs/content/features/openai-realtime.md b/docs/content/features/openai-realtime.md index ce44ae92f..290f7e9bf 100644 --- a/docs/content/features/openai-realtime.md +++ b/docs/content/features/openai-realtime.md @@ -127,6 +127,11 @@ or set it to `true` to enable interruption again. ### Turn detection +For client-controlled turns, set `turn_detection` to `null` in `session.update`. +After sending audio, send `input_audio_buffer.commit`, followed by `response.create`. +If transcription is still running, the response waits for the committed user item before starting the LLM. +A standalone `response.create` with no pending client commit starts without this wait. + Turn detection decides when the user has finished speaking and the pipeline should respond. Two modes are supported, matching the OpenAI session schema: - **`server_vad`** (default): silence-based. The VAD model watches the audio and the turn commits after `silence_duration_ms` (default 500 ms) of silence. Simple and model-agnostic, but a fixed silence window must trade interrupting mid-sentence pauses against sluggish responses.