openai 0.95.0 → 0.96.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 (147) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/README.md +5 -2
  4. data/docs/architecture/security-model.md +2 -2
  5. data/examples/audio/record_and_play.rb +1 -1
  6. data/lib/openai/helpers/live/transcript_grouper.rb +264 -0
  7. data/lib/openai/helpers/live/transcript_grouping.rb +309 -0
  8. data/lib/openai/helpers/live/websocket.rb +454 -0
  9. data/lib/openai/helpers/realtime/translation.rb +440 -0
  10. data/lib/openai/helpers/realtime.rb +1 -0
  11. data/lib/openai/helpers/responses_websocket/incremental.rb +246 -0
  12. data/lib/openai/helpers/responses_websocket/transports/async_websocket.rb +183 -0
  13. data/lib/openai/helpers/responses_websocket.rb +1 -0
  14. data/lib/openai/helpers/streaming/response_stream.rb +19 -11
  15. data/lib/openai/helpers/structured_output/chat_completion_parser.rb +0 -2
  16. data/lib/openai/helpers/structured_output/response_parser.rb +1 -2
  17. data/lib/openai/helpers/structured_output/union_of.rb +0 -2
  18. data/lib/openai/helpers/websocket/async_websocket_transport.rb +11 -6
  19. data/lib/openai/helpers/websocket/connection_manager.rb +9 -0
  20. data/lib/openai/internal/read_io_adapter.rb +0 -2
  21. data/lib/openai/internal/stream.rb +0 -2
  22. data/lib/openai/internal/type/base_model.rb +4 -6
  23. data/lib/openai/internal/type/converter.rb +5 -3
  24. data/lib/openai/internal/type/enum.rb +0 -2
  25. data/lib/openai/internal/type/union.rb +0 -6
  26. data/lib/openai/internal/type/unknown.rb +34 -6
  27. data/lib/openai/internal/util.rb +0 -4
  28. data/lib/openai/models/audio/speech_create_params.rb +9 -0
  29. data/lib/openai/models/audio/transcription_create_response.rb +4 -1
  30. data/lib/openai/models/audio/translation_create_response.rb +4 -1
  31. data/lib/openai/models/beta/agent.rb +1 -0
  32. data/lib/openai/models/beta/agent_create_params.rb +3 -0
  33. data/lib/openai/models/beta/agent_session.rb +1 -0
  34. data/lib/openai/models/beta/agent_update_params.rb +3 -0
  35. data/lib/openai/models/beta/agents/environments/template_create_params.rb +3 -3
  36. data/lib/openai/models/beta/agents/environments/template_update_params.rb +6 -6
  37. data/lib/openai/models/beta/agents/session_create_params.rb +3 -0
  38. data/lib/openai/models/beta/agents/session_update_params.rb +3 -0
  39. data/lib/openai/models/beta/agents/vaults/credential.rb +10 -1
  40. data/lib/openai/models/beta/agents/vaults/credential_create_params.rb +12 -1
  41. data/lib/openai/models/beta/agents/vaults/credential_update_params.rb +14 -3
  42. data/lib/openai/models/beta/beta_response.rb +38 -1
  43. data/lib/openai/models/beta/beta_responses_client_event.rb +73 -1
  44. data/lib/openai/models/beta/beta_web_search_preview_tool.rb +9 -3
  45. data/lib/openai/models/beta/beta_web_search_tool.rb +9 -3
  46. data/lib/openai/models/beta/environment_param.rb +3 -3
  47. data/lib/openai/models/beta/response_compact_params.rb +3 -0
  48. data/lib/openai/models/beta/response_create_params.rb +68 -1
  49. data/lib/openai/models/beta/session_turn_error.rb +3 -0
  50. data/lib/openai/models/chat_model.rb +1 -0
  51. data/lib/openai/models/responses/response.rb +35 -1
  52. data/lib/openai/models/responses/response_compact_params.rb +3 -0
  53. data/lib/openai/models/responses/response_create_params.rb +65 -1
  54. data/lib/openai/models/responses/responses_client_event.rb +70 -1
  55. data/lib/openai/models/responses/web_search_preview_tool.rb +9 -3
  56. data/lib/openai/models/responses/web_search_tool.rb +9 -3
  57. data/lib/openai/net_http_client.rb +0 -2
  58. data/lib/openai/resources/audio/transcriptions.rb +5 -3
  59. data/lib/openai/resources/audio/translations.rb +1 -1
  60. data/lib/openai/resources/beta/agents/environments/templates.rb +3 -3
  61. data/lib/openai/resources/beta/agents/vaults/credentials.rb +12 -4
  62. data/lib/openai/resources/beta/responses.rb +8 -2
  63. data/lib/openai/resources/responses.rb +8 -1
  64. data/lib/openai/version.rb +1 -1
  65. data/lib/openai.rb +1 -0
  66. data/rbi/openai/helpers/live/transcript_grouper.rbi +67 -0
  67. data/rbi/openai/helpers/live/websocket.rbi +299 -0
  68. data/rbi/openai/helpers/realtime/translation.rbi +137 -0
  69. data/rbi/openai/helpers/responses_websocket/incremental.rbi +32 -0
  70. data/rbi/openai/helpers/responses_websocket/transports/async_websocket.rbi +24 -0
  71. data/rbi/openai/helpers/streaming/response_stream.rbi +5 -0
  72. data/rbi/openai/internal/type/converter.rbi +3 -2
  73. data/rbi/openai/models/audio/speech_create_params.rbi +3 -0
  74. data/rbi/openai/models/audio/transcription_create_response.rbi +2 -1
  75. data/rbi/openai/models/audio/translation_create_response.rbi +2 -1
  76. data/rbi/openai/models/beta/agent.rbi +1 -0
  77. data/rbi/openai/models/beta/agent_create_params.rbi +3 -0
  78. data/rbi/openai/models/beta/agent_session.rbi +1 -0
  79. data/rbi/openai/models/beta/agent_update_params.rbi +3 -0
  80. data/rbi/openai/models/beta/agents/environments/template_create_params.rbi +3 -3
  81. data/rbi/openai/models/beta/agents/environments/template_update_params.rbi +6 -6
  82. data/rbi/openai/models/beta/agents/session_create_params.rbi +3 -0
  83. data/rbi/openai/models/beta/agents/session_update_params.rbi +3 -0
  84. data/rbi/openai/models/beta/agents/vaults/credential.rbi +10 -0
  85. data/rbi/openai/models/beta/agents/vaults/credential_create_params.rbi +15 -0
  86. data/rbi/openai/models/beta/agents/vaults/credential_update_params.rbi +35 -6
  87. data/rbi/openai/models/beta/beta_response.rbi +64 -0
  88. data/rbi/openai/models/beta/beta_responses_client_event.rbi +128 -0
  89. data/rbi/openai/models/beta/beta_web_search_preview_tool.rbi +9 -3
  90. data/rbi/openai/models/beta/beta_web_search_tool.rbi +9 -3
  91. data/rbi/openai/models/beta/environment_param.rbi +3 -3
  92. data/rbi/openai/models/beta/response_compact_params.rbi +1 -0
  93. data/rbi/openai/models/beta/response_create_params.rbi +100 -0
  94. data/rbi/openai/models/beta/session_turn_error.rbi +6 -0
  95. data/rbi/openai/models/chat_model.rbi +1 -0
  96. data/rbi/openai/models/responses/response.rbi +63 -0
  97. data/rbi/openai/models/responses/response_compact_params.rbi +1 -0
  98. data/rbi/openai/models/responses/response_create_params.rbi +106 -0
  99. data/rbi/openai/models/responses/responses_client_event.rbi +125 -0
  100. data/rbi/openai/models/responses/web_search_preview_tool.rbi +9 -3
  101. data/rbi/openai/models/responses/web_search_tool.rbi +9 -3
  102. data/rbi/openai/resources/audio/transcriptions.rbi +4 -2
  103. data/rbi/openai/resources/beta/agents/environments/templates.rbi +3 -3
  104. data/rbi/openai/resources/beta/agents/vaults/credentials.rbi +11 -3
  105. data/rbi/openai/resources/beta/responses.rbi +6 -0
  106. data/rbi/openai/resources/responses.rbi +11 -0
  107. data/responses-websocket.md +55 -0
  108. data/sig/openai/helpers/live/transcript_grouper.rbs +42 -0
  109. data/sig/openai/helpers/live/websocket.rbs +152 -0
  110. data/sig/openai/helpers/realtime/translation.rbs +81 -0
  111. data/sig/openai/helpers/responses_websocket/incremental.rbs +14 -0
  112. data/sig/openai/helpers/responses_websocket/transports/async_websocket.rbs +21 -0
  113. data/sig/openai/helpers/streaming/response_stream.rbs +9 -0
  114. data/sig/openai/internal/type/converter.rbs +3 -1
  115. data/sig/openai/models/audio/speech_create_params.rbs +6 -0
  116. data/sig/openai/models/audio/transcription_create_response.rbs +1 -0
  117. data/sig/openai/models/audio/translation_create_response.rbs +3 -1
  118. data/sig/openai/models/beta/agent.rbs +3 -1
  119. data/sig/openai/models/beta/agent_create_params.rbs +5 -1
  120. data/sig/openai/models/beta/agent_session.rbs +3 -1
  121. data/sig/openai/models/beta/agent_update_params.rbs +5 -1
  122. data/sig/openai/models/beta/agents/environments/template_create_params.rbs +2 -2
  123. data/sig/openai/models/beta/agents/environments/template_update_params.rbs +4 -4
  124. data/sig/openai/models/beta/agents/session_create_params.rbs +5 -1
  125. data/sig/openai/models/beta/agents/session_update_params.rbs +5 -1
  126. data/sig/openai/models/beta/agents/vaults/credential.rbs +8 -0
  127. data/sig/openai/models/beta/agents/vaults/credential_create_params.rbs +14 -0
  128. data/sig/openai/models/beta/agents/vaults/credential_update_params.rbs +23 -4
  129. data/sig/openai/models/beta/beta_response.rbs +37 -0
  130. data/sig/openai/models/beta/beta_responses_client_event.rbs +79 -0
  131. data/sig/openai/models/beta/beta_web_search_preview_tool.rbs +6 -2
  132. data/sig/openai/models/beta/beta_web_search_tool.rbs +6 -2
  133. data/sig/openai/models/beta/environment_param.rbs +2 -2
  134. data/sig/openai/models/beta/response_compact_params.rbs +2 -0
  135. data/sig/openai/models/beta/response_create_params.rbs +79 -0
  136. data/sig/openai/models/beta/session_turn_error.rbs +4 -0
  137. data/sig/openai/models/chat_model.rbs +2 -0
  138. data/sig/openai/models/responses/response.rbs +35 -0
  139. data/sig/openai/models/responses/response_compact_params.rbs +2 -0
  140. data/sig/openai/models/responses/response_create_params.rbs +77 -0
  141. data/sig/openai/models/responses/responses_client_event.rbs +77 -0
  142. data/sig/openai/models/responses/web_search_preview_tool.rbs +6 -2
  143. data/sig/openai/models/responses/web_search_tool.rbs +6 -2
  144. data/sig/openai/resources/beta/agents/vaults/credentials.rbs +3 -1
  145. data/sig/openai/resources/beta/responses.rbs +2 -0
  146. data/sig/openai/resources/responses.rbs +4 -0
  147. metadata +14 -1
