openai 0.97.0 → 0.98.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 (112) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/README.md +76 -1
  4. data/lib/openai/helpers/agents/session_stream.rb +60 -3
  5. data/lib/openai/helpers/beta/agents/artifacts.rb +72 -0
  6. data/lib/openai/helpers/beta/agents/creation_stream.rb +69 -0
  7. data/lib/openai/helpers/beta/agents/files.rb +236 -0
  8. data/lib/openai/helpers/beta/agents/function_tool.rb +65 -0
  9. data/lib/openai/helpers/beta/agents/model_adapter.rb +27 -0
  10. data/lib/openai/helpers/beta/agents/result.rb +170 -0
  11. data/lib/openai/helpers/beta/agents/typed_output.rb +191 -0
  12. data/lib/openai/helpers/live/websocket.rb +7 -1
  13. data/lib/openai/helpers/realtime/conversation_item_variant_resolver.rb +1 -1
  14. data/lib/openai/helpers/responses_websocket/connection.rb +7 -1
  15. data/lib/openai/helpers/responses_websocket/session.rb +5 -1
  16. data/lib/openai/helpers/responses_websocket/transports/async_websocket.rb +12 -2
  17. data/lib/openai/internal/transport/base_client.rb +18 -0
  18. data/lib/openai/internal/type/array_of.rb +1 -1
  19. data/lib/openai/internal/type/base_model.rb +6 -3
  20. data/lib/openai/internal/type/converter.rb +50 -3
  21. data/lib/openai/internal/type/hash_of.rb +1 -1
  22. data/lib/openai/internal/type/union.rb +6 -6
  23. data/lib/openai/models/beta/agents/sessions/session_trace.rb +64 -0
  24. data/lib/openai/models/beta/agents/sessions/trace_list_params.rb +68 -0
  25. data/lib/openai/models/beta/agents/vaults/credential.rb +8 -4
  26. data/lib/openai/models/beta/beta_response_output_text.rb +2 -2
  27. data/lib/openai/models/beta/beta_response_output_text_annotation_added_event.rb +2 -2
  28. data/lib/openai/models/beta/environment.rb +33 -1
  29. data/lib/openai/models/beta/environment_param.rb +24 -1
  30. data/lib/openai/models/beta/session_turn_error.rb +3 -0
  31. data/lib/openai/models/chat/chat_completion_content_part_image.rb +1 -0
  32. data/lib/openai/models/live/fork_server_event.rb +14 -3
  33. data/lib/openai/models/live/server_event.rb +14 -3
  34. data/lib/openai/models/realtime/translations/client_secret_create_params.rb +28 -0
  35. data/lib/openai/models/responses/response_output_text.rb +2 -2
  36. data/lib/openai/models/responses/response_output_text_annotation_added_event.rb +2 -2
  37. data/lib/openai/resources/beta/agents/environments/files.rb +31 -0
  38. data/lib/openai/resources/beta/agents/sessions/artifacts.rb +8 -0
  39. data/lib/openai/resources/beta/agents/sessions/events.rb +6 -5
  40. data/lib/openai/resources/beta/agents/sessions/traces.rb +58 -0
  41. data/lib/openai/resources/beta/agents/sessions.rb +18 -5
  42. data/lib/openai/resources/evals/runs.rb +1 -1
  43. data/lib/openai/resources/realtime/translations/client_secrets.rb +58 -0
  44. data/lib/openai/resources/realtime/translations.rb +20 -0
  45. data/lib/openai/resources/realtime.rb +4 -0
  46. data/lib/openai/version.rb +1 -1
  47. data/lib/openai.rb +9 -1
  48. data/rbi/openai/helpers/agents.rbi +20 -1
  49. data/rbi/openai/helpers/beta/agents/artifacts.rbi +29 -0
  50. data/rbi/openai/helpers/beta/agents/files.rbi +65 -0
  51. data/rbi/openai/helpers/beta/agents/function_tool.rbi +40 -0
  52. data/rbi/openai/helpers/beta/agents/model_adapter.rbi +22 -0
  53. data/rbi/openai/helpers/beta/agents.rbi +146 -0
  54. data/rbi/openai/internal/transport/base_client.rbi +12 -0
  55. data/rbi/openai/internal/type/base_model.rbi +2 -2
  56. data/rbi/openai/internal/type/converter.rbi +21 -3
  57. data/rbi/openai/internal/type/union.rbi +6 -2
  58. data/rbi/openai/models/beta/agents/sessions/session_trace.rbi +97 -0
  59. data/rbi/openai/models/beta/agents/sessions/trace_list_params.rbi +121 -0
  60. data/rbi/openai/models/beta/agents/vaults/credential.rbi +5 -5
  61. data/rbi/openai/models/beta/beta_response_output_text.rbi +2 -2
  62. data/rbi/openai/models/beta/beta_response_output_text_annotation_added_event.rbi +2 -2
  63. data/rbi/openai/models/beta/environment.rbi +29 -0
  64. data/rbi/openai/models/beta/environment_param.rbi +31 -0
  65. data/rbi/openai/models/beta/session_turn_error.rbi +3 -0
  66. data/rbi/openai/models/chat/chat_completion_content_part_image.rbi +1 -0
  67. data/rbi/openai/models/live/fork_server_event.rbi +14 -2
  68. data/rbi/openai/models/live/server_event.rbi +14 -2
  69. data/rbi/openai/models/realtime/translations/client_secret_create_params.rbi +68 -0
  70. data/rbi/openai/models/responses/response_output_text.rbi +2 -2
  71. data/rbi/openai/models/responses/response_output_text_annotation_added_event.rbi +2 -2
  72. data/rbi/openai/resources/beta/agents/environments/files.rbi +31 -0
  73. data/rbi/openai/resources/beta/agents/sessions/artifacts.rbi +8 -0
  74. data/rbi/openai/resources/beta/agents/sessions/events.rbi +6 -5
  75. data/rbi/openai/resources/beta/agents/sessions/traces.rbi +54 -0
  76. data/rbi/openai/resources/beta/agents/sessions.rbi +6 -1
  77. data/rbi/openai/resources/realtime/translations/client_secrets.rbi +54 -0
  78. data/rbi/openai/resources/realtime/translations.rbi +22 -0
  79. data/rbi/openai/resources/realtime.rbi +3 -0
  80. data/sig/openai/helpers/agents.rbs +7 -0
  81. data/sig/openai/helpers/beta/agents/artifacts.rbs +20 -0
  82. data/sig/openai/helpers/beta/agents/files.rbs +41 -0
  83. data/sig/openai/helpers/beta/agents/function_tool.rbs +24 -0
  84. data/sig/openai/helpers/beta/agents/model_adapter.rbs +16 -0
  85. data/sig/openai/helpers/beta/agents.rbs +71 -0
  86. data/sig/openai/helpers/structured_output.rbs +12 -0
  87. data/sig/openai/internal/transport/base_client.rbs +8 -0
  88. data/sig/openai/internal/type/base_model.rbs +3 -1
  89. data/sig/openai/internal/type/converter.rbs +16 -2
  90. data/sig/openai/internal/type/union.rbs +2 -1
  91. data/sig/openai/models/beta/agents/sessions/session_trace.rbs +65 -0
  92. data/sig/openai/models/beta/agents/sessions/trace_list_params.rbs +81 -0
  93. data/sig/openai/models/beta/agents/vaults/credential.rbs +5 -5
  94. data/sig/openai/models/beta/beta_response_output_text.rbs +2 -2
  95. data/sig/openai/models/beta/beta_response_output_text_annotation_added_event.rbs +2 -2
  96. data/sig/openai/models/beta/environment.rbs +22 -0
  97. data/sig/openai/models/beta/environment_param.rbs +25 -0
  98. data/sig/openai/models/beta/session_turn_error.rbs +4 -0
  99. data/sig/openai/models/chat/chat_completion_content_part_image.rbs +2 -1
  100. data/sig/openai/models/live/fork_server_event.rbs +17 -2
  101. data/sig/openai/models/live/server_event.rbs +17 -2
  102. data/sig/openai/models/realtime/translations/client_secret_create_params.rbs +39 -0
  103. data/sig/openai/models/responses/response_output_text.rbs +2 -2
  104. data/sig/openai/models/responses/response_output_text_annotation_added_event.rbs +2 -2
  105. data/sig/openai/resources/beta/agents/environments/files.rbs +17 -0
  106. data/sig/openai/resources/beta/agents/sessions/artifacts.rbs +4 -0
  107. data/sig/openai/resources/beta/agents/sessions/traces.rbs +21 -0
  108. data/sig/openai/resources/beta/agents/sessions.rbs +4 -1
  109. data/sig/openai/resources/realtime/translations/client_secrets.rbs +17 -0
  110. data/sig/openai/resources/realtime/translations.rbs +11 -0
  111. data/sig/openai/resources/realtime.rbs +2 -0
  112. metadata +37 -1
