Class: OpenAI::Resources::Realtime

Inherits:
Object
  • Object
show all
Includes:
Helpers::Realtime::Connections, WebSocket::TypedResource
Defined in:
lib/openai/resources/realtime.rb,
lib/openai/resources/realtime/calls.rb,
lib/openai/resources/realtime/translations.rb,
lib/openai/resources/realtime/client_secrets.rb,
lib/openai/resources/realtime/translations/client_secrets.rb,
sig/openai/resources/realtime.rbs,
sig/openai/resources/realtime/calls.rbs,
sig/openai/helpers/realtime/extensions.rbs,
sig/openai/helpers/realtime/translation.rbs,
sig/openai/resources/realtime/translations.rbs,
sig/openai/resources/realtime/client_secrets.rbs,
sig/openai/resources/realtime/translations/client_secrets.rbs

Defined Under Namespace

Classes: Calls, ClientSecrets, Translations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Realtime

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Realtime.

Parameters:



37
38
39
40
41
42
# File 'lib/openai/resources/realtime.rb', line 37

def initialize(client:)
  @client = client
  @client_secrets = OpenAI::Resources::Realtime::ClientSecrets.new(client: client)
  @calls = OpenAI::Resources::Realtime::Calls.new(client: client)
  @translations = OpenAI::Resources::Realtime::Translations.new(client: client)
end

Instance Attribute Details

#calls ⇒ OpenAI::Resources::Realtime::Calls (readonly)



29
30
31
# File 'lib/openai/resources/realtime.rb', line 29

def calls
  @calls
end

#client_secrets ⇒ OpenAI::Resources::Realtime::ClientSecrets (readonly)



26
27
28
# File 'lib/openai/resources/realtime.rb', line 26

def client_secrets
  @client_secrets
end

#translations ⇒ OpenAI::Resources::Realtime::Translations (readonly)



32
33
34
# File 'lib/openai/resources/realtime.rb', line 32

def translations
  @translations
end

Instance Method Details

#__websocket_client_event ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Object)


16
17
18
# File 'lib/openai/resources/realtime.rb', line 16

def __websocket_client_event
  OpenAI::Models::Realtime::RealtimeClientEvent
end

#__websocket_request(query: {}) ⇒ Hash[Symbol, untyped]

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • query: (Hash[untyped, untyped]) (defaults to: {})

Returns:

  • (Hash[Symbol, untyped])


11
12
13
# File 'lib/openai/resources/realtime.rb', line 11

def __websocket_request(query: {})
  {method: :get, path: "realtime", query: query, security: {bearer_auth: true}}
end

#__websocket_server_event ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Object)


21
22
23
# File 'lib/openai/resources/realtime.rb', line 21

def __websocket_server_event
  OpenAI::Models::Realtime::RealtimeServerEvent
end

#connect {|connection| ... } ⇒ top

Parameters:

  • model: (String)
  • reconnect: (Boolean)
  • max_reconnect_attempts: (Integer)
  • max_queue_bytes: (Integer)
  • on_reconnected: (^(OpenAI::Realtime::Connection) -> void, nil)
  • websocket_base_url: (String, nil)
  • request_options: (OpenAI::request_opts, nil)
  • transport: (Object, nil)
  • transport_options: (::Hash[Symbol, untyped])

Yields:

Yield Parameters:

Yield Returns:

  • (top)

Returns:

  • (top)


53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'sig/openai/helpers/realtime/extensions.rbs', line 53

def connect: (
  model: String,
  ?reconnect: bool,
  ?max_reconnect_attempts: Integer,
  ?max_queue_bytes: Integer,
  ?on_reconnected: (^(OpenAI::Realtime::Connection) -> void)?,
  ?websocket_base_url: String?,
  ?request_options: OpenAI::request_opts?,
  ?transport: untyped?,
  ?transport_options: ::Hash[Symbol, untyped]
) {
  (OpenAI::Realtime::Connection connection) -> top
} -> top

#connect_to_call {|connection| ... } ⇒ top

Parameters:

  • call_id: (String)
  • websocket_base_url: (String, nil)
  • request_options: (OpenAI::request_opts, nil)
  • transport: (Object, nil)
  • transport_options: (::Hash[Symbol, untyped])

Yields:

Yield Parameters:

Yield Returns:

  • (top)

Returns:

  • (top)


67
68
69
70
71
72
73
74
75
# File 'sig/openai/helpers/realtime/extensions.rbs', line 67

def connect_to_call: (
  call_id: String,
  ?websocket_base_url: String?,
  ?request_options: OpenAI::request_opts?,
  ?transport: untyped?,
  ?transport_options: ::Hash[Symbol, untyped]
) {
  (OpenAI::Realtime::SidebandConnection connection) -> top
} -> top

#connect_transcription {|connection| ... } ⇒ top

Parameters:

  • websocket_base_url: (String, nil)
  • request_options: (OpenAI::request_opts, nil)
  • transport: (Object, nil)
  • transport_options: (::Hash[Symbol, untyped])

Yields:

Yield Parameters:

Yield Returns:

  • (top)

Returns:

  • (top)


77
78
79
80
81
82
83
84
# File 'sig/openai/helpers/realtime/extensions.rbs', line 77

def connect_transcription: (
  ?websocket_base_url: String?,
  ?request_options: OpenAI::request_opts?,
  ?transport: untyped?,
  ?transport_options: ::Hash[Symbol, untyped]
) {
  (OpenAI::Realtime::Connection connection) -> top
} -> top

#connect_translation {|connection| ... } ⇒ T

Parameters:

  • model: (String)
  • websocket_base_url: (String, nil)
  • request_options: (OpenAI::request_opts, nil)
  • transport: (top)
  • transport_options: (::Hash[Symbol, top])

Yields:

Yield Parameters:

Yield Returns:

  • (T)

Returns:

  • (T)


68
69
70
71
72
73
74
75
76
# File 'sig/openai/helpers/realtime/translation.rbs', line 68

def connect_translation: [T] (
  model: String,
  ?websocket_base_url: String?,
  ?request_options: OpenAI::request_opts?,
  ?transport: top,
  ?transport_options: ::Hash[Symbol, top]
) {
  (OpenAI::Realtime::TranslationConnection connection) -> T
} -> T