@@ -6,6 +6,7 @@ module OpenAI
6
6
  extend OpenAI::Internal::Type::Enum
7
7
 
8
8
  GPT_6_ASTRA = :"gpt-6-astra"
9
+ GPT_6_1_SOL = :"gpt-6.1-sol"
9
10
  GPT_6_SOL = :"gpt-6-sol"
10
11
  GPT_6_LUNA = :"gpt-6-luna"
11
12
  GPT_5_6_SOL = :"gpt-5.6-sol"
@@ -13,6 +13,11 @@ module OpenAI
13
13
  # @return [String]
14
14
  required :id, String
15
15
 
16
+ # @!attribute access_programs
17
+ #
18
+ # @return [OpenAI::Models::Responses::Response::AccessPrograms, nil]
19
+ required :access_programs, -> { OpenAI::Responses::Response::AccessPrograms }, nil?: true
20
+
16
21
  # @!attribute created_at
17
22
  # Unix timestamp (in seconds) of when this Response was created.
18
23
  #
@@ -374,10 +379,12 @@ module OpenAI
374
379
  texts.join
375
380
  end
376
381
 
377
- # @!method initialize(id:, created_at:, error:, incomplete_details:, instructions:, metadata:, model:, output:, parallel_tool_calls:, temperature:, tool_choice:, tools:, top_p:, background: nil, completed_at: nil, conversation: nil, max_output_tokens: nil, max_tool_calls: nil, moderation: nil, previous_response_id: nil, prompt: nil, prompt_cache_diagnostics: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, status: nil, text: nil, top_logprobs: nil, truncation: nil, usage: nil, user: nil, object: :response)
382
+ # @!method initialize(id:, access_programs:, created_at:, error:, incomplete_details:, instructions:, metadata:, model:, output:, parallel_tool_calls:, temperature:, tool_choice:, tools:, top_p:, background: nil, completed_at: nil, conversation: nil, max_output_tokens: nil, max_tool_calls: nil, moderation: nil, previous_response_id: nil, prompt: nil, prompt_cache_diagnostics: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, status: nil, text: nil, top_logprobs: nil, truncation: nil, usage: nil, user: nil, object: :response)
378
383
  # @param id [String]
