Class: OpenAI::Models::Realtime::RealtimeAudioConfigInput

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/realtime/realtime_audio_config_input.rb,
sig/openai/models/realtime/realtime_audio_config_input.rbs

Defined Under Namespace

Classes: NoiseReduction

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, fields, hash, #hash, inherited, #inspect, inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, coerce_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(format_: nil, noise_reduction: nil, transcription: nil, turn_detection: nil) ⇒ RealtimeAudioConfigInput

Returns a new instance of RealtimeAudioConfigInput.

Parameters:

  • format_ (defaults to: nil) —

    The format of the input audio.

  • noise_reduction (defaults to: nil) —

    When you supply a noise_reduction object, you must set type to near_field or far_field. Set noise_reduction to null to turn off input audio noise reduction. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.

  • transcription (defaults to: nil) —

    Configuration for input audio transcription, defaults to off and can be set to null to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through the /audio/transcriptions endpoint and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.

  • turn_detection (defaults to: nil) —

    Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to null to turn off, in which case the client must manually trigger model response.

    Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.

    Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.

    For gpt-realtime-whisper transcription sessions, turn detection must be set to null; VAD is not supported.

  • format_: (OpenAI::Models::Realtime::realtime_audio_formats) (defaults to: nil)
  • noise_reduction: (OpenAI::Realtime::RealtimeAudioConfigInput::NoiseReduction) (defaults to: nil)
  • transcription: (OpenAI::Realtime::AudioTranscription) (defaults to: nil)
  • turn_detection: (OpenAI::Models::Realtime::realtime_audio_input_turn_detection, nil) (defaults to: nil)


# File 'lib/openai/models/realtime/realtime_audio_config_input.rb', line 58

Instance Attribute Details

#format_ ⇒ OpenAI::Models::Realtime::realtime_audio_formats?

The format of the input audio.

Returns:

  • (OpenAI::Models::Realtime::realtime_audio_formats, nil)


11
# File 'lib/openai/models/realtime/realtime_audio_config_input.rb', line 11

optional :format_, union: -> { OpenAI::Realtime::RealtimeAudioFormats }, api_name: :format

#noise_reduction ⇒ OpenAI::Realtime::RealtimeAudioConfigInput::NoiseReduction?

When you supply a noise_reduction object, you must set type to near_field or far_field. Set noise_reduction to null to turn off input audio noise reduction. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio.

Returns:

  • (OpenAI::Realtime::RealtimeAudioConfigInput::NoiseReduction, nil)


22
# File 'lib/openai/models/realtime/realtime_audio_config_input.rb', line 22

optional :noise_reduction, -> { OpenAI::Realtime::RealtimeAudioConfigInput::NoiseReduction }

#transcription ⇒ OpenAI::Realtime::AudioTranscription?

Configuration for input audio transcription, defaults to off and can be set to null to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through the /audio/transcriptions endpoint and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service.

Returns:

  • (OpenAI::Realtime::AudioTranscription, nil)


35
# File 'lib/openai/models/realtime/realtime_audio_config_input.rb', line 35

optional :transcription, -> { OpenAI::Realtime::AudioTranscription }

#turn_detection ⇒ OpenAI::Models::Realtime::realtime_audio_input_turn_detection?

Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to null to turn off, in which case the client must manually trigger model response.

Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech.

Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency.

For gpt-realtime-whisper transcription sessions, turn detection must be set to null; VAD is not supported.

Returns:

  • (OpenAI::Models::Realtime::realtime_audio_input_turn_detection, nil)


56
# File 'lib/openai/models/realtime/realtime_audio_config_input.rb', line 56

optional :turn_detection, union: -> { OpenAI::Realtime::RealtimeAudioInputTurnDetection }, nil?: true

Instance Method Details

#to_hash ⇒ { ?format_: OpenAI::Models::Realtime::realtime_audio_formats, ?noise_reduction: OpenAI::Realtime::RealtimeAudioConfigInput::NoiseReduction, ?transcription: OpenAI::Realtime::AudioTranscription, ?turn_detection: OpenAI::Models::Realtime::realtime_audio_input_turn_detection? }

Returns:

  • ({ ?format_: OpenAI::Models::Realtime::realtime_audio_formats, ?noise_reduction: OpenAI::Realtime::RealtimeAudioConfigInput::NoiseReduction, ?transcription: OpenAI::Realtime::AudioTranscription, ?turn_detection: OpenAI::Models::Realtime::realtime_audio_input_turn_detection? })


121
122
123
124
125
126
# File 'sig/openai/models/realtime/realtime_audio_config_input.rbs', line 121

def to_hash: -> {
  ?format_: OpenAI::Models::Realtime::realtime_audio_formats,
  ?noise_reduction: OpenAI::Realtime::RealtimeAudioConfigInput::NoiseReduction,
  ?transcription: OpenAI::Realtime::AudioTranscription,
  ?turn_detection: OpenAI::Models::Realtime::realtime_audio_input_turn_detection?
}