openai 0.18.1 → 0.19.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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +1 -1
  4. data/lib/openai/client.rb +4 -0
  5. data/lib/openai/helpers/structured_output/boolean.rb +1 -0
  6. data/lib/openai/internal/conversation_cursor_page.rb +92 -0
  7. data/lib/openai/internal/transport/base_client.rb +1 -4
  8. data/lib/openai/internal/transport/pooled_net_requester.rb +1 -9
  9. data/lib/openai/internal/util.rb +1 -1
  10. data/lib/openai/models/audio/transcription.rb +1 -4
  11. data/lib/openai/models/audio/transcription_create_params.rb +2 -7
  12. data/lib/openai/models/audio/transcription_text_done_event.rb +1 -4
  13. data/lib/openai/models/beta/assistant_create_params.rb +6 -19
  14. data/lib/openai/models/beta/assistant_stream_event.rb +6 -24
  15. data/lib/openai/models/beta/assistant_update_params.rb +1 -4
  16. data/lib/openai/models/beta/message_stream_event.rb +1 -4
  17. data/lib/openai/models/beta/run_step_stream_event.rb +1 -4
  18. data/lib/openai/models/beta/thread_create_and_run_params.rb +10 -32
  19. data/lib/openai/models/beta/thread_create_params.rb +7 -22
  20. data/lib/openai/models/beta/threads/message.rb +3 -10
  21. data/lib/openai/models/beta/threads/message_create_params.rb +2 -7
  22. data/lib/openai/models/beta/threads/run.rb +2 -7
  23. data/lib/openai/models/beta/threads/run_create_params.rb +3 -10
  24. data/lib/openai/models/beta/threads/run_submit_tool_outputs_params.rb +1 -3
  25. data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call.rb +5 -17
  26. data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call_delta.rb +1 -3
  27. data/lib/openai/models/beta/threads/runs/file_search_tool_call.rb +4 -12
  28. data/lib/openai/models/beta/threads/runs/run_step_delta_message_delta.rb +1 -4
  29. data/lib/openai/models/beta/threads/runs/tool_calls_step_details.rb +1 -4
  30. data/lib/openai/models/beta/threads/text.rb +1 -4
  31. data/lib/openai/models/chat/chat_completion_chunk.rb +1 -3
  32. data/lib/openai/models/chat/chat_completion_custom_tool.rb +2 -7
  33. data/lib/openai/models/conversations/computer_screenshot_content.rb +38 -0
  34. data/lib/openai/models/conversations/container_file_citation_body.rb +58 -0
  35. data/lib/openai/models/conversations/conversation.rb +51 -0
  36. data/lib/openai/models/conversations/conversation_create_params.rb +39 -0
  37. data/lib/openai/models/conversations/conversation_delete_params.rb +16 -0
  38. data/lib/openai/models/conversations/conversation_deleted.rb +29 -0
  39. data/lib/openai/models/conversations/conversation_deleted_resource.rb +30 -0
  40. data/lib/openai/models/conversations/conversation_item.rb +568 -0
  41. data/lib/openai/models/conversations/conversation_item_list.rb +55 -0
  42. data/lib/openai/models/conversations/conversation_retrieve_params.rb +16 -0
  43. data/lib/openai/models/conversations/conversation_update_params.rb +31 -0
  44. data/lib/openai/models/conversations/file_citation_body.rb +42 -0
  45. data/lib/openai/models/conversations/input_file_content.rb +42 -0
  46. data/lib/openai/models/conversations/input_image_content.rb +62 -0
  47. data/lib/openai/models/conversations/input_text_content.rb +26 -0
  48. data/lib/openai/models/conversations/item_create_params.rb +37 -0
  49. data/lib/openai/models/conversations/item_delete_params.rb +22 -0
  50. data/lib/openai/models/conversations/item_list_params.rb +84 -0
  51. data/lib/openai/models/conversations/item_retrieve_params.rb +36 -0
  52. data/lib/openai/models/conversations/lob_prob.rb +35 -0
  53. data/lib/openai/models/conversations/message.rb +115 -0
  54. data/lib/openai/models/conversations/output_text_content.rb +57 -0
  55. data/lib/openai/models/conversations/refusal_content.rb +26 -0
  56. data/lib/openai/models/conversations/summary_text_content.rb +23 -0
  57. data/lib/openai/models/conversations/text_content.rb +23 -0
  58. data/lib/openai/models/conversations/top_log_prob.rb +29 -0
  59. data/lib/openai/models/conversations/url_citation_body.rb +50 -0
  60. data/lib/openai/models/eval_create_params.rb +6 -20
  61. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +29 -53
  62. data/lib/openai/models/evals/create_eval_jsonl_run_data_source.rb +1 -3
  63. data/lib/openai/models/evals/run_create_params.rb +18 -54
  64. data/lib/openai/models/fine_tuning/reinforcement_hyperparameters.rb +1 -4
  65. data/lib/openai/models/moderation.rb +5 -15
  66. data/lib/openai/models/responses/input_item_list_params.rb +1 -9
  67. data/lib/openai/models/responses/response.rb +26 -1
  68. data/lib/openai/models/responses/response_computer_tool_call.rb +2 -6
  69. data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +1 -3
  70. data/lib/openai/models/responses/response_conversation_param.rb +20 -0
  71. data/lib/openai/models/responses/response_create_params.rb +34 -1
  72. data/lib/openai/models/responses/response_input_item.rb +2 -7
  73. data/lib/openai/models/responses/response_input_message_item.rb +1 -4
  74. data/lib/openai/models/responses/response_output_item.rb +1 -3
  75. data/lib/openai/models/responses/response_output_message.rb +1 -3
  76. data/lib/openai/models/responses/response_output_text.rb +3 -10
  77. data/lib/openai/models/responses/response_stream_event.rb +4 -16
  78. data/lib/openai/models/responses/response_text_delta_event.rb +1 -3
  79. data/lib/openai/models/responses/response_text_done_event.rb +1 -3
  80. data/lib/openai/models/responses/tool.rb +145 -34
  81. data/lib/openai/models.rb +2 -0
  82. data/lib/openai/resources/conversations/items.rb +141 -0
  83. data/lib/openai/resources/conversations.rb +112 -0
  84. data/lib/openai/resources/responses/input_items.rb +1 -3
  85. data/lib/openai/resources/responses.rb +6 -2
  86. data/lib/openai/version.rb +1 -1
  87. data/lib/openai.rb +31 -0
  88. data/rbi/openai/client.rbi +3 -0
  89. data/rbi/openai/errors.rbi +5 -5
  90. data/rbi/openai/internal/conversation_cursor_page.rbi +25 -0
  91. data/rbi/openai/models/conversations/computer_screenshot_content.rbi +60 -0
  92. data/rbi/openai/models/conversations/container_file_citation_body.rbi +82 -0
  93. data/rbi/openai/models/conversations/conversation.rbi +76 -0
  94. data/rbi/openai/models/conversations/conversation_create_params.rbi +144 -0
  95. data/rbi/openai/models/conversations/conversation_delete_params.rbi +32 -0
  96. data/rbi/openai/models/conversations/conversation_deleted.rbi +40 -0
  97. data/rbi/openai/models/conversations/conversation_deleted_resource.rbi +40 -0
  98. data/rbi/openai/models/conversations/conversation_item.rbi +835 -0
  99. data/rbi/openai/models/conversations/conversation_item_list.rbi +101 -0
  100. data/rbi/openai/models/conversations/conversation_retrieve_params.rbi +32 -0
  101. data/rbi/openai/models/conversations/conversation_update_params.rbi +56 -0
  102. data/rbi/openai/models/conversations/file_citation_body.rbi +61 -0
  103. data/rbi/openai/models/conversations/input_file_content.rbi +72 -0
  104. data/rbi/openai/models/conversations/input_image_content.rbi +113 -0
  105. data/rbi/openai/models/conversations/input_text_content.rbi +38 -0
  106. data/rbi/openai/models/conversations/item_create_params.rbi +150 -0
  107. data/rbi/openai/models/conversations/item_delete_params.rbi +40 -0
  108. data/rbi/openai/models/conversations/item_list_params.rbi +174 -0
  109. data/rbi/openai/models/conversations/item_retrieve_params.rbi +70 -0
  110. data/rbi/openai/models/conversations/lob_prob.rbi +50 -0
  111. data/rbi/openai/models/conversations/message.rbi +196 -0
  112. data/rbi/openai/models/conversations/output_text_content.rbi +110 -0
  113. data/rbi/openai/models/conversations/refusal_content.rbi +38 -0
  114. data/rbi/openai/models/conversations/summary_text_content.rbi +31 -0
  115. data/rbi/openai/models/conversations/text_content.rbi +28 -0
  116. data/rbi/openai/models/conversations/top_log_prob.rbi +41 -0
  117. data/rbi/openai/models/conversations/url_citation_body.rbi +74 -0
  118. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +33 -33
  119. data/rbi/openai/models/responses/input_item_list_params.rbi +0 -11
  120. data/rbi/openai/models/responses/response.rbi +49 -0
  121. data/rbi/openai/models/responses/response_conversation_param.rbi +33 -0
  122. data/rbi/openai/models/responses/response_create_params.rbi +54 -0
  123. data/rbi/openai/models/responses/tool.rbi +243 -31
  124. data/rbi/openai/models.rbi +2 -0
  125. data/rbi/openai/resources/conversations/items.rbi +152 -0
  126. data/rbi/openai/resources/conversations.rbi +110 -0
  127. data/rbi/openai/resources/responses/input_items.rbi +0 -3
  128. data/rbi/openai/resources/responses.rbi +26 -0
  129. data/sig/openai/client.rbs +2 -0
  130. data/sig/openai/internal/conversation_cursor_page.rbs +15 -0
  131. data/sig/openai/models/conversations/computer_screenshot_content.rbs +28 -0
  132. data/sig/openai/models/conversations/container_file_citation_body.rbs +47 -0
  133. data/sig/openai/models/conversations/conversation.rbs +37 -0
  134. data/sig/openai/models/conversations/conversation_create_params.rbs +33 -0
  135. data/sig/openai/models/conversations/conversation_delete_params.rbs +17 -0
  136. data/sig/openai/models/conversations/conversation_deleted.rbs +28 -0
  137. data/sig/openai/models/conversations/conversation_deleted_resource.rbs +28 -0
  138. data/sig/openai/models/conversations/conversation_item.rbs +403 -0
  139. data/sig/openai/models/conversations/conversation_item_list.rbs +44 -0
  140. data/sig/openai/models/conversations/conversation_retrieve_params.rbs +17 -0
  141. data/sig/openai/models/conversations/conversation_update_params.rbs +26 -0
  142. data/sig/openai/models/conversations/file_citation_body.rbs +37 -0
  143. data/sig/openai/models/conversations/input_file_content.rbs +41 -0
  144. data/sig/openai/models/conversations/input_image_content.rbs +49 -0
  145. data/sig/openai/models/conversations/input_text_content.rbs +17 -0
  146. data/sig/openai/models/conversations/item_create_params.rbs +37 -0
  147. data/sig/openai/models/conversations/item_delete_params.rbs +25 -0
  148. data/sig/openai/models/conversations/item_list_params.rbs +66 -0
  149. data/sig/openai/models/conversations/item_retrieve_params.rbs +37 -0
  150. data/sig/openai/models/conversations/lob_prob.rbs +37 -0
  151. data/sig/openai/models/conversations/message.rbs +95 -0
  152. data/sig/openai/models/conversations/output_text_content.rbs +52 -0
  153. data/sig/openai/models/conversations/refusal_content.rbs +17 -0
  154. data/sig/openai/models/conversations/summary_text_content.rbs +17 -0
  155. data/sig/openai/models/conversations/text_content.rbs +17 -0
  156. data/sig/openai/models/conversations/top_log_prob.rbs +28 -0
  157. data/sig/openai/models/conversations/url_citation_body.rbs +42 -0
  158. data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +22 -22
  159. data/sig/openai/models/responses/input_item_list_params.rbs +0 -7
  160. data/sig/openai/models/responses/response.rbs +15 -0
  161. data/sig/openai/models/responses/response_conversation_param.rbs +15 -0
  162. data/sig/openai/models/responses/response_create_params.rbs +14 -0
  163. data/sig/openai/models/responses/tool.rbs +83 -18
  164. data/sig/openai/models.rbs +2 -0
  165. data/sig/openai/resources/conversations/items.rbs +38 -0
  166. data/sig/openai/resources/conversations.rbs +31 -0
  167. data/sig/openai/resources/responses/input_items.rbs +0 -1
  168. data/sig/openai/resources/responses.rbs +2 -0
  169. metadata +95 -2