379
384
  # Unique identifier for this Response.
380
385
  #
386
+ # @param access_programs [OpenAI::Models::Responses::Response::AccessPrograms, nil]
387
+ #
381
388
  # @param created_at [Float]
382
389
  # Unix timestamp (in seconds) of when this Response was created.
383
390
  #
@@ -608,6 +615,33 @@ module OpenAI
608
615
  # @param object [Symbol, :response]
609
616
  # The object type of this resource - always set to `response`.
610
617
 
618
+ # @see OpenAI::Models::Responses::Response#access_programs
619
+ class AccessPrograms < OpenAI::Internal::Type::BaseModel
620
+ # @!attribute cyber
621
+ # The effective Cyber access program used for this response.
622
+ #
623
+ # @return [Symbol, OpenAI::Models::Responses::Response::AccessPrograms::Cyber]
624
+ required :cyber, enum: -> { OpenAI::Responses::Response::AccessPrograms::Cyber }
625
+
626
+ # @!method initialize(cyber:)
627
+ # @param cyber [Symbol, OpenAI::Models::Responses::Response::AccessPrograms::Cyber]
628
+ # The effective Cyber access program used for this response.
629
+
630
+ # The effective Cyber access program used for this response.
631
+ #
632
+ # @see OpenAI::Models::Responses::Response::AccessPrograms#cyber
633
+ module Cyber
634
+ extend OpenAI::Internal::Type::Enum
635
+
636
+ STANDARD = :standard
637
+ DAYBREAK_BLUE = :daybreak_blue
638
+ DAYBREAK_RED = :daybreak_red
639
+
640
+ # @!method self.values
641
+ # @return [Array<Symbol>]
642
+ end
643
+ end
644
+
611
645
  # @see OpenAI::Models::Responses::Response#incomplete_details