@@ -88,7 +88,7 @@ module OpenAI
88
88
  # @param value [Object]
89
89
  #
90
90
  # @return [OpenAI::Internal::Type::Converter, Class, nil]
91
- private def resolve_variant(value)
91
+ private def resolve_variant(value, state: nil)
92
92
  case [@discriminator, value]
93
93
  in [_, OpenAI::Internal::Type::BaseModel]
94
94
  value.class
@@ -101,18 +101,18 @@ module OpenAI
101
101
 
102
102
  key = key.to_sym if key.is_a?(String)
103
103
  _, found = known_variants.find { |k,| !k.nil? && k == key }
104
- return found.call if found
104
+ return OpenAI::Internal::Type::Converter.resolve_type(found, state: state) if found
105
105
 
106
106
  known_variants.each do |variant_key, variant_fn|
107
107
  next unless variant_key.nil?
108
108
 
109
- target = variant_fn.call
109
+ target = OpenAI::Internal::Type::Converter.resolve_type(variant_fn, state: state)
110
110
  next unless target.is_a?(Class) && target <= OpenAI::Internal::Type::BaseModel
111
111
 
112
112
  field = target.known_fields[@discriminator]
113
113
  next unless field
114
114
 
115
- type = field.fetch(:type_fn).call
115
+ type = OpenAI::Internal::Type::Converter.resolve_type(field.fetch(:type_fn), state: state)
116
116
  next unless OpenAI::Internal::Type::Enum === type
