openai 0.28.0 → 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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/openai/models/conversations/conversation_item.rb +37 -1
  5. data/lib/openai/models/realtime/call_accept_params.rb +16 -0
  6. data/lib/openai/models/realtime/call_hangup_params.rb +16 -0
  7. data/lib/openai/models/realtime/call_refer_params.rb +28 -0
  8. data/lib/openai/models/realtime/call_reject_params.rb +28 -0
  9. data/lib/openai/models/responses/response_input_item.rb +37 -1
  10. data/lib/openai/models/responses/response_item.rb +37 -1
  11. data/lib/openai/models/responses/response_output_item.rb +37 -1
  12. data/lib/openai/resources/realtime/calls.rb +143 -0
  13. data/lib/openai/resources/realtime.rb +4 -0
  14. data/lib/openai/version.rb +1 -1
  15. data/lib/openai.rb +6 -1
  16. data/rbi/openai/models/conversations/conversation_item.rbi +90 -1
  17. data/rbi/openai/models/realtime/call_accept_params.rbi +29 -0
  18. data/rbi/openai/models/realtime/call_hangup_params.rbi +29 -0
  19. data/rbi/openai/models/realtime/call_refer_params.rbi +44 -0
  20. data/rbi/openai/models/realtime/call_reject_params.rbi +47 -0
  21. data/rbi/openai/models/responses/response_input_item.rbi +90 -1
  22. data/rbi/openai/models/responses/response_item.rbi +86 -1
  23. data/rbi/openai/models/responses/response_output_item.rbi +90 -1
  24. data/rbi/openai/resources/realtime/calls.rbi +182 -0
  25. data/rbi/openai/resources/realtime.rbi +3 -0
  26. data/sig/openai/models/conversations/conversation_item.rbs +31 -2
  27. data/sig/openai/models/realtime/call_accept_params.rbs +17 -0
  28. data/sig/openai/models/realtime/call_hangup_params.rbs +17 -0
  29. data/sig/openai/models/realtime/call_refer_params.rbs +25 -0
  30. data/sig/openai/models/realtime/call_reject_params.rbs +27 -0
  31. data/sig/openai/models/responses/response_input_item.rbs +31 -2
  32. data/sig/openai/models/responses/response_item.rbs +31 -2
  33. data/sig/openai/models/responses/response_output_item.rbs +31 -2
  34. data/sig/openai/resources/realtime/calls.rbs +43 -0
  35. data/sig/openai/resources/realtime.rbs +2 -0
  36. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01342bdfdf8f3ad25ed0b3266cae9dc3022f3356ed7b6268d01164e10702ce69
4
- data.tar.gz: f49a9c99e8441520c6ed0fcfc5acac72d0622c73c811ae5462d2c4d615f66e54
3
+ metadata.gz: 3cc7790b5d1d8428b74acb0679ef3c0c181c7080b55be162ee4c3c56e27e017e
4
+ data.tar.gz: eaf55f9a450e8c4e1dd27ddabdcbb4ce304025c7028d0e02d00405d83ff752b1
5
5
  SHA512:
6
- metadata.gz: 5ce27503d671f912a27cd1e9e0dfb78088ec362aa1697c9fbaf938882bb5f7e6fc25e7c7e50b2a6b8bb7ec84acb356a9ce3756885084ddf6aa0def3f8841c245
7
- data.tar.gz: bad48c4d256ff7d274432f6361432adca1c0cba1696f75c42f656757f3cdc9bd5913c695184bb3307e9f93e360d745c87002cbc96333bd6af960a912ee19e7dd
6
+ metadata.gz: 8c3e0f6fcdbc1d7b2efb8f5674b9bec6cffa270737894dd68694f56e480ad49cb1cbe61abc93fc8321183bc737ed0bbd5980b1d15134ec5fbdad2f0983988c14
7
+ data.tar.gz: 43691a8ae3a5834efd388697ccdcfd1ee617e101c4d751353c1d37da434b4b67f9bde21efd46ae21edc92654d48055b4833d07c8aa5e6292a235729019054ef1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
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
+
11
+ ## 0.28.1 (2025-10-01)
12
+
13
+ Full Changelog: [v0.28.0...v0.28.1](https://github.com/openai/openai-ruby/compare/v0.28.0...v0.28.1)
14
+
15
+ ### Bug Fixes
16
+
17
+ * **api:** add status, approval_request_id to MCP tool call ([51622d0](https://github.com/openai/openai-ruby/commit/51622d065828bec248fb765c5bc243a058f0044d))
18
+
3
19
  ## 0.28.0 (2025-09-30)
4
20
 
5
21
  Full Changelog: [v0.27.1...v0.28.0](https://github.com/openai/openai-ruby/compare/v0.27.1...v0.28.0)
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.0"
18
+ gem "openai", "~> 0.29.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -526,6 +526,14 @@ module OpenAI
526
526
  # @return [Symbol, :mcp_call]
527
527
  required :type, const: :mcp_call
528
528
 
529
+ # @!attribute approval_request_id
530
+ # Unique identifier for the MCP tool call approval request. Include this value in
531
+ # a subsequent `mcp_approval_response` input to approve or reject the
532
+ # corresponding tool call.
533
+ #
534
+ # @return [String, nil]
535
+ optional :approval_request_id, String, nil?: true
536
+
529
537
  # @!attribute error
530
538
  # The error from the tool call, if any.
531
539
  #
@@ -538,7 +546,14 @@ module OpenAI
538
546
  # @return [String, nil]
539
547
  optional :output, String, nil?: true
540
548
 
541
- # @!method initialize(id:, arguments:, name:, server_label:, error: nil, output: nil, type: :mcp_call)
549
+ # @!attribute status
550
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
551
+ # `calling`, or `failed`.
552
+ #
553
+ # @return [Symbol, OpenAI::Models::Conversations::ConversationItem::McpCall::Status, nil]
554
+ optional :status, enum: -> { OpenAI::Conversations::ConversationItem::McpCall::Status }
555
+
556
+ # @!method initialize(id:, arguments:, name:, server_label:, approval_request_id: nil, error: nil, output: nil, status: nil, type: :mcp_call)
542
557
  # Some parameter documentations has been truncated, see
543
558
  # {OpenAI::Models::Conversations::ConversationItem::McpCall} for more details.
544
559
  #
@@ -552,11 +567,32 @@ module OpenAI
552
567
  #
553
568
  # @param server_label [String] The label of the MCP server running the tool.
554
569
  #
570
+ # @param approval_request_id [String, nil] Unique identifier for the MCP tool call approval request.
571
+ #
555
572
  # @param error [String, nil] The error from the tool call, if any.
556
573
  #
557
574
  # @param output [String, nil] The output from the tool call.
558
575
  #
576
+ # @param status [Symbol, OpenAI::Models::Conversations::ConversationItem::McpCall::Status] The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `c
577
+ #
559
578
  # @param type [Symbol, :mcp_call] The type of the item. Always `mcp_call`.
579
+
580
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
581
+ # `calling`, or `failed`.
582
+ #
583
+ # @see OpenAI::Models::Conversations::ConversationItem::McpCall#status
584
+ module Status
585
+ extend OpenAI::Internal::Type::Enum
586
+
587
+ IN_PROGRESS = :in_progress
588
+ COMPLETED = :completed
589
+ INCOMPLETE = :incomplete
590
+ CALLING = :calling
591
+ FAILED = :failed
592
+
593
+ # @!method self.values
594
+ # @return [Array<Symbol>]
595
+ end
560
596
  end
561
597
 
562
598
  # @!method self.variants
@@ -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
@@ -818,6 +818,14 @@ module OpenAI
818
818
  # @return [Symbol, :mcp_call]
819
819
  required :type, const: :mcp_call
820
820
 
821
+ # @!attribute approval_request_id
822
+ # Unique identifier for the MCP tool call approval request. Include this value in
823
+ # a subsequent `mcp_approval_response` input to approve or reject the
824
+ # corresponding tool call.
825
+ #
826
+ # @return [String, nil]
827
+ optional :approval_request_id, String, nil?: true
828
+
821
829
  # @!attribute error
822
830
  # The error from the tool call, if any.
823
831
  #
@@ -830,7 +838,14 @@ module OpenAI
830
838
  # @return [String, nil]
831
839
  optional :output, String, nil?: true
832
840
 
833
- # @!method initialize(id:, arguments:, name:, server_label:, error: nil, output: nil, type: :mcp_call)
841
+ # @!attribute status
842
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
843
+ # `calling`, or `failed`.
844
+ #
845
+ # @return [Symbol, OpenAI::Models::Responses::ResponseInputItem::McpCall::Status, nil]
846
+ optional :status, enum: -> { OpenAI::Responses::ResponseInputItem::McpCall::Status }
847
+
848
+ # @!method initialize(id:, arguments:, name:, server_label:, approval_request_id: nil, error: nil, output: nil, status: nil, type: :mcp_call)
834
849
  # Some parameter documentations has been truncated, see
835
850
  # {OpenAI::Models::Responses::ResponseInputItem::McpCall} for more details.
836
851
  #
@@ -844,11 +859,32 @@ module OpenAI
844
859
  #
845
860
  # @param server_label [String] The label of the MCP server running the tool.
846
861
  #
862
+ # @param approval_request_id [String, nil] Unique identifier for the MCP tool call approval request.
863
+ #
847
864
  # @param error [String, nil] The error from the tool call, if any.
848
865
  #
849
866
  # @param output [String, nil] The output from the tool call.
850
867
  #
868
+ # @param status [Symbol, OpenAI::Models::Responses::ResponseInputItem::McpCall::Status] The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `c
869
+ #
851
870
  # @param type [Symbol, :mcp_call] The type of the item. Always `mcp_call`.
871
+
872
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
873
+ # `calling`, or `failed`.
874
+ #
875
+ # @see OpenAI::Models::Responses::ResponseInputItem::McpCall#status
876
+ module Status
877
+ extend OpenAI::Internal::Type::Enum
878
+
879
+ IN_PROGRESS = :in_progress
880
+ COMPLETED = :completed
881
+ INCOMPLETE = :incomplete
882
+ CALLING = :calling
883
+ FAILED = :failed
884
+
885
+ # @!method self.values
886
+ # @return [Array<Symbol>]
887
+ end
852
888
  end
853
889
 
854
890
  class ItemReference < OpenAI::Internal::Type::BaseModel
@@ -508,6 +508,14 @@ module OpenAI
508
508
  # @return [Symbol, :mcp_call]
509
509
  required :type, const: :mcp_call
510
510
 
511
+ # @!attribute approval_request_id
512
+ # Unique identifier for the MCP tool call approval request. Include this value in
513
+ # a subsequent `mcp_approval_response` input to approve or reject the
514
+ # corresponding tool call.
515
+ #
516
+ # @return [String, nil]
517
+ optional :approval_request_id, String, nil?: true
518
+
511
519
  # @!attribute error
512
520
  # The error from the tool call, if any.
513
521
  #
@@ -520,7 +528,14 @@ module OpenAI
520
528
  # @return [String, nil]
521
529
  optional :output, String, nil?: true
522
530
 
523
- # @!method initialize(id:, arguments:, name:, server_label:, error: nil, output: nil, type: :mcp_call)
531
+ # @!attribute status
532
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
533
+ # `calling`, or `failed`.
534
+ #
535
+ # @return [Symbol, OpenAI::Models::Responses::ResponseItem::McpCall::Status, nil]
536
+ optional :status, enum: -> { OpenAI::Responses::ResponseItem::McpCall::Status }
537
+
538
+ # @!method initialize(id:, arguments:, name:, server_label:, approval_request_id: nil, error: nil, output: nil, status: nil, type: :mcp_call)
524
539
  # Some parameter documentations has been truncated, see
525
540
  # {OpenAI::Models::Responses::ResponseItem::McpCall} for more details.
526
541
  #
@@ -534,11 +549,32 @@ module OpenAI
534
549
  #
535
550
  # @param server_label [String] The label of the MCP server running the tool.
536
551
  #
552
+ # @param approval_request_id [String, nil] Unique identifier for the MCP tool call approval request.
553
+ #
537
554
  # @param error [String, nil] The error from the tool call, if any.
538
555
  #
539
556
  # @param output [String, nil] The output from the tool call.
540
557
  #
558
+ # @param status [Symbol, OpenAI::Models::Responses::ResponseItem::McpCall::Status] The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `c
559
+ #
541
560
  # @param type [Symbol, :mcp_call] The type of the item. Always `mcp_call`.
561
+
562
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
563
+ # `calling`, or `failed`.
564
+ #
565
+ # @see OpenAI::Models::Responses::ResponseItem::McpCall#status
566
+ module Status
567
+ extend OpenAI::Internal::Type::Enum
568
+
569
+ IN_PROGRESS = :in_progress
570
+ COMPLETED = :completed
571
+ INCOMPLETE = :incomplete
572
+ CALLING = :calling
573
+ FAILED = :failed
574
+
575
+ # @!method self.values
576
+ # @return [Array<Symbol>]
577
+ end
542
578
  end
543
579
 
544
580
  # @!method self.variants
@@ -263,6 +263,14 @@ module OpenAI
263
263
  # @return [Symbol, :mcp_call]
264
264
  required :type, const: :mcp_call
265
265
 
266
+ # @!attribute approval_request_id
267
+ # Unique identifier for the MCP tool call approval request. Include this value in
268
+ # a subsequent `mcp_approval_response` input to approve or reject the
269
+ # corresponding tool call.
270
+ #
271
+ # @return [String, nil]
272
+ optional :approval_request_id, String, nil?: true
273
+
266
274
  # @!attribute error
267
275
  # The error from the tool call, if any.
268
276
  #
@@ -275,7 +283,14 @@ module OpenAI
275
283
  # @return [String, nil]
276
284
  optional :output, String, nil?: true
277
285
 
278
- # @!method initialize(id:, arguments:, name:, server_label:, error: nil, output: nil, type: :mcp_call)
286
+ # @!attribute status
287
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
288
+ # `calling`, or `failed`.
289
+ #
290
+ # @return [Symbol, OpenAI::Models::Responses::ResponseOutputItem::McpCall::Status, nil]
291
+ optional :status, enum: -> { OpenAI::Responses::ResponseOutputItem::McpCall::Status }
292
+
293
+ # @!method initialize(id:, arguments:, name:, server_label:, approval_request_id: nil, error: nil, output: nil, status: nil, type: :mcp_call)
279
294
  # Some parameter documentations has been truncated, see
280
295
  # {OpenAI::Models::Responses::ResponseOutputItem::McpCall} for more details.
281
296
  #
@@ -289,11 +304,32 @@ module OpenAI
289
304
  #
290
305
  # @param server_label [String] The label of the MCP server running the tool.
291
306
  #
307
+ # @param approval_request_id [String, nil] Unique identifier for the MCP tool call approval request.
308
+ #
292
309
  # @param error [String, nil] The error from the tool call, if any.
293
310
  #
294
311
  # @param output [String, nil] The output from the tool call.
295
312
  #
313
+ # @param status [Symbol, OpenAI::Models::Responses::ResponseOutputItem::McpCall::Status] The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `c
314
+ #
296
315
  # @param type [Symbol, :mcp_call] The type of the item. Always `mcp_call`.
316
+
317
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
318
+ # `calling`, or `failed`.
319
+ #
320
+ # @see OpenAI::Models::Responses::ResponseOutputItem::McpCall#status
321
+ module Status
322
+ extend OpenAI::Internal::Type::Enum
323
+
324
+ IN_PROGRESS = :in_progress
325
+ COMPLETED = :completed
326
+ INCOMPLETE = :incomplete
327
+ CALLING = :calling
328
+ FAILED = :failed
329
+
330
+ # @!method self.values
331
+ # @return [Array<Symbol>]
332
+ end
297
333
  end
298
334
 
299
335
  class McpListTools < OpenAI::Internal::Type::BaseModel
@@ -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.0"
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"