612
646
  class IncompleteDetails < OpenAI::Internal::Type::BaseModel
613
647
  # @!attribute reason
@@ -169,6 +169,8 @@ module OpenAI
169
169
 
170
170
  variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_6_ASTRA }
171
171
 
172
+ variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_6_1_SOL }
173
+
172
174
  variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_6_SOL }
173
175
 
174
176
  variant const: -> { OpenAI::Models::Responses::ResponseCompactParams::Model::GPT_6_LUNA }
@@ -413,6 +415,7 @@ module OpenAI
413
415
  # @!group
414
416
 
415
417
  GPT_6_ASTRA = :"gpt-6-astra"
418
+ GPT_6_1_SOL = :"gpt-6.1-sol"
416
419
  GPT_6_SOL = :"gpt-6-sol"
417
420
  GPT_6_LUNA = :"gpt-6-luna"
418
421
  GPT_5_6_SOL = :"gpt-5.6-sol"
@@ -10,6 +10,12 @@ module OpenAI
10
10
  extend OpenAI::Internal::Type::RequestParameters::Converter
11
11
  include OpenAI::Internal::Type::RequestParameters
12
12
 
13
+ # @!attribute access_programs
14
+ # Domain-specific access programs to use for this request.
15
+ #
16
+ # @return [OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms, nil]
17
+ optional :access_programs, -> { OpenAI::Responses::ResponseCreateParams::AccessPrograms }
18
+
13
19
  # @!attribute background
14
20
  # Whether to run the model response in the background.
15
21
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
@@ -379,7 +385,10 @@ module OpenAI
379
385
  # @return [String, nil]
380
386
  optional :user, String
381
387
 
382
- # @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
388
+ # @!method initialize(access_programs: nil, background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
389
+ # @param access_programs [OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms]
390
+ # Domain-specific access programs to use for this request.
391
+ #
383
392
  # @param background [Boolean, nil]
384
393
  # Whether to run the model response in the background.
385
394
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
@@ -627,6 +636,61 @@ module OpenAI
627
636
  #
628
637
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
629
638
 
639
+ class AccessPrograms < OpenAI::Internal::Type::BaseModel
640
+ # @!attribute cyber
641
+ # The Cyber access program to use for this request. Supported values are
642
+ # `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves
643
+ # the program from the model's Cyber tier and your organization and project
644
+ # access, subject to model-specific eligibility restrictions. By default, models
645
+ # without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when
646
+ # authorized; otherwise they fall back to Standard unless the model requires
647
+ # Daybreak access. Red-tier models use Daybreak Red and require authorization.
648
+ # Requests that require unavailable Daybreak access return 403. An implicit
649
+ # Standard fallback is represented by null in the response's access_programs
650
+ # field, rather than an explicit Standard selection.
651
+ #
652
+ # @return [Symbol, OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms::Cyber, nil]
653
+ optional :cyber, enum: -> { OpenAI::Responses::ResponseCreateParams::AccessPrograms::Cyber }
654
+
655
+ # @!method initialize(cyber: nil)
656
+ # Domain-specific access programs to use for this request.
657
+ #
658
+ # @param cyber [Symbol, OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms::Cyber]
659
+ # The Cyber access program to use for this request. Supported values are
660
+ # `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves
661
+ # the program from the model's Cyber tier and your organization and project
662
+ # access, subject to model-specific eligibility restrictions. By default, models
663
+ # without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when
664
+ # authorized; otherwise they fall back to Standard unless the model requires
665
+ # Daybreak access. Red-tier models use Daybreak Red and require authorization.
666
+ # Requests that require unavailable Daybreak access return 403. An implicit
667
+ # Standard fallback is represented by null in the response's access_programs
668
+ # field, rather than an explicit Standard selection.
669
+
670
+ # The Cyber access program to use for this request. Supported values are
671
+ # `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves
672
+ # the program from the model's Cyber tier and your organization and project
673
+ # access, subject to model-specific eligibility restrictions. By default, models
674
+ # without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when
675
+ # authorized; otherwise they fall back to Standard unless the model requires
676
+ # Daybreak access. Red-tier models use Daybreak Red and require authorization.
677
+ # Requests that require unavailable Daybreak access return 403. An implicit
678
+ # Standard fallback is represented by null in the response's access_programs
679
+ # field, rather than an explicit Standard selection.
680
+ #
681
+ # @see OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms#cyber
682
+ module Cyber
683
+ extend OpenAI::Internal::Type::Enum
684
+
685
+ STANDARD = :standard
686
+ DAYBREAK_BLUE = :daybreak_blue
687
+ DAYBREAK_RED = :daybreak_red
688
+
689
+ # @!method self.values
690
+ # @return [Array<Symbol>]
691
+ end
692
+ end
693
+
630
694
  class ContextManagement < OpenAI::Internal::Type::BaseModel