117
117
 
118
118
  return target if type === key
@@ -174,7 +174,7 @@ module OpenAI
174
174
  def coerce(value, state:)
175
175
  strictness = state.fetch(:strictness)
176
176
  previous_error = state.fetch(:error)
177
- if (target = resolve_variant(value))
177
+ if (target = resolve_variant(value, state: state))
178
178
  return OpenAI::Internal::Type::Converter.coerce(target, value, state: state)
179
179
  end
180
180
 
@@ -182,7 +182,7 @@ module OpenAI
182
182
 
183
183
  alternatives = []
184
184
  known_variants.each_with_index do |(_, variant_fn), index|
185
- target = variant_fn.call
185
+ target = OpenAI::Internal::Type::Converter.resolve_type(variant_fn, state: state)
186
186
  exact = state[:exactness] = {yes: 0, no: 0, maybe: 0}
187
187
  state[:branched] += 1
188
188
 
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Beta
6
+ module Agents
7
+ module Sessions
8
+ # @see OpenAI::Resources::Beta::Agents::Sessions::Traces#list
9
+ class SessionTrace < OpenAI::Internal::Type::BaseModel
10
+ # @!attribute id
11
+ # The root turn ID. Use this ID as the pagination anchor.
12
+ #
13
+ # @return [String]
14
+ required :id, String
15
+
16
+ # @!attribute created_at
17
+ # The Unix timestamp in seconds when the root turn was created.
18
+ #
19
+ # @return [Integer]
20
+ required :created_at, Integer
21
+
22
+ # @!attribute object
23
+ # The object type, which is always `agent.session.trace`.
24
+ #
25
+ # @return [Symbol, :"agent.session.trace"]
26
+ required :object, const: :"agent.session.trace"
27
+
28
+ # @!attribute otlp
29
+ # An OTLP JSON ExportTraceServiceRequest containing resourceSpans. Only currently
30
+ # published data is returned; later trace updates are not awaited.
31
+ #
32
+ # @return [Hash{Symbol=>Object}]
33
+ required :otlp, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown]
34
+
35
+ # @!attribute session_id
36
+ # The session that owns this trace.
37
+ #
38
+ # @return [String]
39
+ required :session_id, String
40
+
41
+ # @!method initialize(id:, created_at:, otlp:, session_id:, object: :"agent.session.trace")
42
+ # @param id [String]
43
+ # The root turn ID. Use this ID as the pagination anchor.
44
+ #
45
+ # @param created_at [Integer]
46
+ # The Unix timestamp in seconds when the root turn was created.
47
+ #
48
+ # @param otlp [Hash{Symbol=>Object}]
49
+ # An OTLP JSON ExportTraceServiceRequest containing resourceSpans. Only currently
50
+ # published data is returned; later trace updates are not awaited.
51
+ #
52
+ # @param session_id [String]
53
+ # The session that owns this trace.
54
+ #
55
+ # @param object [Symbol, :"agent.session.trace"]
56
+ # The object type, which is always `agent.session.trace`.
57
+ end
58
+ end
59
+
60
+ SessionTrace = Sessions::SessionTrace
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Beta
6
+ module Agents
7
+ module Sessions
8
+ # @see OpenAI::Resources::Beta::Agents::Sessions::Traces#list
9
+ class TraceListParams < OpenAI::Internal::Type::BaseModel
10
+ extend OpenAI::Internal::Type::RequestParameters::Converter
11
+ include OpenAI::Internal::Type::RequestParameters
12
+
13
+ # @!attribute session_id
14
+ #
15
+ # @return [String]
16
+ required :session_id, String
17
+
18
+ # @!attribute after
19
+ # Return resources after this resource ID in the selected order.
20
+ #
21
+ # @return [String, nil]
22
+ optional :after, String
23
+
24
+ # @!attribute limit
25
+ # The maximum number of resources to return, between 1 and 100. Defaults to 20.
26
+ #
27
+ # @return [Integer, nil]
28
+ optional :limit, Integer
29
+
30
+ # @!attribute order
31
+ # The order in which resources are returned. Defaults to `desc`.
32
+ #
33
+ # @return [Symbol, OpenAI::Models::Beta::Agents::Sessions::TraceListParams::Order, nil]
34
+ optional :order, enum: -> { OpenAI::Beta::Agents::Sessions::TraceListParams::Order }
35
+
36
+ # @!method initialize(session_id:, after: nil, limit: nil, order: nil, request_options: {})
37
+ # @param session_id [String]
38
+ #
39
+ # @param after [String]
40
+ # Return resources after this resource ID in the selected order.
41
+ #
42
+ # @param limit [Integer]
43
+ # The maximum number of resources to return, between 1 and 100. Defaults to 20.
44
+ #
45
+ # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::TraceListParams::Order]
46
+ # The order in which resources are returned. Defaults to `desc`.
47
+ #
48
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
49
+
50
+ # The order in which resources are returned. Defaults to `desc`.
51
+ module Order
52
+ extend OpenAI::Internal::Type::Enum
53
+
54
+ # Returns resources in ascending order.
55
+ ASC = :asc
56
+
57
+ # Returns resources in descending order.
58
+ DESC = :desc
59
+
60
+ # @!method self.values
61
+ # @return [Array<Symbol>]
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -55,7 +55,11 @@ module OpenAI
55
55
  # @return [String]
