Skip to content

Commit c4106e7

Browse files
authored
Merge pull request #23 from richiejp/fix/add-created-event
fix: Add transcription session created event
2 parents 83067fc + bdc12c6 commit c4106e7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

server_event.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const (
1111
ServerEventTypeError ServerEventType = "error"
1212
ServerEventTypeSessionCreated ServerEventType = "session.created"
1313
ServerEventTypeSessionUpdated ServerEventType = "session.updated"
14+
ServerEventTypeTranscriptionSessionCreated ServerEventType = "transcription_session.created"
1415
ServerEventTypeTranscriptionSessionUpdated ServerEventType = "transcription_session.updated"
1516
ServerEventTypeConversationCreated ServerEventType = "conversation.created"
1617
ServerEventTypeInputAudioBufferCommitted ServerEventType = "input_audio_buffer.committed"
@@ -84,6 +85,15 @@ type SessionUpdatedEvent struct {
8485
Session ServerSession `json:"session"`
8586
}
8687

88+
// TranscriptionSessionCreatedEvent is the event for session created.
89+
// Returned when a transcription session is created.
90+
// See https://platform.openai.com/docs/api-reference/realtime-server-events/session/created
91+
type TranscriptionSessionCreatedEvent struct {
92+
ServerEventBase
93+
// The transcription session resource.
94+
Session ServerSession `json:"session"`
95+
}
96+
8797
// TranscriptionSessionUpdatedEvent is the event for session updated.
8898
// Returned when a session is updated.
8999
// See https://platform.openai.com/docs/api-reference/realtime-server-events/session/updated
@@ -393,6 +403,7 @@ type ServerEventInterface interface {
393403
ErrorEvent |
394404
SessionCreatedEvent |
395405
SessionUpdatedEvent |
406+
TranscriptionSessionCreatedEvent |
396407
TranscriptionSessionUpdatedEvent |
397408
ConversationCreatedEvent |
398409
InputAudioBufferCommittedEvent |
@@ -447,6 +458,8 @@ func UnmarshalServerEvent(data []byte) (ServerEvent, error) { //nolint:funlen,cy
447458
return unmarshalServerEvent[SessionCreatedEvent](data)
448459
case ServerEventTypeSessionUpdated:
449460
return unmarshalServerEvent[SessionUpdatedEvent](data)
461+
case ServerEventTypeTranscriptionSessionCreated:
462+
return unmarshalServerEvent[TranscriptionSessionCreatedEvent](data)
450463
case ServerEventTypeTranscriptionSessionUpdated:
451464
return unmarshalServerEvent[TranscriptionSessionUpdatedEvent](data)
452465
case ServerEventTypeConversationCreated:

0 commit comments

Comments
 (0)