631
695
  # @!attribute type
632
696
  # The context management entry type. Currently only 'compaction' is supported.
@@ -56,6 +56,12 @@ module OpenAI
56
56
  # @return [Symbol, :"response.create"]
57
57
  required :type, const: :"response.create"
58
58
 
59
+ # @!attribute access_programs
60
+ # Domain-specific access programs to use for this request.
61
+ #
62
+ # @return [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::AccessPrograms, nil]
63
+ optional :access_programs, -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::AccessPrograms }
64
+
59
65
  # @!attribute background
60
66
  # Whether to run the model response in the background.
61
67
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
@@ -457,7 +463,7 @@ module OpenAI
457
463
  # @return [String, nil]
458
464
  optional :user, String
459
465
 
460
- # @!method initialize(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream: nil, stream_id: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, type: :"response.create")
466
+ # @!method initialize(access_programs: nil, background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream: nil, stream_id: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, type: :"response.create")
461
467
  # Client event for creating a response over a persistent WebSocket connection.
462
468
  # This payload uses the same top-level fields as `POST /v1/responses`, plus
463
469
  # WebSocket-only envelope metadata.
@@ -468,6 +474,9 @@ module OpenAI
468
474
  # - `background` is not supported over WebSocket.
469
475
  # - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`.
470
476
  #
477
+ # @param access_programs [OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::AccessPrograms]
478
+ # Domain-specific access programs to use for this request.
479
+ #
471
480
  # @param background [Boolean, nil]
472
481
  # Whether to run the model response in the background.
473
482
  # [Learn more](https://developers.openai.com/api/docs/guides/background).
@@ -730,6 +739,66 @@ module OpenAI
730
739
  #
731
740
  # @param type [Symbol, :"response.create"]
732
741
  # The type of the client event. Always `response.create`.
742
+
743
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate#access_programs
744
+ class AccessPrograms < OpenAI::Internal::Type::BaseModel
745
+ # @!attribute cyber
746
+ # The Cyber access program to use for this request. Supported values are
747
+ # `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves
748
+ # the program from the model's Cyber tier and your organization and project
749
+ # access, subject to model-specific eligibility restrictions. By default, models
750
+ # without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when
751
+ # authorized; otherwise they fall back to Standard unless the model requires
752
+ # Daybreak access. Red-tier models use Daybreak Red and require authorization.
753
+ # Requests that require unavailable Daybreak access return 403. An implicit
754
+ # Standard fallback is represented by null in the response's access_programs
755
+ # field, rather than an explicit Standard selection.
756
+ #
757
+ # @return [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::AccessPrograms::Cyber, nil]
758
+ optional(
759
+ :cyber,
760
+ enum: -> { OpenAI::Responses::ResponsesClientEvent::ResponseCreate::AccessPrograms::Cyber }
761
+ )
762
+
763
+ # @!method initialize(cyber: nil)
764
+ # Domain-specific access programs to use for this request.
765
+ #
766
+ # @param cyber [Symbol, OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::AccessPrograms::Cyber]
767
+ # The Cyber access program to use for this request. Supported values are
768
+ # `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves
769
+ # the program from the model's Cyber tier and your organization and project
770
+ # access, subject to model-specific eligibility restrictions. By default, models
771
+ # without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when
772
+ # authorized; otherwise they fall back to Standard unless the model requires
773
+ # Daybreak access. Red-tier models use Daybreak Red and require authorization.
774
+ # Requests that require unavailable Daybreak access return 403. An implicit
775
+ # Standard fallback is represented by null in the response's access_programs
776
+ # field, rather than an explicit Standard selection.
777
+
778
+ # The Cyber access program to use for this request. Supported values are
779
+ # `standard`, `daybreak_blue`, and `daybreak_red`. If omitted, the API resolves
780
+ # the program from the model's Cyber tier and your organization and project
781
+ # access, subject to model-specific eligibility restrictions. By default, models
782
+ # without a Cyber tier use Standard. Blue-tier models use Daybreak Blue when
783
+ # authorized; otherwise they fall back to Standard unless the model requires
784
+ # Daybreak access. Red-tier models use Daybreak Red and require authorization.
785
+ # Requests that require unavailable Daybreak access return 403. An implicit
786
+ # Standard fallback is represented by null in the response's access_programs
787
+ # field, rather than an explicit Standard selection.
788
+ #
789
+ # @see OpenAI::Models::Responses::ResponsesClientEvent::ResponseCreate::AccessPrograms#cyber
790
+ module Cyber
791
+ extend OpenAI::Internal::Type::Enum
792
+
793
+ STANDARD = :standard
794
+ DAYBREAK_BLUE = :daybreak_blue
795
+ DAYBREAK_RED = :daybreak_red
796
+
797
+ # @!method self.values
798
+ # @return [Array<Symbol>]
799
+ end
800
+ end
801
+
733
802
  class ContextManagement < OpenAI::Internal::Type::BaseModel
734
803
  # @!attribute type
735
804
  # The context management entry type. Currently only 'compaction' is supported.