56
56
  required :vault_id, String
57
57
 
58
- # @!method initialize(id:, auth:, created_at:, metadata:, name:, updated_at:, vault_id:, object: :"vault.credential")
58
+ def initialize(data = {})
59
+ super({metadata: {}, **data})
60
+ end
61
+
62
+ # @!method initialize(id:, auth:, created_at:, name:, updated_at:, vault_id:, metadata: {}, object: :"vault.credential")
59
63
  # Metadata for a stored credential. Secret values are never returned.
60
64
  #
61
65
  # @param id [String]
@@ -67,9 +71,6 @@ module OpenAI
67
71
  # @param created_at [Integer]
68
72
  # The Unix timestamp, in seconds, when the credential was created.
69
73
  #
70
- # @param metadata [Hash{Symbol=>String}]
71
- # Application-defined key-value pairs associated with this credential.
72
- #
73
74
  # @param name [String]
74
75
  # The human-readable name of the credential.
75
76
  #
@@ -79,6 +80,9 @@ module OpenAI
79
80
  # @param vault_id [String]
80
81
  # The ID of the vault containing this credential.
81
82
  #
83
+ # @param metadata [Hash{Symbol=>String}]
84
+ # Application-defined key-value pairs associated with this credential.
85
+ #
82
86
  # @param object [Symbol, :"vault.credential"]
83
87
  # The object type. Always `vault.credential`.
84
88
  end
@@ -79,7 +79,7 @@ module OpenAI
79
79
  required :filename, String
