From 0529c7d0a08cc8c5b7b0a09758aa6c54a96d0b04 Mon Sep 17 00:00:00 2001 From: Richard Palethorpe Date: Mon, 13 Oct 2025 20:48:13 +0100 Subject: [PATCH] fix(realtime): Add transcription session created event, match OpenAI behavior (#6445) Signed-off-by: Richard Palethorpe --- core/http/endpoints/openai/realtime.go | 12 ++---------- core/http/endpoints/openai/types/realtime.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/core/http/endpoints/openai/realtime.go b/core/http/endpoints/openai/realtime.go index bd55b720d..d6a9186b0 100644 --- a/core/http/endpoints/openai/realtime.go +++ b/core/http/endpoints/openai/realtime.go @@ -256,21 +256,13 @@ func registerRealtime(application *application.Application) func(c *websocket.Co sessions[sessionID] = session sessionLock.Unlock() - // Send session.created and conversation.created events to the client - sendEvent(c, types.SessionCreatedEvent{ + sendEvent(c, types.TranscriptionSessionCreatedEvent{ ServerEventBase: types.ServerEventBase{ EventID: "event_TODO", - Type: types.ServerEventTypeSessionCreated, + Type: types.ServerEventTypeTranscriptionSessionCreated, }, Session: session.ToServer(), }) - sendEvent(c, types.ConversationCreatedEvent{ - ServerEventBase: types.ServerEventBase{ - EventID: "event_TODO", - Type: types.ServerEventTypeConversationCreated, - }, - Conversation: conversation.ToServer(), - }) var ( // mt int diff --git a/core/http/endpoints/openai/types/realtime.go b/core/http/endpoints/openai/types/realtime.go index 2da0600b8..a79d05d9c 100644 --- a/core/http/endpoints/openai/types/realtime.go +++ b/core/http/endpoints/openai/types/realtime.go @@ -704,6 +704,7 @@ const ( ServerEventTypeError ServerEventType = "error" ServerEventTypeSessionCreated ServerEventType = "session.created" ServerEventTypeSessionUpdated ServerEventType = "session.updated" + ServerEventTypeTranscriptionSessionCreated ServerEventType = "transcription_session.created" ServerEventTypeTranscriptionSessionUpdated ServerEventType = "transcription_session.updated" ServerEventTypeConversationCreated ServerEventType = "conversation.created" ServerEventTypeInputAudioBufferCommitted ServerEventType = "input_audio_buffer.committed" @@ -767,6 +768,15 @@ type SessionCreatedEvent struct { Session ServerSession `json:"session"` } +// TranscriptionSessionCreatedEvent is the event for session created. +// Returned when a transcription session is created. +// See https://platform.openai.com/docs/api-reference/realtime-server-events/session/created +type TranscriptionSessionCreatedEvent struct { + ServerEventBase + // The transcription session resource. + Session ServerSession `json:"session"` +} + // SessionUpdatedEvent is the event for session updated. // Returned when a session is updated. // See https://platform.openai.com/docs/api-reference/realtime-server-events/session/updated