@@ -27,7 +27,9 @@ module OpenAI
27
27
  optional :search_context_size, enum: -> { OpenAI::Responses::WebSearchPreviewTool::SearchContextSize }
28
28
 
29
29
  # @!attribute user_location
30
- # The user's location.
30
+ # The approximate location of the user. If omitted or null, defaults to the United
31
+ # States. To avoid this fallback, pass `{"type": "approximate"}` without location
32
+ # fields. To localize results, provide the relevant location fields.
31
33
  #
32
34
  # @return [OpenAI::Models::Responses::WebSearchPreviewTool::UserLocation, nil]
33
35
  optional :user_location, -> { OpenAI::Responses::WebSearchPreviewTool::UserLocation }, nil?: true
@@ -48,7 +50,9 @@ module OpenAI
48
50
  # search. One of `low`, `medium`, or `high`. `medium` is the default.
49
51
  #
50
52
  # @param user_location [OpenAI::Models::Responses::WebSearchPreviewTool::UserLocation, nil]
51
- # The user's location.
53
+ # The approximate location of the user. If omitted or null, defaults to the United
54
+ # States. To avoid this fallback, pass `{"type": "approximate"}` without location
55
+ # fields. To localize results, provide the relevant location fields.
52
56
 
53
57
  # The type of the web search tool. One of `web_search_preview` or
54
58
  # `web_search_preview_2025_03_11`.
@@ -124,7 +128,9 @@ module OpenAI
124
128
  optional :timezone, String, nil?: true
125
129
 
126
130
  # @!method initialize(city: nil, country: nil, region: nil, timezone: nil, type: :approximate)
127
- # The user's location.
131
+ # The approximate location of the user. If omitted or null, defaults to the United
132
+ # States. To avoid this fallback, pass `{"type": "approximate"}` without location
133
+ # fields. To localize results, provide the relevant location fields.
128
134
  #
129
135
  # @param city [String, nil]
130
136
  # Free text input for the city of the user, e.g. `San Francisco`.
@@ -32,7 +32,9 @@ module OpenAI
32
32
  optional :search_context_size, enum: -> { OpenAI::Responses::WebSearchTool::SearchContextSize }
33
33
 
34
34
  # @!attribute user_location
35
- # The approximate location of the user.
35
+ # The approximate location of the user. If omitted or null, defaults to the United
36
+ # States. To avoid this fallback, pass `{"type": "approximate"}` without location
37
+ # fields. To localize results, provide the relevant location fields.
36
38
  #
37
39
  # @return [OpenAI::Models::Responses::WebSearchTool::UserLocation, nil]
38
40
  optional :user_location, -> { OpenAI::Responses::WebSearchTool::UserLocation }, nil?: true
@@ -57,7 +59,9 @@ module OpenAI
57
59
  # search. One of `low`, `medium`, or `high`. `medium` is the default.
58
60
  #
59
61
  # @param user_location [OpenAI::Models::Responses::WebSearchTool::UserLocation, nil]
60
- # The approximate location of the user.
62
+ # The approximate location of the user. If omitted or null, defaults to the United
63
+ # States. To avoid this fallback, pass `{"type": "approximate"}` without location
64
+ # fields. To localize results, provide the relevant location fields.
61
65
 
62
66
  # The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.
63
67
  #
@@ -143,7 +147,9 @@ module OpenAI
143
147
  optional :type, enum: -> { OpenAI::Responses::WebSearchTool::UserLocation::Type }
144
148
 
145
149
  # @!method initialize(city: nil, country: nil, region: nil, timezone: nil, type: nil)
146
- # The approximate location of the user.
150
+ # The approximate location of the user. If omitted or null, defaults to the United
151
+ # States. To avoid this fallback, pass `{"type": "approximate"}` without location
152
+ # fields. To localize results, provide the relevant location fields.
147
153
  #
148
154
  # @param city [String, nil]
149
155
  # Free text input for the city of the user, e.g. `San Francisco`.
@@ -246,7 +246,6 @@ module OpenAI
246
246
  finished = false
247
247
  request_may_have_been_sent = false
248
248
 
249
- # rubocop:disable Metrics/BlockLength
250
249
  enum = Enumerator.new do |y|
251
250
  next if finished
252
251
 
@@ -331,7 +330,6 @@ module OpenAI
331
330
  )
332
331
  )
333
332
  end
334
- # rubocop:enable Metrics/BlockLength
335
333
 
336
334
  _, response = enum.next
337
335
  body = OpenAI::Internal::Util.fused_enum(enum, external: true) do
@@ -11,7 +11,8 @@ module OpenAI
11
11
  # Transcribes audio into the input language.
12
12
  #
13
13
  # Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
14
- # format, or a stream of transcript events.
14
+ # format, plain text in `text`, `srt`, or `vtt` format, or a stream of transcript
15
+ # events. Supported formats depend on the model.
15
16
  #
16
17
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
17
18
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
@@ -108,7 +109,7 @@ module OpenAI
108
109
  #
109
110
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
110
111
  #