80
80
 
81
81
  # @!attribute index
82
- # The index of the file in the list of files.
82
+ # The index in the output text at which to insert the file citation.
83
83
  #
84
84
  # @return [Integer]
85
85
  required :index, Integer
@@ -100,7 +100,7 @@ module OpenAI
100
100
  # The filename of the file cited.
101
101
  #
102
102
  # @param index [Integer]
103
- # The index of the file in the list of files.
103
+ # The index in the output text at which to insert the file citation.
104
104
  #
105
105
  # @param type [Symbol, :file_citation]
106
106
  # The type of the file citation. Always `file_citation`.
@@ -126,7 +126,7 @@ module OpenAI
126
126
  required :filename, String
127
127
 
128
128
  # @!attribute index
129
- # The index of the file in the list of files.
129
+ # The index in the output text at which to insert the file citation.
130
130
  #
131
131
  # @return [Integer]
132
132
  required :index, Integer
@@ -147,7 +147,7 @@ module OpenAI
147
147
  # The filename of the file cited.
148
148
  #
149
149
  # @param index [Integer]
150
- # The index of the file in the list of files.
150
+ # The index in the output text at which to insert the file citation.
151
151
  #
152
152
  # @param type [Symbol, :file_citation]
153
153
  # The type of the file citation. Always `file_citation`.
@@ -82,13 +82,26 @@ module OpenAI
82
82
  # @return [Symbol, :openai_hosted]
83
83
  required :type, const: :openai_hosted
84
84
 
85
+ # @!attribute container_size
86
+ # The effective CPU and memory tier, or null when unknown or outside the public
87
+ # tiers.
88
+ #
89
+ # @return [Symbol, OpenAI::Models::Beta::Environment::OpenAIHosted::ContainerSize, nil]
90
+ optional(
91
+ :container_size,
92
+ enum: -> {
93
+ OpenAI::Beta::Environment::OpenAIHosted::ContainerSize
94
+ },
95
+ nil?: true
96
+ )
97
+
85
98
  # @!attribute desktop
86
99
  # The effective desktop configuration.
87
100
  #
88
101
  # @return [OpenAI::Models::Beta::Environment::OpenAIHosted::Desktop, nil]
89
102
  optional :desktop, -> { OpenAI::Beta::Environment::OpenAIHosted::Desktop }
90
103
 
91
- # @!method initialize(id:, capability_directories:, files:, network:, packages:, plugins:, skills:, desktop: nil, type: :openai_hosted)
104
+ # @!method initialize(id:, capability_directories:, files:, network:, packages:, plugins:, skills:, container_size: nil, desktop: nil, type: :openai_hosted)
92
105
  # An environment hosted by OpenAI.
93
106
  #
94
107
  # @param id [String]
@@ -112,6 +125,10 @@ module OpenAI
112
125
  # @param skills [Array<OpenAI::Models::Beta::HostedSkillReference, OpenAI::Models::Beta::HostedSkill::Inline>]
113
126
  # Skills installed in the environment, excluding their archive contents.
114
127
  #
128
+ # @param container_size [Symbol, OpenAI::Models::Beta::Environment::OpenAIHosted::ContainerSize, nil]
129
+ # The effective CPU and memory tier, or null when unknown or outside the public
130
+ # tiers.
131
+ #
115
132
  # @param desktop [OpenAI::Models::Beta::Environment::OpenAIHosted::Desktop]
116
133
  # The effective desktop configuration.
117
134
  #
@@ -194,6 +211,21 @@ module OpenAI
194
211
  # System packages installed in the environment.
195
212
  end
196
213
 
214
+ # The effective CPU and memory tier, or null when unknown or outside the public
215
+ # tiers.
216
+ #
217
+ # @see OpenAI::Models::Beta::Environment::OpenAIHosted#container_size
218
+ module ContainerSize
219
+ extend OpenAI::Internal::Type::Enum
220
+
221
+ SMALL = :small
222
+ MEDIUM = :medium
223
+ LARGE = :large
224
+
225
+ # @!method self.values
226
+ # @return [Array<Symbol>]
227
+ end
228
+
197
229
  # @see OpenAI::Models::Beta::Environment::OpenAIHosted#desktop
198
230
  class Desktop < OpenAI::Internal::Type::BaseModel
199
231
  # @!attribute enabled
