openai 0.28.1 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2963c9fab97188dd1986e144236a3700d3095ce4c1dce0716cb64a6d772a58c
4
- data.tar.gz: 013da2c55af2fefe9ed8eb57c63898baabe405b2daf9098c896c9a6ab6e34e48
3
+ metadata.gz: 3cc7790b5d1d8428b74acb0679ef3c0c181c7080b55be162ee4c3c56e27e017e
4
+ data.tar.gz: eaf55f9a450e8c4e1dd27ddabdcbb4ce304025c7028d0e02d00405d83ff752b1
5
5
  SHA512:
6
- metadata.gz: 421f268dd81210d9fcc86b31718489f0272114be636f74adf66e9eb23119e76c1105b9753129125a92bfc5c7b6b5a7a6b0fbbcbdb3a7bd09d243332907ed00c7
7
- data.tar.gz: 608b54d37f7db445794622a00ecfe8423d4be4ad37fb587c142472ab25f8c8fc5b5b3682e43ef7c8f491e8766980e282b1dd1e2658cae54084a3fe93fd82a1fb
6
+ metadata.gz: 8c3e0f6fcdbc1d7b2efb8f5674b9bec6cffa270737894dd68694f56e480ad49cb1cbe61abc93fc8321183bc737ed0bbd5980b1d15134ec5fbdad2f0983988c14
7
+ data.tar.gz: 43691a8ae3a5834efd388697ccdcfd1ee617e101c4d751353c1d37da434b4b67f9bde21efd46ae21edc92654d48055b4833d07c8aa5e6292a235729019054ef1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.29.0 (2025-10-02)
4
+
5
+ Full Changelog: [v0.28.1...v0.29.0](https://github.com/openai/openai-ruby/compare/v0.28.1...v0.29.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add support for realtime calls ([2c89d20](https://github.com/openai/openai-ruby/commit/2c89d20072ed1611227bcdb0cb3771407e5c0a21))
10
+
3
11
  ## 0.28.1 (2025-10-01)
4
12
 
5
13
  Full Changelog: [v0.28.0...v0.28.1](https://github.com/openai/openai-ruby/compare/v0.28.0...v0.28.1)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "openai", "~> 0.28.1"
18
+ gem "openai", "~> 0.29.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ # @see OpenAI::Resources::Realtime::Calls#accept
7
+ class CallAcceptParams < OpenAI::Models::Realtime::RealtimeSessionCreateRequest
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ # @!method initialize(request_options: {})
12
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ # @see OpenAI::Resources::Realtime::Calls#hangup
7
+ class CallHangupParams < OpenAI::Internal::Type::BaseModel
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ # @!method initialize(request_options: {})
12
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ # @see OpenAI::Resources::Realtime::Calls#refer
7
+ class CallReferParams < OpenAI::Internal::Type::BaseModel
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ # @!attribute target_uri
12
+ # URI that should appear in the SIP Refer-To header. Supports values like
13
+ # `tel:+14155550123` or `sip:agent@example.com`.
14
+ #
15
+ # @return [String]
16
+ required :target_uri, String
17
+
18
+ # @!method initialize(target_uri:, request_options: {})
19
+ # Some parameter documentations has been truncated, see
20
+ # {OpenAI::Models::Realtime::CallReferParams} for more details.
21
+ #
22
+ # @param target_uri [String] URI that should appear in the SIP Refer-To header. Supports values like
23
+ #
24
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ # @see OpenAI::Resources::Realtime::Calls#reject
7
+ class CallRejectParams < OpenAI::Internal::Type::BaseModel
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ # @!attribute status_code
12
+ # SIP response code to send back to the caller. Defaults to `603` (Decline) when
13
+ # omitted.
14
+ #
15
+ # @return [Integer, nil]
16
+ optional :status_code, Integer
17
+
18
+ # @!method initialize(status_code: nil, request_options: {})
19
+ # Some parameter documentations has been truncated, see
20
+ # {OpenAI::Models::Realtime::CallRejectParams} for more details.
21
+ #
22
+ # @param status_code [Integer] SIP response code to send back to the caller. Defaults to `603` (Decline)
23
+ #
24
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Resources
5
+ class Realtime
6
+ class Calls
7
+ # Some parameter documentations has been truncated, see
8
+ # {OpenAI::Models::Realtime::CallAcceptParams} for more details.
9
+ #
10
+ # Accept an incoming SIP call and configure the realtime session that will handle
11
+ # it.
12
+ #
13
+ # @overload accept(call_id, audio: nil, include: nil, instructions: nil, max_output_tokens: nil, model: nil, output_modalities: nil, prompt: nil, tool_choice: nil, tools: nil, tracing: nil, truncation: nil, type: :realtime, request_options: {})
14
+ #
15
+ # @param call_id [String] The identifier for the call provided in the
16
+ #
17
+ # @param audio [OpenAI::Models::Realtime::RealtimeAudioConfig] Configuration for input and output audio.
18
+ #
19
+ # @param include [Array<Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateRequest::Include>] Additional fields to include in server outputs.
20
+ #
21
+ # @param instructions [String] The default system instructions (i.e. system message) prepended to model calls.
22
+ #
23
+ # @param max_output_tokens [Integer, Symbol, :inf] Maximum number of output tokens for a single assistant response,
24
+ #
25
+ # @param model [String, Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateRequest::Model] The Realtime model used for this session.
26
+ #
27
+ # @param output_modalities [Array<Symbol, OpenAI::Models::Realtime::RealtimeSessionCreateRequest::OutputModality>] The set of modalities the model can respond with. It defaults to `["audio"]`, in
28
+ #
29
+ # @param prompt [OpenAI::Models::Responses::ResponsePrompt, nil] Reference to a prompt template and its variables.
30
+ #
31
+ # @param tool_choice [Symbol, OpenAI::Models::Responses::ToolChoiceOptions, OpenAI::Models::Responses::ToolChoiceFunction, OpenAI::Models::Responses::ToolChoiceMcp] How the model chooses tools. Provide one of the string modes or force a specific
32
+ #
33
+ # @param tools [Array<OpenAI::Models::Realtime::RealtimeFunctionTool, OpenAI::Models::Realtime::RealtimeToolsConfigUnion::Mcp>] Tools available to the model.
34
+ #
35
+ # @param tracing [Symbol, :auto, OpenAI::Models::Realtime::RealtimeTracingConfig::TracingConfiguration, nil] Realtime API can write session traces to the [Traces Dashboard](/logs?api=traces
36
+ #
37
+ # @param truncation [Symbol, OpenAI::Models::Realtime::RealtimeTruncation::RealtimeTruncationStrategy, OpenAI::Models::Realtime::RealtimeTruncationRetentionRatio] Controls how the realtime conversation is truncated prior to model inference.
38
+ #
39
+ # @param type [Symbol, :realtime] The type of session to create. Always `realtime` for the Realtime API.
40
+ #
41
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
42
+ #
43
+ # @return [nil]
44
+ #
45
+ # @see OpenAI::Models::Realtime::CallAcceptParams
46
+ def accept(call_id, params)
47
+ parsed, options = OpenAI::Realtime::CallAcceptParams.dump_request(params)
48
+ @client.request(
49
+ method: :post,
50
+ path: ["realtime/calls/%1$s/accept", call_id],
51
+ body: parsed,
52
+ model: NilClass,
53
+ options: options
54
+ )
55
+ end
56
+
57
+ # Some parameter documentations has been truncated, see
58
+ # {OpenAI::Models::Realtime::CallHangupParams} for more details.
59
+ #
60
+ # End an active Realtime API call, whether it was initiated over SIP or WebRTC.
61
+ #
62
+ # @overload hangup(call_id, request_options: {})
63
+ #
64
+ # @param call_id [String] The identifier for the call. For SIP calls, use the value provided in the
65
+ #
66
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
67
+ #
68
+ # @return [nil]
69
+ #
70
+ # @see OpenAI::Models::Realtime::CallHangupParams
71
+ def hangup(call_id, params = {})
72
+ @client.request(
73
+ method: :post,
74
+ path: ["realtime/calls/%1$s/hangup", call_id],
75
+ model: NilClass,
76
+ options: params[:request_options]
77
+ )
78
+ end
79
+
80
+ # Some parameter documentations has been truncated, see
81
+ # {OpenAI::Models::Realtime::CallReferParams} for more details.
82
+ #
83
+ # Transfer an active SIP call to a new destination using the SIP REFER verb.
84
+ #
85
+ # @overload refer(call_id, target_uri:, request_options: {})
86
+ #
87
+ # @param call_id [String] The identifier for the call provided in the
88
+ #
89
+ # @param target_uri [String] URI that should appear in the SIP Refer-To header. Supports values like
90
+ #
91
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
92
+ #
93
+ # @return [nil]
94
+ #
95
+ # @see OpenAI::Models::Realtime::CallReferParams
96
+ def refer(call_id, params)
97
+ parsed, options = OpenAI::Realtime::CallReferParams.dump_request(params)
98
+ @client.request(
99
+ method: :post,
100
+ path: ["realtime/calls/%1$s/refer", call_id],
101
+ body: parsed,
102
+ model: NilClass,
103
+ options: options
104
+ )
105
+ end
106
+
107
+ # Some parameter documentations has been truncated, see
108
+ # {OpenAI::Models::Realtime::CallRejectParams} for more details.
109
+ #
110
+ # Decline an incoming SIP call by returning a SIP status code to the caller.
111
+ #
112
+ # @overload reject(call_id, status_code: nil, request_options: {})
113
+ #
114
+ # @param call_id [String] The identifier for the call provided in the
115
+ #
116
+ # @param status_code [Integer] SIP response code to send back to the caller. Defaults to `603` (Decline)
117
+ #
118
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
119
+ #
120
+ # @return [nil]
121
+ #
122
+ # @see OpenAI::Models::Realtime::CallRejectParams
123
+ def reject(call_id, params = {})
124
+ parsed, options = OpenAI::Realtime::CallRejectParams.dump_request(params)
125
+ @client.request(
126
+ method: :post,
127
+ path: ["realtime/calls/%1$s/reject", call_id],
128
+ body: parsed,
129
+ model: NilClass,
130
+ options: options
131
+ )
132
+ end
133
+
134
+ # @api private
135
+ #
136
+ # @param client [OpenAI::Client]
137
+ def initialize(client:)
138
+ @client = client
139
+ end
140
+ end
141
+ end
142
+ end
143
+ end
@@ -6,12 +6,16 @@ module OpenAI
6
6
  # @return [OpenAI::Resources::Realtime::ClientSecrets]
7
7
  attr_reader :client_secrets
8
8
 
9
+ # @return [OpenAI::Resources::Realtime::Calls]
10
+ attr_reader :calls
11
+
9
12
  # @api private
10
13
  #
11
14
  # @param client [OpenAI::Client]
12
15
  def initialize(client:)
13
16
  @client = client
14
17
  @client_secrets = OpenAI::Resources::Realtime::ClientSecrets.new(client: client)
18
+ @calls = OpenAI::Resources::Realtime::Calls.new(client: client)
15
19
  end
16
20
  end
17
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.28.1"
4
+ VERSION = "0.29.0"
5
5
  end
data/lib/openai.rb CHANGED
@@ -71,6 +71,7 @@ require_relative "openai/models/graders/score_model_grader"
71
71
  require_relative "openai/models/graders/python_grader"
72
72
  require_relative "openai/models/graders/text_similarity_grader"
73
73
  require_relative "openai/models/fine_tuning/fine_tuning_job_wandb_integration_object"
74
+ require_relative "openai/models/realtime/realtime_session_create_request"
74
75
  require_relative "openai/models/responses/response_function_tool_call"
75
76
  require_relative "openai/models/all_models"
76
77
  require_relative "openai/models/audio/speech_create_params"
@@ -383,6 +384,10 @@ require_relative "openai/models/moderation_multi_modal_input"
383
384
  require_relative "openai/models/moderation_text_input"
384
385
  require_relative "openai/models/other_file_chunking_strategy_object"
385
386
  require_relative "openai/models/realtime/audio_transcription"
387
+ require_relative "openai/models/realtime/call_accept_params"
388
+ require_relative "openai/models/realtime/call_hangup_params"
389
+ require_relative "openai/models/realtime/call_refer_params"
390
+ require_relative "openai/models/realtime/call_reject_params"
386
391
  require_relative "openai/models/realtime/client_secret_create_params"
387
392
  require_relative "openai/models/realtime/client_secret_create_response"
388
393
  require_relative "openai/models/realtime/conversation_created_event"
@@ -448,7 +453,6 @@ require_relative "openai/models/realtime/realtime_response_usage_output_token_de
448
453
  require_relative "openai/models/realtime/realtime_server_event"
449
454
  require_relative "openai/models/realtime/realtime_session"
450
455
  require_relative "openai/models/realtime/realtime_session_client_secret"
451
- require_relative "openai/models/realtime/realtime_session_create_request"
452
456
  require_relative "openai/models/realtime/realtime_session_create_response"
453
457
  require_relative "openai/models/realtime/realtime_tool_choice_config"
454
458
  require_relative "openai/models/realtime/realtime_tools_config"
@@ -695,6 +699,7 @@ require_relative "openai/resources/images"
695
699
  require_relative "openai/resources/models"
696
700
  require_relative "openai/resources/moderations"
697
701
  require_relative "openai/resources/realtime"
702
+ require_relative "openai/resources/realtime/calls"
698
703
  require_relative "openai/resources/realtime/client_secrets"
699
704
  require_relative "openai/resources/responses"
700
705
  require_relative "openai/resources/responses/input_items"
@@ -0,0 +1,29 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ class CallAcceptParams < OpenAI::Models::Realtime::RealtimeSessionCreateRequest
7
+ extend OpenAI::Internal::Type::RequestParameters::Converter
8
+ include OpenAI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(OpenAI::Realtime::CallAcceptParams, OpenAI::Internal::AnyHash)
13
+ end
14
+
15
+ sig do
16
+ params(request_options: OpenAI::RequestOptions::OrHash).returns(
17
+ T.attached_class
18
+ )
19
+ end
20
+ def self.new(request_options: {})
21
+ end
22
+
23
+ sig { override.returns({ request_options: OpenAI::RequestOptions }) }
24
+ def to_hash
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ class CallHangupParams < OpenAI::Internal::Type::BaseModel
7
+ extend OpenAI::Internal::Type::RequestParameters::Converter
8
+ include OpenAI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(OpenAI::Realtime::CallHangupParams, OpenAI::Internal::AnyHash)
13
+ end
14
+
15
+ sig do
16
+ params(request_options: OpenAI::RequestOptions::OrHash).returns(
17
+ T.attached_class
18
+ )
19
+ end
20
+ def self.new(request_options: {})
21
+ end
22
+
23
+ sig { override.returns({ request_options: OpenAI::RequestOptions }) }
24
+ def to_hash
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,44 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ class CallReferParams < OpenAI::Internal::Type::BaseModel
7
+ extend OpenAI::Internal::Type::RequestParameters::Converter
8
+ include OpenAI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(OpenAI::Realtime::CallReferParams, OpenAI::Internal::AnyHash)
13
+ end
14
+
15
+ # URI that should appear in the SIP Refer-To header. Supports values like
16
+ # `tel:+14155550123` or `sip:agent@example.com`.
17
+ sig { returns(String) }
18
+ attr_accessor :target_uri
19
+
20
+ sig do
21
+ params(
22
+ target_uri: String,
23
+ request_options: OpenAI::RequestOptions::OrHash
24
+ ).returns(T.attached_class)
25
+ end
26
+ def self.new(
27
+ # URI that should appear in the SIP Refer-To header. Supports values like
28
+ # `tel:+14155550123` or `sip:agent@example.com`.
29
+ target_uri:,
30
+ request_options: {}
31
+ )
32
+ end
33
+
34
+ sig do
35
+ override.returns(
36
+ { target_uri: String, request_options: OpenAI::RequestOptions }
37
+ )
38
+ end
39
+ def to_hash
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,47 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ class CallRejectParams < OpenAI::Internal::Type::BaseModel
7
+ extend OpenAI::Internal::Type::RequestParameters::Converter
8
+ include OpenAI::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(OpenAI::Realtime::CallRejectParams, OpenAI::Internal::AnyHash)
13
+ end
14
+
15
+ # SIP response code to send back to the caller. Defaults to `603` (Decline) when
16
+ # omitted.
17
+ sig { returns(T.nilable(Integer)) }
18
+ attr_reader :status_code
19
+
20
+ sig { params(status_code: Integer).void }
21
+ attr_writer :status_code
22
+
23
+ sig do
24
+ params(
25
+ status_code: Integer,
26
+ request_options: OpenAI::RequestOptions::OrHash
27
+ ).returns(T.attached_class)
28
+ end
29
+ def self.new(
30
+ # SIP response code to send back to the caller. Defaults to `603` (Decline) when
31
+ # omitted.
32
+ status_code: nil,
33
+ request_options: {}
34
+ )
35
+ end
36
+
37
+ sig do
38
+ override.returns(
39
+ { status_code: Integer, request_options: OpenAI::RequestOptions }
40
+ )
41
+ end
42
+ def to_hash
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,182 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Resources
5
+ class Realtime
6
+ class Calls
7
+ # Accept an incoming SIP call and configure the realtime session that will handle
8
+ # it.
9
+ sig do
10
+ params(
11
+ call_id: String,
12
+ audio: OpenAI::Realtime::RealtimeAudioConfig::OrHash,
13
+ include:
14
+ T::Array[
15
+ OpenAI::Realtime::RealtimeSessionCreateRequest::Include::OrSymbol
16
+ ],
17
+ instructions: String,
18
+ max_output_tokens: T.any(Integer, Symbol),
19
+ model:
20
+ T.any(
21
+ String,
22
+ OpenAI::Realtime::RealtimeSessionCreateRequest::Model::OrSymbol
23
+ ),
24
+ output_modalities:
25
+ T::Array[
26
+ OpenAI::Realtime::RealtimeSessionCreateRequest::OutputModality::OrSymbol
27
+ ],
28
+ prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
29
+ tool_choice:
30
+ T.any(
31
+ OpenAI::Responses::ToolChoiceOptions::OrSymbol,
32
+ OpenAI::Responses::ToolChoiceFunction::OrHash,
33
+ OpenAI::Responses::ToolChoiceMcp::OrHash
34
+ ),
35
+ tools:
36
+ T::Array[
37
+ T.any(
38
+ OpenAI::Realtime::RealtimeFunctionTool::OrHash,
39
+ OpenAI::Realtime::RealtimeToolsConfigUnion::Mcp::OrHash
40
+ )
41
+ ],
42
+ tracing:
43
+ T.nilable(
44
+ T.any(
45
+ Symbol,
46
+ OpenAI::Realtime::RealtimeTracingConfig::TracingConfiguration::OrHash
47
+ )
48
+ ),
49
+ truncation:
50
+ T.any(
51
+ OpenAI::Realtime::RealtimeTruncation::RealtimeTruncationStrategy::OrSymbol,
52
+ OpenAI::Realtime::RealtimeTruncationRetentionRatio::OrHash
53
+ ),
54
+ type: Symbol,
55
+ request_options: OpenAI::RequestOptions::OrHash
56
+ ).void
57
+ end
58
+ def accept(
59
+ # The identifier for the call provided in the
60
+ # [`realtime.call.incoming`](https://platform.openai.com/docs/api-reference/webhook_events/realtime/call/incoming)
61
+ # webhook.
62
+ call_id,
63
+ # Configuration for input and output audio.
64
+ audio: nil,
65
+ # Additional fields to include in server outputs.
66
+ #
67
+ # `item.input_audio_transcription.logprobs`: Include logprobs for input audio
68
+ # transcription.
69
+ include: nil,
70
+ # The default system instructions (i.e. system message) prepended to model calls.
71
+ # This field allows the client to guide the model on desired responses. The model
72
+ # can be instructed on response content and format, (e.g. "be extremely succinct",
73
+ # "act friendly", "here are examples of good responses") and on audio behavior
74
+ # (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The
75
+ # instructions are not guaranteed to be followed by the model, but they provide
76
+ # guidance to the model on the desired behavior.
77
+ #
78
+ # Note that the server sets default instructions which will be used if this field
79
+ # is not set and are visible in the `session.created` event at the start of the
80
+ # session.
81
+ instructions: nil,
82
+ # Maximum number of output tokens for a single assistant response, inclusive of
83
+ # tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
84
+ # `inf` for the maximum available tokens for a given model. Defaults to `inf`.
85
+ max_output_tokens: nil,
86
+ # The Realtime model used for this session.
87
+ model: nil,
88
+ # The set of modalities the model can respond with. It defaults to `["audio"]`,
89
+ # indicating that the model will respond with audio plus a transcript. `["text"]`
90
+ # can be used to make the model respond with text only. It is not possible to
91
+ # request both `text` and `audio` at the same time.
92
+ output_modalities: nil,
93
+ # Reference to a prompt template and its variables.
94
+ # [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
95
+ prompt: nil,
96
+ # How the model chooses tools. Provide one of the string modes or force a specific
97
+ # function/MCP tool.
98
+ tool_choice: nil,
99
+ # Tools available to the model.
100
+ tools: nil,
101
+ # Realtime API can write session traces to the
102
+ # [Traces Dashboard](/logs?api=traces). Set to null to disable tracing. Once
103
+ # tracing is enabled for a session, the configuration cannot be modified.
104
+ #
105
+ # `auto` will create a trace for the session with default values for the workflow
106
+ # name, group id, and metadata.
107
+ tracing: nil,
108
+ # Controls how the realtime conversation is truncated prior to model inference.
109
+ # The default is `auto`.
110
+ truncation: nil,
111
+ # The type of session to create. Always `realtime` for the Realtime API.
112
+ type: :realtime,
113
+ request_options: {}
114
+ )
115
+ end
116
+
117
+ # End an active Realtime API call, whether it was initiated over SIP or WebRTC.
118
+ sig do
119
+ params(
120
+ call_id: String,
121
+ request_options: OpenAI::RequestOptions::OrHash
122
+ ).void
123
+ end
124
+ def hangup(
125
+ # The identifier for the call. For SIP calls, use the value provided in the
126
+ # [`realtime.call.incoming`](https://platform.openai.com/docs/api-reference/webhook_events/realtime/call/incoming)
127
+ # webhook. For WebRTC sessions, reuse the call ID returned in the `Location`
128
+ # header when creating the call with
129
+ # [`POST /v1/realtime/calls`](https://platform.openai.com/docs/api-reference/realtime/create-call).
130
+ call_id,
131
+ request_options: {}
132
+ )
133
+ end
134
+
135
+ # Transfer an active SIP call to a new destination using the SIP REFER verb.
136
+ sig do
137
+ params(
138
+ call_id: String,
139
+ target_uri: String,
140
+ request_options: OpenAI::RequestOptions::OrHash
141
+ ).void
142
+ end
143
+ def refer(
144
+ # The identifier for the call provided in the
145
+ # [`realtime.call.incoming`](https://platform.openai.com/docs/api-reference/webhook_events/realtime/call/incoming)
146
+ # webhook.
147
+ call_id,
148
+ # URI that should appear in the SIP Refer-To header. Supports values like
149
+ # `tel:+14155550123` or `sip:agent@example.com`.
150
+ target_uri:,
151
+ request_options: {}
152
+ )
153
+ end
154
+
155
+ # Decline an incoming SIP call by returning a SIP status code to the caller.
156
+ sig do
157
+ params(
158
+ call_id: String,
159
+ status_code: Integer,
160
+ request_options: OpenAI::RequestOptions::OrHash
161
+ ).void
162
+ end
163
+ def reject(
164
+ # The identifier for the call provided in the
165
+ # [`realtime.call.incoming`](https://platform.openai.com/docs/api-reference/webhook_events/realtime/call/incoming)
166
+ # webhook.
167
+ call_id,
168
+ # SIP response code to send back to the caller. Defaults to `603` (Decline) when
169
+ # omitted.
170
+ status_code: nil,
171
+ request_options: {}
172
+ )
173
+ end
174
+
175
+ # @api private
176
+ sig { params(client: OpenAI::Client).returns(T.attached_class) }
177
+ def self.new(client:)
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
@@ -6,6 +6,9 @@ module OpenAI
6
6
  sig { returns(OpenAI::Resources::Realtime::ClientSecrets) }
7
7
  attr_reader :client_secrets
8
8
 
9
+ sig { returns(OpenAI::Resources::Realtime::Calls) }
10
+ attr_reader :calls
11
+
9
12
  # @api private
10
13
  sig { params(client: OpenAI::Client).returns(T.attached_class) }
11
14
  def self.new(client:)
@@ -0,0 +1,17 @@
1
+ module OpenAI
2
+ module Models
3
+ module Realtime
4
+ type call_accept_params =
5
+ { } & OpenAI::Internal::Type::request_parameters
6
+
7
+ class CallAcceptParams < OpenAI::Models::Realtime::RealtimeSessionCreateRequest
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ def initialize: (?request_options: OpenAI::request_opts) -> void
12
+
13
+ def to_hash: -> { request_options: OpenAI::RequestOptions }
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module OpenAI
2
+ module Models
3
+ module Realtime
4
+ type call_hangup_params =
5
+ { } & OpenAI::Internal::Type::request_parameters
6
+
7
+ class CallHangupParams < OpenAI::Internal::Type::BaseModel
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ def initialize: (?request_options: OpenAI::request_opts) -> void
12
+
13
+ def to_hash: -> { request_options: OpenAI::RequestOptions }
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ module OpenAI
2
+ module Models
3
+ module Realtime
4
+ type call_refer_params =
5
+ { target_uri: String } & OpenAI::Internal::Type::request_parameters
6
+
7
+ class CallReferParams < OpenAI::Internal::Type::BaseModel
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ attr_accessor target_uri: String
12
+
13
+ def initialize: (
14
+ target_uri: String,
15
+ ?request_options: OpenAI::request_opts
16
+ ) -> void
17
+
18
+ def to_hash: -> {
19
+ target_uri: String,
20
+ request_options: OpenAI::RequestOptions
21
+ }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ module OpenAI
2
+ module Models
3
+ module Realtime
4
+ type call_reject_params =
5
+ { status_code: Integer } & OpenAI::Internal::Type::request_parameters
6
+
7
+ class CallRejectParams < OpenAI::Internal::Type::BaseModel
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ attr_reader status_code: Integer?
12
+
13
+ def status_code=: (Integer) -> Integer
14
+
15
+ def initialize: (
16
+ ?status_code: Integer,
17
+ ?request_options: OpenAI::request_opts
18
+ ) -> void
19
+
20
+ def to_hash: -> {
21
+ status_code: Integer,
22
+ request_options: OpenAI::RequestOptions
23
+ }
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,43 @@
1
+ module OpenAI
2
+ module Resources
3
+ class Realtime
4
+ class Calls
5
+ def accept: (
6
+ String call_id,
7
+ ?audio: OpenAI::Realtime::RealtimeAudioConfig,
8
+ ?include: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateRequest::include_],
9
+ ?instructions: String,
10
+ ?max_output_tokens: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::max_output_tokens,
11
+ ?model: OpenAI::Models::Realtime::RealtimeSessionCreateRequest::model,
12
+ ?output_modalities: ::Array[OpenAI::Models::Realtime::RealtimeSessionCreateRequest::output_modality],
13
+ ?prompt: OpenAI::Responses::ResponsePrompt?,
14
+ ?tool_choice: OpenAI::Models::Realtime::realtime_tool_choice_config,
15
+ ?tools: OpenAI::Models::Realtime::realtime_tools_config,
16
+ ?tracing: OpenAI::Models::Realtime::realtime_tracing_config?,
17
+ ?truncation: OpenAI::Models::Realtime::realtime_truncation,
18
+ ?type: :realtime,
19
+ ?request_options: OpenAI::request_opts
20
+ ) -> nil
21
+
22
+ def hangup: (
23
+ String call_id,
24
+ ?request_options: OpenAI::request_opts
25
+ ) -> nil
26
+
27
+ def refer: (
28
+ String call_id,
29
+ target_uri: String,
30
+ ?request_options: OpenAI::request_opts
31
+ ) -> nil
32
+
33
+ def reject: (
34
+ String call_id,
35
+ ?status_code: Integer,
36
+ ?request_options: OpenAI::request_opts
37
+ ) -> nil
38
+
39
+ def initialize: (client: OpenAI::Client) -> void
40
+ end
41
+ end
42
+ end
43
+ end
@@ -3,6 +3,8 @@ module OpenAI
3
3
  class Realtime
4
4
  attr_reader client_secrets: OpenAI::Resources::Realtime::ClientSecrets
5
5
 
6
+ attr_reader calls: OpenAI::Resources::Realtime::Calls
7
+
6
8
  def initialize: (client: OpenAI::Client) -> void
7
9
  end
8
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.1
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-01 00:00:00.000000000 Z
11
+ date: 2025-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -389,6 +389,10 @@ files:
389
389
  - lib/openai/models/moderation_text_input.rb
390
390
  - lib/openai/models/other_file_chunking_strategy_object.rb
391
391
  - lib/openai/models/realtime/audio_transcription.rb
392
+ - lib/openai/models/realtime/call_accept_params.rb
393
+ - lib/openai/models/realtime/call_hangup_params.rb
394
+ - lib/openai/models/realtime/call_refer_params.rb
395
+ - lib/openai/models/realtime/call_reject_params.rb
392
396
  - lib/openai/models/realtime/client_secret_create_params.rb
393
397
  - lib/openai/models/realtime/client_secret_create_response.rb
394
398
  - lib/openai/models/realtime/conversation_created_event.rb
@@ -708,6 +712,7 @@ files:
708
712
  - lib/openai/resources/models.rb
709
713
  - lib/openai/resources/moderations.rb
710
714
  - lib/openai/resources/realtime.rb
715
+ - lib/openai/resources/realtime/calls.rb
711
716
  - lib/openai/resources/realtime/client_secrets.rb
712
717
  - lib/openai/resources/responses.rb
713
718
  - lib/openai/resources/responses/input_items.rb
@@ -1069,6 +1074,10 @@ files:
1069
1074
  - rbi/openai/models/moderation_text_input.rbi
1070
1075
  - rbi/openai/models/other_file_chunking_strategy_object.rbi
1071
1076
  - rbi/openai/models/realtime/audio_transcription.rbi
1077
+ - rbi/openai/models/realtime/call_accept_params.rbi
1078
+ - rbi/openai/models/realtime/call_hangup_params.rbi
1079
+ - rbi/openai/models/realtime/call_refer_params.rbi
1080
+ - rbi/openai/models/realtime/call_reject_params.rbi
1072
1081
  - rbi/openai/models/realtime/client_secret_create_params.rbi
1073
1082
  - rbi/openai/models/realtime/client_secret_create_response.rbi
1074
1083
  - rbi/openai/models/realtime/conversation_created_event.rbi
@@ -1388,6 +1397,7 @@ files:
1388
1397
  - rbi/openai/resources/models.rbi
1389
1398
  - rbi/openai/resources/moderations.rbi
1390
1399
  - rbi/openai/resources/realtime.rbi
1400
+ - rbi/openai/resources/realtime/calls.rbi
1391
1401
  - rbi/openai/resources/realtime/client_secrets.rbi
1392
1402
  - rbi/openai/resources/responses.rbi
1393
1403
  - rbi/openai/resources/responses/input_items.rbi
@@ -1739,6 +1749,10 @@ files:
1739
1749
  - sig/openai/models/moderation_text_input.rbs
1740
1750
  - sig/openai/models/other_file_chunking_strategy_object.rbs
1741
1751
  - sig/openai/models/realtime/audio_transcription.rbs
1752
+ - sig/openai/models/realtime/call_accept_params.rbs
1753
+ - sig/openai/models/realtime/call_hangup_params.rbs
1754
+ - sig/openai/models/realtime/call_refer_params.rbs
1755
+ - sig/openai/models/realtime/call_reject_params.rbs
1742
1756
  - sig/openai/models/realtime/client_secret_create_params.rbs
1743
1757
  - sig/openai/models/realtime/client_secret_create_response.rbs
1744
1758
  - sig/openai/models/realtime/conversation_created_event.rbs
@@ -2058,6 +2072,7 @@ files:
2058
2072
  - sig/openai/resources/models.rbs
2059
2073
  - sig/openai/resources/moderations.rbs
2060
2074
  - sig/openai/resources/realtime.rbs
2075
+ - sig/openai/resources/realtime/calls.rbs
2061
2076
  - sig/openai/resources/realtime/client_secrets.rbs
2062
2077
  - sig/openai/resources/responses.rbs
2063
2078
  - sig/openai/resources/responses/input_items.rbs