111
- # @return [OpenAI::Models::Audio::Transcription, OpenAI::Models::Audio::TranscriptionDiarized, OpenAI::Models::Audio::TranscriptionVerbose]
112
+ # @return [OpenAI::Models::Audio::Transcription, OpenAI::Models::Audio::TranscriptionDiarized, OpenAI::Models::Audio::TranscriptionVerbose, StringIO]
112
113
  #
113
114
  # @see OpenAI::Models::Audio::TranscriptionCreateParams
114
115
  def create(params)
@@ -135,7 +136,8 @@ module OpenAI
135
136
  # Transcribes audio into the input language.
136
137
  #
137
138
  # Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
138
- # format, or a stream of transcript events.
139
+ # format, plain text in `text`, `srt`, or `vtt` format, or a stream of transcript
140
+ # events. Supported formats depend on the model.
139
141
  #
140
142
  # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
141
143
  # metadata. Use `OpenAI::FilePart` when you need to override the filename or
@@ -46,7 +46,7 @@ module OpenAI
46
46
  #
47
47
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
48
48
  #
49
- # @return [OpenAI::Models::Audio::Translation, OpenAI::Models::Audio::TranslationVerbose]
49
+ # @return [OpenAI::Models::Audio::Translation, OpenAI::Models::Audio::TranslationVerbose, StringIO]
50
50
  #
51
51
  # @see OpenAI::Models::Audio::TranslationCreateParams
52
52
  def create(params)
@@ -27,7 +27,7 @@ module OpenAI
27
27
  #
28
28
  # @param network [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network, nil]
29
29
  # Network access policy for the environment. Defaults to disabled for GA requests
30
- # and enabled for alpha/beta requests.
30
+ # and enabled for beta requests.
31
31
  #
32
32
  # @param packages [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Packages, nil]
33
33
  # Packages to install in the environment. Defaults to empty package lists.
@@ -106,8 +106,8 @@ module OpenAI
106
106
  #
107
107
  # @param network [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network, nil]
108
108
  # Network access available after setup completes. Omit to preserve the current
109
- # policy, or pass `null` to reset to disabled for GA requests or enabled for
110
- # alpha/beta requests.
109
+ # policy, or pass `null` to reset to disabled for GA requests or enabled for beta
110
+ # requests.
111
111
  #
112
112
  # @param packages [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Packages, nil]
113
113
  # Packages installed before the runtime network policy applies.
@@ -10,7 +10,7 @@ module OpenAI
10
10
  # See
11
11
  # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).
12
12
  #
13
- # @overload create(vault_id, auth:, name:, request_options: {})
13
+ # @overload create(vault_id, auth:, name:, metadata: nil, request_options: {})
14
14
  #
15
15
  # @param vault_id [String]
16
16
  # The ID of the vault.
@@ -22,6 +22,10 @@ module OpenAI
22
22
  # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after
23
23
  # trimming.
24
24
  #
25
+ # @param metadata [Hash{Symbol=>String}]
26
+ # Up to 16 string key-value pairs, with keys up to 64 and values up to 512
27
+ # characters. Defaults to an empty map.
28
+ #
25
29
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
26
30
  #
27
31
  # @return [OpenAI::Models::Beta::Agents::Vaults::Credential]
@@ -70,11 +74,10 @@ module OpenAI
70
74
  )
71
75
  end
72
76
 
73
- # Rotates a vault credential's write-only secret and returns only credential
74
- # metadata. See
77
+ # Updates credential metadata or rotates its write-only secret. See
75
78
  # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults).
76
79
  #
77
- # @overload update(credential_id, vault_id:, auth:, request_options: {})
80
+ # @overload update(credential_id, vault_id:, auth: nil, metadata: nil, request_options: {})
78
81
  #
79
82
  # @param credential_id [String]
80
83
  # Path param: The ID of the vault credential.
@@ -86,6 +89,11 @@ module OpenAI
86
89
  # Body param: Replacement values for the credential's existing authentication
87
90
  # method.
88
91
  #
92
+ # @param metadata [Hash{Symbol=>String}]
93
+ # Body param: Replaces all metadata. Omit to preserve it, or pass {} to clear it.
94
+ # Up to 16 string key-value pairs, with keys up to 64 and values up to 512
95
+ # characters.
96
+ #
89
97
  # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
90
98
  #
91
99
  # @return [OpenAI::Models::Beta::Agents::Vaults::Credential]
@@ -27,7 +27,10 @@ module OpenAI
27
27
  # [file search](https://developers.openai.com/api/docs/guides/tools-file-search)
28
28
  # to use your own data as input for the model's response.
29
29
  #
30
- # @overload create(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, multi_agent: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, betas: nil, request_options: {})
30
+ # @overload create(access_programs: nil, background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, multi_agent: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, betas: nil, request_options: {})
31
+ #
32
+ # @param access_programs [OpenAI::Models::Beta::ResponseCreateParams::AccessPrograms]
33
+ # Body param: Domain-specific access programs to use for this request.
31
34
  #
32
35
  # @param background [Boolean, nil]
33
36
  # Body param: Whether to run the model response in the background.