@@ -46,6 +46,12 @@ module OpenAI
46
46
  # @return [Array<String>, nil]
47
47
  optional :capability_directories, OpenAI::Internal::Type::ArrayOf[String], nil?: true
48
48
 
49
+ # @!attribute container_size
50
+ # The hosted container size. Omission selects the medium tier.
51
+ #
52
+ # @return [Symbol, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::ContainerSize, nil]
53
+ optional :container_size, enum: -> { OpenAI::Beta::EnvironmentParam::OpenAIHosted::ContainerSize }
54
+
49
55
  # @!attribute desktop
50
56
  # Desktop provisioning. Omission or null inherits the template setting, or
51
57
  # defaults to disabled.
@@ -122,7 +128,7 @@ module OpenAI
122
128
  nil?: true
123
129
  )
124
130
 
125
- # @!method initialize(capability_directories: nil, desktop: nil, env: nil, environment_template_id: nil, files: nil, network: nil, packages: nil, plugins: nil, setup_commands: nil, skills: nil, type: :openai_hosted)
131
+ # @!method initialize(capability_directories: nil, container_size: nil, desktop: nil, env: nil, environment_template_id: nil, files: nil, network: nil, packages: nil, plugins: nil, setup_commands: nil, skills: nil, type: :openai_hosted)
126
132
  # An existing OpenAI-hosted environment or new inline/template-based hosted
127
133
  # configuration.
128
134
  #
@@ -130,6 +136,9 @@ module OpenAI
130
136
  # Directories that contain capabilities exposed to the agent. Defaults to an empty
131
137
  # list.
132
138
  #
139
+ # @param container_size [Symbol, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::ContainerSize]
140
+ # The hosted container size. Omission selects the medium tier.
141
+ #
133
142
  # @param desktop [OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Desktop, nil]
134
143
  # Desktop provisioning. Omission or null inherits the template setting, or
135
144
  # defaults to disabled.
@@ -164,6 +173,20 @@ module OpenAI
164
173
  # @param type [Symbol, :openai_hosted]
165
174
  # The type of the object. Always `openai_hosted`.
166
175
 
176
+ # The hosted container size. Omission selects the medium tier.
177
+ #
178
+ # @see OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted#container_size
179
+ module ContainerSize
180
+ extend OpenAI::Internal::Type::Enum
181
+
182
+ SMALL = :small
183
+ MEDIUM = :medium
184
+ LARGE = :large
185
+
186
+ # @!method self.values
187
+ # @return [Array<Symbol>]
188
+ end
189
+
167
190
  # @see OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted#desktop
168
191
  class Desktop < OpenAI::Internal::Type::BaseModel
169
192
  # @!attribute enabled
@@ -46,6 +46,9 @@ module OpenAI
46
46
  # The request exceeds the available rate limit.
47
47
  RATE_LIMIT_EXCEEDED = :rate_limit_exceeded
48
48
 
49
+ # Flex processing is temporarily unavailable.
50
+ FLEX_UNAVAILABLE = :flex_unavailable
51
+
49
52
  # The model service is temporarily overloaded.
50
53
  SERVER_OVERLOADED = :server_overloaded
51
54
 
@@ -73,6 +73,7 @@ module OpenAI
73
73
  AUTO = :auto
74
74
  LOW = :low
75
75
  HIGH = :high
76
+ ORIGINAL = :original
76
77
 
77
78
  # @!method self.values
78
79
  # @return [Array<Symbol>]
@@ -67,7 +67,7 @@ module OpenAI
67
67
  # A SIP DTMF keypress received from the caller. Delivered only to sideband observers.
68
68
  variant :"transport.dtmf.received", -> { OpenAI::Live::ForkServerEvent::TransportDtmfReceived }
69
69
 
70
- # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to sideband observers; this is not a client command.
70
+ # A SIP DTMF keypress successfully sent to the SIP trunk. Delivered only to sideband observers; this is not a client command.
71
71
  variant :"transport.dtmf.send", -> { OpenAI::Live::ForkServerEvent::TransportDtmfSend }
72
72
 
73
73
  # The outbound SIP provider leg is ringing or providing early media. Delivered only to sideband observers.
@@ -148,12 +148,23 @@ module OpenAI
148
148
  # @return [Symbol, :"transport.dtmf.send"]
149
149
  required :type, const: :"transport.dtmf.send"
