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



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

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



62
63
64
# File 'lib/openai/helpers/realtime/connection_resources.rb', line 62

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

#clear(event_id: nil) ⇒ Object



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

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



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

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