@@ -325,7 +328,10 @@ module OpenAI
325
328
  # [file search](https://developers.openai.com/api/docs/guides/tools-file-search)
326
329
  # to use your own data as input for the model's response.
327
330
  #
328
- # @overload stream_raw(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, multi_agent: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, betas: nil, request_options: {})
331
+ # @overload stream_raw(access_programs: nil, background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, multi_agent: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, betas: nil, request_options: {})
332
+ #
333
+ # @param access_programs [OpenAI::Models::Beta::ResponseCreateParams::AccessPrograms]
334
+ # Body param: Domain-specific access programs to use for this request.
329
335
  #
330
336
  # @param background [Boolean, nil]
331
337
  # Body param: Whether to run the model response in the background.
@@ -28,7 +28,10 @@ module OpenAI
28
28
  # [file search](https://developers.openai.com/api/docs/guides/tools-file-search)
29
29
  # to use your own data as input for the model's response.
30
30
  #
31
- # @overload create(background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
31
+ # @overload create(access_programs: nil, background: nil, context_management: nil, conversation: nil, include: nil, input: nil, instructions: nil, max_output_tokens: nil, max_tool_calls: nil, metadata: nil, model: nil, moderation: nil, parallel_tool_calls: nil, previous_response_id: nil, prompt: nil, prompt_cache_key: nil, prompt_cache_options: nil, prompt_cache_retention: nil, reasoning: nil, safety_identifier: nil, service_tier: nil, store: nil, stream_options: nil, temperature: nil, text: nil, tool_choice: nil, tools: nil, top_logprobs: nil, top_p: nil, truncation: nil, user: nil, request_options: {})
32
+ #
33
+ # @param access_programs [OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms]
34
+ # Domain-specific access programs to use for this request.
32
35
  #
33
36
  # @param background [Boolean, nil]
34
37
  # Whether to run the model response in the background.
@@ -305,6 +308,10 @@ module OpenAI
305
308
  end
306
309
 
307
310
  # Creates or resumes a streaming response and parses structured outputs.
311
+ # @overload stream(access_programs: nil, **params)
312
+ # @param access_programs [OpenAI::Models::Responses::ResponseCreateParams::AccessPrograms]
313
+ # Domain-specific access programs to use for this request.
314
+ # @param params [Hash{Symbol=>Object}] Other response creation or retrieval parameters.
308
315
  def stream(params)
309
316
  parsed, options = OpenAI::Responses::ResponseCreateParams.dump_request(params)
310
317
  starting_after, response_id = parsed.values_at(:starting_after, :response_id)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.95.0"
4
+ VERSION = "0.96.0"
5
5
  end
data/lib/openai.rb CHANGED
@@ -1594,6 +1594,7 @@ require_relative "openai/streaming"
1594
1594
  require_relative "openai/helpers/websocket"
1595
1595
  require_relative "openai/helpers/realtime"
1596
1596
  require_relative "openai/helpers/responses_websocket"
1597
+ require_relative "openai/helpers/live/websocket"
1597
1598
 
1598
1599
  require_relative "openai/helpers/agents/session_stream"
1599
1600
  require_relative "openai/helpers/agents/message"
@@ -0,0 +1,67 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ class TranscriptGrouper
7
+ class Segment < Data
8
+ sig { returns(String) }
9
+ attr_reader :id
10
+
11
+ sig { returns(T.nilable(String)) }
12
+ attr_reader :previous_id
13
+
14
+ # :user or :assistant
15
+ sig { returns(Symbol) }
16
+ attr_reader :speaker
17
+
18
+ sig { returns(String) }
19
+ attr_reader :text
20
+
21
+ sig { returns(Integer) }
22
+ attr_reader :start_ms, :end_ms
23
+ end
24
+
25
+ class ClosedSegment < Data
26
+ sig { returns(Segment) }
27
+ attr_reader :segment
28
+
29
+ # :speaker_change, :inactivity, :timestamp_reset, :session_closed or :manual
30
+ sig { returns(Symbol) }
31
+ attr_reader :reason
32
+ end
33
+
34
+ sig do
35
+ params(
36
+ on_segment_updated: T.nilable(T.proc.params(segment: Segment).void),
37
+ on_segment_closed: T.nilable(T.proc.params(event: ClosedSegment).void),
38
+ min_turn_separation_ms: T.any(Integer, Float),
39
+ assistant_silence_ms: T.any(Integer, Float),
40
+ backchannel_max_duration_ms: T.any(Integer, Float),
41
+ backchannel_isolation_ms: T.any(Integer, Float),
42
+ additional_acknowledgments: T::Array[String]
43
+ )
44
+ .returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ on_segment_updated: nil,
48
+ on_segment_closed: nil,
49
+ min_turn_separation_ms: 500,
50
+ assistant_silence_ms: 2000,
51
+ backchannel_max_duration_ms: 1000,
52
+ backchannel_isolation_ms: 2000,
53
+ additional_acknowledgments: []
54
+ )
55
+ end
56
+
57
+ sig { params(event: T.anything).void }
58
+ def push(event)
59
+ end
60
+
61
+ sig { void }
62
+ def close
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end