150
150
 
151
- # @!method initialize(event:, event_id:, type: :"transport.dtmf.send")
152
- # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to
151
+ # @!attribute client_event_id
152
+ # The event_id of the client command, when supplied.
153
+ #
154
+ # @return [String, nil]
155
+ optional :client_event_id, String
156
+
157
+ # @!method initialize(event:, event_id:, client_event_id: nil, type: :"transport.dtmf.send")
158
+ # A SIP DTMF keypress successfully sent to the SIP trunk. Delivered only to
153
159
  # sideband observers; this is not a client command.
154
160
  #
155
161
  # @param event [String]
162
+ #
156
163
  # @param event_id [String]
164
+ #
165
+ # @param client_event_id [String]
166
+ # The event_id of the client command, when supplied.
167
+ #
157
168
  # @param type [Symbol, :"transport.dtmf.send"]
158
169
  end
159
170
 
@@ -67,7 +67,7 @@ module OpenAI
67
67
  # A SIP DTMF keypress received from the caller. Delivered only to sideband observers.
68
68
  variant :"transport.dtmf.received", -> { OpenAI::Live::ServerEvent::TransportDtmfReceived }
69
69
 
70
- # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to sideband observers; this is not a client command.
70
+ # A SIP DTMF keypress successfully sent to the SIP trunk. Delivered only to sideband observers; this is not a client command.
71
71
  variant :"transport.dtmf.send", -> { OpenAI::Live::ServerEvent::TransportDtmfSend }
72
72
 
73
73
  # The outbound SIP provider leg is ringing or providing early media. Delivered only to sideband observers.
@@ -148,12 +148,23 @@ module OpenAI
148
148
  # @return [Symbol, :"transport.dtmf.send"]
149
149
  required :type, const: :"transport.dtmf.send"
150
150
 
151
- # @!method initialize(event:, event_id:, type: :"transport.dtmf.send")
152
- # A SIP DTMF keypress successfully sent by the hosted tool. Delivered only to
151
+ # @!attribute client_event_id
152
+ # The event_id of the client command, when supplied.
153
+ #
154
+ # @return [String, nil]
155
+ optional :client_event_id, String
156
+
157
+ # @!method initialize(event:, event_id:, client_event_id: nil, type: :"transport.dtmf.send")
158
+ # A SIP DTMF keypress successfully sent to the SIP trunk. Delivered only to
153
159
  # sideband observers; this is not a client command.
154
160
  #
155
161
  # @param event [String]
162
+ #
156
163
  # @param event_id [String]
164
+ #
165
+ # @param client_event_id [String]
166
+ # The event_id of the client command, when supplied.
167
+ #
157
168
  # @param type [Symbol, :"transport.dtmf.send"]
158
169
  end
159
170
 
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Realtime
6
+ module Translations
7
+ # @see OpenAI::Resources::Realtime::Translations::ClientSecrets#create
8
+ class ClientSecretCreateParams < OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest
9
+ extend OpenAI::Internal::Type::RequestParameters::Converter
10
+ include OpenAI::Internal::Type::RequestParameters
11
+
12
+ # @!method initialize(session:, expires_after: nil, request_options: {})
13
+ # @param session [OpenAI::Models::Realtime::RealtimeTranslationSessionCreateRequest]
14
+ # Realtime translation session configuration. Translation sessions stream source
15
+ # audio in and translated audio plus transcript deltas out continuously.
16
+ #
17
+ # @param expires_after [OpenAI::Models::Realtime::RealtimeTranslationClientSecretCreateRequest::ExpiresAfter]
18
+ # Configuration for the client secret expiration. Expiration refers to the time
19
+ # after which a client secret will no longer be valid for creating sessions. The
20
+ # session itself may continue after that time once started. A secret can be used
21
+ # to create multiple sessions until it expires.
22
+ #
23
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -87,7 +87,7 @@ module OpenAI
87
87
  required :filename, String
88
88
 
89
89
  # @!attribute index
90
- # The index of the file in the list of files.
90
+ # The index in the output text at which to insert the file citation.
91
91
  #
92
92
  # @return [Integer]
93
93
  required :index, Integer
@@ -108,7 +108,7 @@ module OpenAI
108
108
  # The filename of the file cited.
109
109
  #
110
110
  # @param index [Integer]
