Class: OpenAI::Realtime::ConnectionResources::InputAudioBuffer

Inherits:
Base
  • Object
show all
Defined in:
lib/openai/helpers/realtime/connection_resources.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from OpenAI::Realtime::ConnectionResources::Base

Instance Method Details

#append(audio:, event_id: nil) ⇒ Object



54
55
56
57
58
# File 'lib/openai/helpers/realtime/connection_resources.rb', line 54

def append(audio:, event_id: nil)
  @connection.send_event(
    compact_event(type: :"input_audio_buffer.append", audio: audio, event_id: event_id)
  )
end

#append_bytes(bytes, event_id: nil) ⇒ Object



60
61
62
# File 'lib/openai/helpers/realtime/connection_resources.rb', line 60

def append_bytes(bytes, event_id: nil)
  append(audio: [bytes].pack("m0"), event_id: event_id)
end

#clear(event_id: nil) ⇒ Object



70
71
72
73
74
# File 'lib/openai/helpers/realtime/connection_resources.rb', line 70

def clear(event_id: nil)
  @connection.send_event(
    compact_event(type: :"input_audio_buffer.clear", event_id: event_id)
  )
end

#commit(event_id: nil) ⇒ Object



64
65
66
67
68
# File 'lib/openai/helpers/realtime/connection_resources.rb', line 64

def commit(event_id: nil)
  @connection.send_event(
    compact_event(type: :"input_audio_buffer.commit", event_id: event_id)
  )
end