@@ -0,0 +1,835 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ ConversationItem = Conversations::ConversationItem
6
+
7
+ module Conversations
8
+ # A single item within a conversation. The set of possible types are the same as
9
+ # the `output` type of a
10
+ # [Response object](https://platform.openai.com/docs/api-reference/responses/object#responses/object-output).
11
+ module ConversationItem
12
+ extend OpenAI::Internal::Type::Union
13
+
14
+ Variants =
15
+ T.type_alias do
16
+ T.any(
17
+ OpenAI::Conversations::Message,
18
+ OpenAI::Responses::ResponseFunctionToolCallItem,
19
+ OpenAI::Responses::ResponseFunctionToolCallOutputItem,
20
+ OpenAI::Responses::ResponseFileSearchToolCall,
21
+ OpenAI::Responses::ResponseFunctionWebSearch,
22
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall,
23
+ OpenAI::Responses::ResponseComputerToolCall,
24
+ OpenAI::Responses::ResponseComputerToolCallOutputItem,
25
+ OpenAI::Responses::ResponseReasoningItem,
26
+ OpenAI::Responses::ResponseCodeInterpreterToolCall,
27
+ OpenAI::Conversations::ConversationItem::LocalShellCall,
28
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput,
29
+ OpenAI::Conversations::ConversationItem::McpListTools,
30
+ OpenAI::Conversations::ConversationItem::McpApprovalRequest,
31
+ OpenAI::Conversations::ConversationItem::McpApprovalResponse,
32
+ OpenAI::Conversations::ConversationItem::McpCall,
33
+ OpenAI::Responses::ResponseCustomToolCall,
34
+ OpenAI::Responses::ResponseCustomToolCallOutput
35
+ )
36
+ end
37
+
38
+ class ImageGenerationCall < OpenAI::Internal::Type::BaseModel
39
+ OrHash =
40
+ T.type_alias do
41
+ T.any(
42
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall,
43
+ OpenAI::Internal::AnyHash
44
+ )
45
+ end
46
+
47
+ # The unique ID of the image generation call.
48
+ sig { returns(String) }
49
+ attr_accessor :id
50
+
51
+ # The generated image encoded in base64.
52
+ sig { returns(T.nilable(String)) }
53
+ attr_accessor :result
54
+
55
+ # The status of the image generation call.
56
+ sig do
57
+ returns(
58
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::TaggedSymbol
59
+ )
60
+ end
61
+ attr_accessor :status
62
+
63
+ # The type of the image generation call. Always `image_generation_call`.
64
+ sig { returns(Symbol) }
65
+ attr_accessor :type
66
+
67
+ # An image generation request made by the model.
68
+ sig do
69
+ params(
70
+ id: String,
71
+ result: T.nilable(String),
72
+ status:
73
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::OrSymbol,
74
+ type: Symbol
75
+ ).returns(T.attached_class)
76
+ end
77
+ def self.new(
78
+ # The unique ID of the image generation call.
79
+ id:,
80
+ # The generated image encoded in base64.
81
+ result:,
82
+ # The status of the image generation call.
83
+ status:,
84
+ # The type of the image generation call. Always `image_generation_call`.
85
+ type: :image_generation_call
86
+ )
87
+ end
88
+
89
+ sig do
90
+ override.returns(
91
+ {
92
+ id: String,
93
+ result: T.nilable(String),
94
+ status:
95
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::TaggedSymbol,
96
+ type: Symbol
97
+ }
98
+ )
99
+ end
100
+ def to_hash
101
+ end
102
+
103
+ # The status of the image generation call.
104
+ module Status
105
+ extend OpenAI::Internal::Type::Enum
106
+
107
+ TaggedSymbol =
108
+ T.type_alias do
109
+ T.all(
110
+ Symbol,
111
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status
112
+ )
113
+ end
114
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
115
+
116
+ IN_PROGRESS =
117
+ T.let(
118
+ :in_progress,
119
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::TaggedSymbol
120
+ )
121
+ COMPLETED =
122
+ T.let(
123
+ :completed,
124
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::TaggedSymbol
125
+ )
126
+ GENERATING =
127
+ T.let(
128
+ :generating,
129
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::TaggedSymbol
130
+ )
131
+ FAILED =
132
+ T.let(
133
+ :failed,
134
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::TaggedSymbol
135
+ )
136
+
137
+ sig do
138
+ override.returns(
139
+ T::Array[
140
+ OpenAI::Conversations::ConversationItem::ImageGenerationCall::Status::TaggedSymbol
141
+ ]
142
+ )
143
+ end
144
+ def self.values
145
+ end
146
+ end
147
+ end
148
+
149
+ class LocalShellCall < OpenAI::Internal::Type::BaseModel
150
+ OrHash =
151
+ T.type_alias do
152
+ T.any(
153
+ OpenAI::Conversations::ConversationItem::LocalShellCall,
154
+ OpenAI::Internal::AnyHash
155
+ )
156
+ end
157
+
158
+ # The unique ID of the local shell call.
159
+ sig { returns(String) }
160
+ attr_accessor :id
161
+
162
+ # Execute a shell command on the server.
163
+ sig do
164
+ returns(
165
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Action
166
+ )
167
+ end
168
+ attr_reader :action
169
+
170
+ sig do
171
+ params(
172
+ action:
173
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Action::OrHash
174
+ ).void
175
+ end
176
+ attr_writer :action
177
+
178
+ # The unique ID of the local shell tool call generated by the model.
179
+ sig { returns(String) }
180
+ attr_accessor :call_id
181
+
182
+ # The status of the local shell call.
183
+ sig do
184
+ returns(
185
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Status::TaggedSymbol
186
+ )
187
+ end
188
+ attr_accessor :status
189
+
190
+ # The type of the local shell call. Always `local_shell_call`.
191
+ sig { returns(Symbol) }
192
+ attr_accessor :type
193
+
194
+ # A tool call to run a command on the local shell.
195
+ sig do
196
+ params(
197
+ id: String,
198
+ action:
199
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Action::OrHash,
200
+ call_id: String,
201
+ status:
202
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Status::OrSymbol,
203
+ type: Symbol
204
+ ).returns(T.attached_class)
205
+ end
206
+ def self.new(
207
+ # The unique ID of the local shell call.
208
+ id:,
209
+ # Execute a shell command on the server.
210
+ action:,
211
+ # The unique ID of the local shell tool call generated by the model.
212
+ call_id:,
213
+ # The status of the local shell call.
214
+ status:,
215
+ # The type of the local shell call. Always `local_shell_call`.
216
+ type: :local_shell_call
217
+ )
218
+ end
219
+
220
+ sig do
221
+ override.returns(
222
+ {
223
+ id: String,
224
+ action:
225
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Action,
226
+ call_id: String,
227
+ status:
228
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Status::TaggedSymbol,
229
+ type: Symbol
230
+ }
231
+ )
232
+ end
233
+ def to_hash
234
+ end
235
+
236
+ class Action < OpenAI::Internal::Type::BaseModel
237
+ OrHash =
238
+ T.type_alias do
239
+ T.any(
240
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Action,
241
+ OpenAI::Internal::AnyHash
242
+ )
243
+ end
244
+
245
+ # The command to run.
246
+ sig { returns(T::Array[String]) }
247
+ attr_accessor :command
248
+
249
+ # Environment variables to set for the command.
250
+ sig { returns(T::Hash[Symbol, String]) }
251
+ attr_accessor :env
252
+
253
+ # The type of the local shell action. Always `exec`.
254
+ sig { returns(Symbol) }
255
+ attr_accessor :type
256
+
257
+ # Optional timeout in milliseconds for the command.
258
+ sig { returns(T.nilable(Integer)) }
259
+ attr_accessor :timeout_ms
260
+
261
+ # Optional user to run the command as.
262
+ sig { returns(T.nilable(String)) }
263
+ attr_accessor :user
264
+
265
+ # Optional working directory to run the command in.
266
+ sig { returns(T.nilable(String)) }
267
+ attr_accessor :working_directory
268
+
269
+ # Execute a shell command on the server.
270
+ sig do
271
+ params(
272
+ command: T::Array[String],
273
+ env: T::Hash[Symbol, String],
274
+ timeout_ms: T.nilable(Integer),
275
+ user: T.nilable(String),
276
+ working_directory: T.nilable(String),
277
+ type: Symbol
278
+ ).returns(T.attached_class)
279
+ end
280
+ def self.new(
281
+ # The command to run.
282
+ command:,
283
+ # Environment variables to set for the command.
284
+ env:,
285
+ # Optional timeout in milliseconds for the command.
286
+ timeout_ms: nil,
287
+ # Optional user to run the command as.
288
+ user: nil,
289
+ # Optional working directory to run the command in.
290
+ working_directory: nil,
291
+ # The type of the local shell action. Always `exec`.
292
+ type: :exec
293
+ )
294
+ end
295
+
296
+ sig do
297
+ override.returns(
298
+ {
299
+ command: T::Array[String],
300
+ env: T::Hash[Symbol, String],
301
+ type: Symbol,
302
+ timeout_ms: T.nilable(Integer),
303
+ user: T.nilable(String),
304
+ working_directory: T.nilable(String)
305
+ }
306
+ )
307
+ end
308
+ def to_hash
309
+ end
310
+ end
311
+
312
+ # The status of the local shell call.
313
+ module Status
314
+ extend OpenAI::Internal::Type::Enum
315
+
316
+ TaggedSymbol =
317
+ T.type_alias do
318
+ T.all(
319
+ Symbol,
320
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Status
321
+ )
322
+ end
323
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
324
+
325
+ IN_PROGRESS =
326
+ T.let(
327
+ :in_progress,
328
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Status::TaggedSymbol
329
+ )
330
+ COMPLETED =
331
+ T.let(
332
+ :completed,
333
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Status::TaggedSymbol
334
+ )
335
+ INCOMPLETE =
336
+ T.let(
337
+ :incomplete,
338
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Status::TaggedSymbol
339
+ )
340
+
341
+ sig do
342
+ override.returns(
343
+ T::Array[
344
+ OpenAI::Conversations::ConversationItem::LocalShellCall::Status::TaggedSymbol
345
+ ]
346
+ )
347
+ end
348
+ def self.values
349
+ end
350
+ end
351
+ end
352
+
353
+ class LocalShellCallOutput < OpenAI::Internal::Type::BaseModel
354
+ OrHash =
355
+ T.type_alias do
356
+ T.any(
357
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput,
358
+ OpenAI::Internal::AnyHash
359
+ )
360
+ end
361
+
362
+ # The unique ID of the local shell tool call generated by the model.
363
+ sig { returns(String) }
364
+ attr_accessor :id
365
+
366
+ # A JSON string of the output of the local shell tool call.
367
+ sig { returns(String) }
368
+ attr_accessor :output
369
+
370
+ # The type of the local shell tool call output. Always `local_shell_call_output`.
371
+ sig { returns(Symbol) }
372
+ attr_accessor :type
373
+
374
+ # The status of the item. One of `in_progress`, `completed`, or `incomplete`.
375
+ sig do
376
+ returns(
377
+ T.nilable(
378
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput::Status::TaggedSymbol
379
+ )
380
+ )
381
+ end
382
+ attr_accessor :status
383
+
384
+ # The output of a local shell tool call.
385
+ sig do
386
+ params(
387
+ id: String,
388
+ output: String,
389
+ status:
390
+ T.nilable(
391
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput::Status::OrSymbol
392
+ ),
393
+ type: Symbol
394
+ ).returns(T.attached_class)
395
+ end
396
+ def self.new(
397
+ # The unique ID of the local shell tool call generated by the model.
398
+ id:,
399
+ # A JSON string of the output of the local shell tool call.
400
+ output:,
401
+ # The status of the item. One of `in_progress`, `completed`, or `incomplete`.
402
+ status: nil,
403
+ # The type of the local shell tool call output. Always `local_shell_call_output`.
404
+ type: :local_shell_call_output
405
+ )
406
+ end
407
+
408
+ sig do
409
+ override.returns(
410
+ {
411
+ id: String,
412
+ output: String,
413
+ type: Symbol,
414
+ status:
415
+ T.nilable(
416
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput::Status::TaggedSymbol
417
+ )
418
+ }
419
+ )
420
+ end
421
+ def to_hash
422
+ end
423
+
424
+ # The status of the item. One of `in_progress`, `completed`, or `incomplete`.
425
+ module Status
426
+ extend OpenAI::Internal::Type::Enum
427
+
428
+ TaggedSymbol =
429
+ T.type_alias do
430
+ T.all(
431
+ Symbol,
432
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput::Status
433
+ )
434
+ end
435
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
436
+
437
+ IN_PROGRESS =
438
+ T.let(
439
+ :in_progress,
440
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput::Status::TaggedSymbol
441
+ )
442
+ COMPLETED =
443
+ T.let(
444
+ :completed,
445
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput::Status::TaggedSymbol
446
+ )
447
+ INCOMPLETE =
448
+ T.let(
449
+ :incomplete,
450
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput::Status::TaggedSymbol
451
+ )
452
+
453
+ sig do
454
+ override.returns(
455
+ T::Array[
456
+ OpenAI::Conversations::ConversationItem::LocalShellCallOutput::Status::TaggedSymbol
457
+ ]
458
+ )
459
+ end
460
+ def self.values
461
+ end
462
+ end
463
+ end
464
+
465
+ class McpListTools < OpenAI::Internal::Type::BaseModel
466
+ OrHash =
467
+ T.type_alias do
468
+ T.any(
469
+ OpenAI::Conversations::ConversationItem::McpListTools,
470
+ OpenAI::Internal::AnyHash
471
+ )
472
+ end
473
+
474
+ # The unique ID of the list.
475
+ sig { returns(String) }
476
+ attr_accessor :id
477
+
478
+ # The label of the MCP server.
479
+ sig { returns(String) }
480
+ attr_accessor :server_label
481
+
482
+ # The tools available on the server.
483
+ sig do
484
+ returns(
485
+ T::Array[
486
+ OpenAI::Conversations::ConversationItem::McpListTools::Tool
487
+ ]
488
+ )
489
+ end
490
+ attr_accessor :tools
491
+
492
+ # The type of the item. Always `mcp_list_tools`.
493
+ sig { returns(Symbol) }
494
+ attr_accessor :type
495
+
496
+ # Error message if the server could not list tools.
497
+ sig { returns(T.nilable(String)) }
498
+ attr_accessor :error
499
+
500
+ # A list of tools available on an MCP server.
501
+ sig do
502
+ params(
503
+ id: String,
504
+ server_label: String,
505
+ tools:
506
+ T::Array[
507
+ OpenAI::Conversations::ConversationItem::McpListTools::Tool::OrHash
508
+ ],
509
+ error: T.nilable(String),
510
+ type: Symbol
511
+ ).returns(T.attached_class)
512
+ end
513
+ def self.new(
514
+ # The unique ID of the list.
515
+ id:,
516
+ # The label of the MCP server.
517
+ server_label:,
518
+ # The tools available on the server.
519
+ tools:,
520
+ # Error message if the server could not list tools.
521
+ error: nil,
522
+ # The type of the item. Always `mcp_list_tools`.
523
+ type: :mcp_list_tools
524
+ )
525
+ end
526
+
527
+ sig do
528
+ override.returns(
529
+ {
530
+ id: String,
531
+ server_label: String,
532
+ tools:
533
+ T::Array[
534
+ OpenAI::Conversations::ConversationItem::McpListTools::Tool
535
+ ],
536
+ type: Symbol,
537
+ error: T.nilable(String)
538
+ }
539
+ )
540
+ end
541
+ def to_hash
542
+ end
543
+
544
+ class Tool < OpenAI::Internal::Type::BaseModel
545
+ OrHash =
546
+ T.type_alias do
547
+ T.any(
548
+ OpenAI::Conversations::ConversationItem::McpListTools::Tool,
549
+ OpenAI::Internal::AnyHash
550
+ )
551
+ end
552
+
553
+ # The JSON schema describing the tool's input.
554
+ sig { returns(T.anything) }
555
+ attr_accessor :input_schema
556
+
557
+ # The name of the tool.
558
+ sig { returns(String) }
559
+ attr_accessor :name
560
+
561
+ # Additional annotations about the tool.
562
+ sig { returns(T.nilable(T.anything)) }
563
+ attr_accessor :annotations
564
+
565
+ # The description of the tool.
566
+ sig { returns(T.nilable(String)) }
567
+ attr_accessor :description
568
+
569
+ # A tool available on an MCP server.
570
+ sig do
571
+ params(
572
+ input_schema: T.anything,
573
+ name: String,
574
+ annotations: T.nilable(T.anything),
575
+ description: T.nilable(String)
576
+ ).returns(T.attached_class)
577
+ end
578
+ def self.new(
579
+ # The JSON schema describing the tool's input.
580
+ input_schema:,
581
+ # The name of the tool.
582
+ name:,
583
+ # Additional annotations about the tool.
584
+ annotations: nil,
585
+ # The description of the tool.
586
+ description: nil
587
+ )
588
+ end
589
+
590
+ sig do
591
+ override.returns(
592
+ {
593
+ input_schema: T.anything,
594
+ name: String,
595
+ annotations: T.nilable(T.anything),
596
+ description: T.nilable(String)
597
+ }
598
+ )
599
+ end
600
+ def to_hash
601
+ end
602
+ end
603
+ end
604
+
605
+ class McpApprovalRequest < OpenAI::Internal::Type::BaseModel
606
+ OrHash =
607
+ T.type_alias do
608
+ T.any(
609
+ OpenAI::Conversations::ConversationItem::McpApprovalRequest,
610
+ OpenAI::Internal::AnyHash
611
+ )
612
+ end
613
+
614
+ # The unique ID of the approval request.
615
+ sig { returns(String) }
616
+ attr_accessor :id
617
+
618
+ # A JSON string of arguments for the tool.
619
+ sig { returns(String) }
620
+ attr_accessor :arguments
621
+
622
+ # The name of the tool to run.
623
+ sig { returns(String) }
624
+ attr_accessor :name
625
+
626
+ # The label of the MCP server making the request.
627
+ sig { returns(String) }
628
+ attr_accessor :server_label
629
+
630
+ # The type of the item. Always `mcp_approval_request`.
631
+ sig { returns(Symbol) }
632
+ attr_accessor :type
633
+
634
+ # A request for human approval of a tool invocation.
635
+ sig do
636
+ params(
637
+ id: String,
638
+ arguments: String,
639
+ name: String,
640
+ server_label: String,
641
+ type: Symbol
642
+ ).returns(T.attached_class)
643
+ end
644
+ def self.new(
645
+ # The unique ID of the approval request.
646
+ id:,
647
+ # A JSON string of arguments for the tool.
648
+ arguments:,
649
+ # The name of the tool to run.
650
+ name:,
651
+ # The label of the MCP server making the request.
652
+ server_label:,
653
+ # The type of the item. Always `mcp_approval_request`.
654
+ type: :mcp_approval_request
655
+ )
656
+ end
657
+
658
+ sig do
659
+ override.returns(
660
+ {
661
+ id: String,
662
+ arguments: String,
663
+ name: String,
664
+ server_label: String,
665
+ type: Symbol
666
+ }
667
+ )
668
+ end
669
+ def to_hash
670
+ end
671
+ end
672
+
673
+ class McpApprovalResponse < OpenAI::Internal::Type::BaseModel
674
+ OrHash =
675
+ T.type_alias do
676
+ T.any(
677
+ OpenAI::Conversations::ConversationItem::McpApprovalResponse,
678
+ OpenAI::Internal::AnyHash
679
+ )
680
+ end
681
+
682
+ # The unique ID of the approval response
683
+ sig { returns(String) }
684
+ attr_accessor :id
685
+
686
+ # The ID of the approval request being answered.
687
+ sig { returns(String) }
688
+ attr_accessor :approval_request_id
689
+
690
+ # Whether the request was approved.
691
+ sig { returns(T::Boolean) }
692
+ attr_accessor :approve
693
+
694
+ # The type of the item. Always `mcp_approval_response`.
695
+ sig { returns(Symbol) }
696
+ attr_accessor :type
697
+
698
+ # Optional reason for the decision.
699
+ sig { returns(T.nilable(String)) }
700
+ attr_accessor :reason
701
+
702
+ # A response to an MCP approval request.
703
+ sig do
704
+ params(
705
+ id: String,
706
+ approval_request_id: String,
707
+ approve: T::Boolean,
708
+ reason: T.nilable(String),
709
+ type: Symbol
710
+ ).returns(T.attached_class)
711
+ end
712
+ def self.new(
713
+ # The unique ID of the approval response
714
+ id:,
715
+ # The ID of the approval request being answered.
716
+ approval_request_id:,
717
+ # Whether the request was approved.
718
+ approve:,
719
+ # Optional reason for the decision.
720
+ reason: nil,
721
+ # The type of the item. Always `mcp_approval_response`.
722
+ type: :mcp_approval_response
723
+ )
724
+ end
725
+
726
+ sig do
727
+ override.returns(
728
+ {
729
+ id: String,
730
+ approval_request_id: String,
731
+ approve: T::Boolean,
732
+ type: Symbol,
733
+ reason: T.nilable(String)
734
+ }
735
+ )
736
+ end
737
+ def to_hash
738
+ end
739
+ end
740
+
741
+ class McpCall < OpenAI::Internal::Type::BaseModel
742
+ OrHash =
743
+ T.type_alias do
744
+ T.any(
745
+ OpenAI::Conversations::ConversationItem::McpCall,
746
+ OpenAI::Internal::AnyHash
747
+ )
748
+ end
749
+
750
+ # The unique ID of the tool call.
751
+ sig { returns(String) }
752
+ attr_accessor :id
753
+
754
+ # A JSON string of the arguments passed to the tool.
755
+ sig { returns(String) }
756
+ attr_accessor :arguments
757
+
758
+ # The name of the tool that was run.
759
+ sig { returns(String) }
760
+ attr_accessor :name
761
+
762
+ # The label of the MCP server running the tool.
763
+ sig { returns(String) }
764
+ attr_accessor :server_label
765
+
766
+ # The type of the item. Always `mcp_call`.
767
+ sig { returns(Symbol) }
768
+ attr_accessor :type
769
+
770
+ # The error from the tool call, if any.
771
+ sig { returns(T.nilable(String)) }
772
+ attr_accessor :error
773
+
774
+ # The output from the tool call.
775
+ sig { returns(T.nilable(String)) }
776
+ attr_accessor :output
777
+
778
+ # An invocation of a tool on an MCP server.
779
+ sig do
780
+ params(
781
+ id: String,
782
+ arguments: String,
783
+ name: String,
784
+ server_label: String,
785
+ error: T.nilable(String),
786
+ output: T.nilable(String),
787
+ type: Symbol
788
+ ).returns(T.attached_class)
789
+ end
790
+ def self.new(
791
+ # The unique ID of the tool call.
792
+ id:,
793
+ # A JSON string of the arguments passed to the tool.
794
+ arguments:,
795
+ # The name of the tool that was run.
796
+ name:,
797
+ # The label of the MCP server running the tool.
798
+ server_label:,
799
+ # The error from the tool call, if any.
800
+ error: nil,
801
+ # The output from the tool call.
802
+ output: nil,
803
+ # The type of the item. Always `mcp_call`.
804
+ type: :mcp_call
805
+ )
806
+ end
807
+
808
+ sig do
809
+ override.returns(
810
+ {
811
+ id: String,
812
+ arguments: String,
813
+ name: String,
814
+ server_label: String,
815
+ type: Symbol,
816
+ error: T.nilable(String),
817
+ output: T.nilable(String)
818
+ }
819
+ )
820
+ end
821
+ def to_hash
822
+ end
823
+ end
824
+
825
+ sig do
826
+ override.returns(
827
+ T::Array[OpenAI::Conversations::ConversationItem::Variants]
828
+ )
829
+ end
830
+ def self.variants
831
+ end
832
+ end
833
+ end
834
+ end
835
+ end