111
- # The index of the file in the list of files.
111
+ # The index in the output text at which to insert the file citation.
112
112
  #
113
113
  # @param type [Symbol, :file_citation]
114
114
  # The type of the file citation. Always `file_citation`.
@@ -117,7 +117,7 @@ module OpenAI
117
117
  required :filename, String
118
118
 
119
119
  # @!attribute index
120
- # The index of the file in the list of files.
120
+ # The index in the output text at which to insert the file citation.
121
121
  #
122
122
  # @return [Integer]
123
123
  required :index, Integer
@@ -138,7 +138,7 @@ module OpenAI
138
138
  # The filename of the file cited.
139
139
  #
140
140
  # @param index [Integer]
141
- # The index of the file in the list of files.
141
+ # The index in the output text at which to insert the file citation.
142
142
  #
143
143
  # @param type [Symbol, :file_citation]
144
144
  # The type of the file citation. Always `file_citation`.
@@ -1,11 +1,42 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../../../helpers/beta/agents/files"
4
+
3
5
  module OpenAI
4
6
  module Resources
5
7
  class Beta
6
8
  class Agents
7
9
  class Environments
8
10
  class Files
11
+ # Upload selected local files for a new hosted environment (beta).
12
+ # @return [OpenAI::Helpers::Beta::Agents::PreparedFiles]
13
+ def prepare(files, request_options: {})
14
+ OpenAI::Helpers::Beta::Agents::FilePreparation
15
+ .new(client: @client, environment_files: self)
16
+ .prepare(files, request_options: request_options)
17
+ end
18
+
19
+ # Upload an explicitly selected directory snapshot (beta).
20
+ # @return [OpenAI::Helpers::Beta::Agents::PreparedFiles]
21
+ def prepare_directory(directory, destination:, include:, request_options: {})
22
+ OpenAI::Helpers::Beta::Agents::FilePreparation
23
+ .new(client: @client, environment_files: self)
24
+ .prepare_directory(
25
+ directory,
26
+ destination: destination,
27
+ include: include,
28
+ request_options: request_options
29
+ )
30
+ end
31
+
32
+ # Upload and stage a local file in an existing environment (beta).
33
+ # @return [OpenAI::Helpers::Beta::Agents::PreparedFiles]
34
+ def upload(environment_id, file:, path:, request_options: {})
35
+ OpenAI::Helpers::Beta::Agents::FilePreparation
36
+ .new(client: @client, environment_files: self)
37
+ .upload(environment_id, file: file, path: path, request_options: request_options)
38
+ end
39
+
9
40
  # Copies inline bytes or a Files API file into a connected execution environment.
10
41
  # See
11
42
  # [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files).
@@ -1,11 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../../../helpers/beta/agents/artifacts"
4
+
3
5
  module OpenAI
4
6
  module Resources
5
7
  class Beta
6
8
  class Agents
7
9
  class Sessions
8
10
  class Artifacts
11
+ # Access artifacts from exactly this completed turn (beta).
12
+ # @return [OpenAI::Helpers::Beta::Agents::ResultArtifacts]
13
+ def for_result(result)
14
+ OpenAI::Helpers::Beta::Agents::ResultArtifacts.new(artifacts: self, client: @client, result: result)
15
+ end
16
+
9
17
  # Retrieves immutable metadata for one durable session artifact. See
10
18
  # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts).
11
19
  #
@@ -6,11 +6,12 @@ module OpenAI
6
6
  class Agents
7
7
  class Sessions
8
8
  class Events
9
- # Submits message, cancellation, or tool-result events to a managed agent session.
10
- # Cancellation can recover a still-open turn whose backend execution has ended by
11
- # marking it cancelled and abandoning unpublished outputs. Saved results,
12
- # published files, and existing terminal outcomes are preserved. HTTP 202 confirms
13
- # acceptance, not durable completion. See
9
+ # Submits message, cancellation, tool-result, or computer-use approval-response
10
+ # events to a managed agent session. Cancellation can recover a still-open turn
11
+ # whose backend execution has ended by marking it cancelled and abandoning
12
+ # unpublished outputs. Saved results, published files, and existing terminal
13
+ # outcomes are preserved. HTTP 202 confirms acceptance, not durable completion.
14
+ # See
14
15
  # [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events).
15
16
  #
16
17
  # @overload create(session_id, events:, idempotency_key: nil, request_options: {})