openai 0.17.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 (209) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +50 -0
  3. data/README.md +1 -1
  4. data/lib/openai/client.rb +4 -0
  5. data/lib/openai/helpers/structured_output/array_of.rb +2 -10
  6. data/lib/openai/helpers/structured_output/base_model.rb +4 -11
  7. data/lib/openai/helpers/structured_output/boolean.rb +1 -0
  8. data/lib/openai/helpers/structured_output/json_schema_converter.rb +19 -3
  9. data/lib/openai/helpers/structured_output/union_of.rb +2 -10
  10. data/lib/openai/internal/conversation_cursor_page.rb +92 -0
  11. data/lib/openai/internal/transport/base_client.rb +1 -4
  12. data/lib/openai/internal/transport/pooled_net_requester.rb +1 -9
  13. data/lib/openai/internal/util.rb +1 -1
  14. data/lib/openai/models/audio/transcription.rb +1 -4
  15. data/lib/openai/models/audio/transcription_create_params.rb +2 -7
  16. data/lib/openai/models/audio/transcription_text_done_event.rb +1 -4
  17. data/lib/openai/models/batch_create_params.rb +38 -1
  18. data/lib/openai/models/beta/assistant_create_params.rb +6 -19
  19. data/lib/openai/models/beta/assistant_stream_event.rb +6 -24
  20. data/lib/openai/models/beta/assistant_update_params.rb +1 -4
  21. data/lib/openai/models/beta/message_stream_event.rb +1 -4
  22. data/lib/openai/models/beta/run_step_stream_event.rb +1 -4
  23. data/lib/openai/models/beta/thread_create_and_run_params.rb +12 -34
  24. data/lib/openai/models/beta/thread_create_params.rb +7 -22
  25. data/lib/openai/models/beta/threads/message.rb +3 -10
  26. data/lib/openai/models/beta/threads/message_create_params.rb +2 -7
  27. data/lib/openai/models/beta/threads/run.rb +4 -9
  28. data/lib/openai/models/beta/threads/run_create_params.rb +5 -12
  29. data/lib/openai/models/beta/threads/run_submit_tool_outputs_params.rb +1 -3
  30. data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call.rb +5 -17
  31. data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call_delta.rb +1 -3
  32. data/lib/openai/models/beta/threads/runs/file_search_tool_call.rb +4 -12
  33. data/lib/openai/models/beta/threads/runs/run_step_delta_message_delta.rb +1 -4
  34. data/lib/openai/models/beta/threads/runs/tool_calls_step_details.rb +1 -4
  35. data/lib/openai/models/beta/threads/text.rb +1 -4
  36. data/lib/openai/models/chat/chat_completion.rb +6 -6
  37. data/lib/openai/models/chat/chat_completion_chunk.rb +7 -9
  38. data/lib/openai/models/chat/chat_completion_custom_tool.rb +2 -7
  39. data/lib/openai/models/chat/completion_create_params.rb +7 -7
  40. data/lib/openai/models/conversations/computer_screenshot_content.rb +38 -0
  41. data/lib/openai/models/conversations/container_file_citation_body.rb +58 -0
  42. data/lib/openai/models/conversations/conversation.rb +51 -0
  43. data/lib/openai/models/conversations/conversation_create_params.rb +39 -0
  44. data/lib/openai/models/conversations/conversation_delete_params.rb +16 -0
  45. data/lib/openai/models/conversations/conversation_deleted.rb +29 -0
  46. data/lib/openai/models/conversations/conversation_deleted_resource.rb +30 -0
  47. data/lib/openai/models/conversations/conversation_item.rb +568 -0
  48. data/lib/openai/models/conversations/conversation_item_list.rb +55 -0
  49. data/lib/openai/models/conversations/conversation_retrieve_params.rb +16 -0
  50. data/lib/openai/models/conversations/conversation_update_params.rb +31 -0
  51. data/lib/openai/models/conversations/file_citation_body.rb +42 -0
  52. data/lib/openai/models/conversations/input_file_content.rb +42 -0
  53. data/lib/openai/models/conversations/input_image_content.rb +62 -0
  54. data/lib/openai/models/conversations/input_text_content.rb +26 -0
  55. data/lib/openai/models/conversations/item_create_params.rb +37 -0
  56. data/lib/openai/models/conversations/item_delete_params.rb +22 -0
  57. data/lib/openai/models/conversations/item_list_params.rb +84 -0
  58. data/lib/openai/models/conversations/item_retrieve_params.rb +36 -0
  59. data/lib/openai/models/conversations/lob_prob.rb +35 -0
  60. data/lib/openai/models/conversations/message.rb +115 -0
  61. data/lib/openai/models/conversations/output_text_content.rb +57 -0
  62. data/lib/openai/models/conversations/refusal_content.rb +26 -0
  63. data/lib/openai/models/conversations/summary_text_content.rb +23 -0
  64. data/lib/openai/models/conversations/text_content.rb +23 -0
  65. data/lib/openai/models/conversations/top_log_prob.rb +29 -0
  66. data/lib/openai/models/conversations/url_citation_body.rb +50 -0
  67. data/lib/openai/models/eval_create_params.rb +6 -20
  68. data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +29 -53
  69. data/lib/openai/models/evals/create_eval_jsonl_run_data_source.rb +1 -3
  70. data/lib/openai/models/evals/run_create_params.rb +18 -54
  71. data/lib/openai/models/file_create_params.rb +37 -1
  72. data/lib/openai/models/fine_tuning/reinforcement_hyperparameters.rb +1 -4
  73. data/lib/openai/models/graders/text_similarity_grader.rb +6 -5
  74. data/lib/openai/models/moderation.rb +5 -15
  75. data/lib/openai/models/reasoning.rb +1 -1
  76. data/lib/openai/models/responses/input_item_list_params.rb +1 -9
  77. data/lib/openai/models/responses/response.rb +32 -9
  78. data/lib/openai/models/responses/response_computer_tool_call.rb +2 -6
  79. data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +1 -3
  80. data/lib/openai/models/responses/response_conversation_param.rb +20 -0
  81. data/lib/openai/models/responses/response_create_params.rb +40 -9
  82. data/lib/openai/models/responses/response_input_item.rb +2 -7
  83. data/lib/openai/models/responses/response_input_message_item.rb +1 -4
  84. data/lib/openai/models/responses/response_output_item.rb +1 -3
  85. data/lib/openai/models/responses/response_output_message.rb +1 -3
  86. data/lib/openai/models/responses/response_output_text.rb +3 -10
  87. data/lib/openai/models/responses/response_stream_event.rb +4 -16
  88. data/lib/openai/models/responses/response_text_delta_event.rb +1 -3
  89. data/lib/openai/models/responses/response_text_done_event.rb +1 -3
  90. data/lib/openai/models/responses/tool.rb +145 -34
  91. data/lib/openai/models/upload_create_params.rb +37 -1
  92. data/lib/openai/models.rb +2 -0
  93. data/lib/openai/resources/batches.rb +3 -1
  94. data/lib/openai/resources/conversations/items.rb +141 -0
  95. data/lib/openai/resources/conversations.rb +112 -0
  96. data/lib/openai/resources/files.rb +4 -2
  97. data/lib/openai/resources/responses/input_items.rb +1 -3
  98. data/lib/openai/resources/responses.rb +8 -4
  99. data/lib/openai/resources/uploads.rb +3 -1
  100. data/lib/openai/version.rb +1 -1
  101. data/lib/openai.rb +31 -0
  102. data/rbi/openai/client.rbi +3 -0
  103. data/rbi/openai/errors.rbi +5 -5
  104. data/rbi/openai/helpers/structured_output/array_of.rbi +0 -3
  105. data/rbi/openai/helpers/structured_output/json_schema_converter.rbi +10 -0
  106. data/rbi/openai/internal/conversation_cursor_page.rbi +25 -0
  107. data/rbi/openai/models/batch_create_params.rbi +60 -0
  108. data/rbi/openai/models/beta/thread_create_and_run_params.rbi +3 -3
  109. data/rbi/openai/models/beta/threads/run.rbi +3 -3
  110. data/rbi/openai/models/beta/threads/run_create_params.rbi +3 -3
  111. data/rbi/openai/models/chat/chat_completion.rbi +6 -9
  112. data/rbi/openai/models/chat/chat_completion_chunk.rbi +6 -9
  113. data/rbi/openai/models/chat/completion_create_params.rbi +8 -11
  114. data/rbi/openai/models/conversations/computer_screenshot_content.rbi +60 -0
  115. data/rbi/openai/models/conversations/container_file_citation_body.rbi +82 -0
  116. data/rbi/openai/models/conversations/conversation.rbi +76 -0
  117. data/rbi/openai/models/conversations/conversation_create_params.rbi +144 -0
  118. data/rbi/openai/models/conversations/conversation_delete_params.rbi +32 -0
  119. data/rbi/openai/models/conversations/conversation_deleted.rbi +40 -0
  120. data/rbi/openai/models/conversations/conversation_deleted_resource.rbi +40 -0
  121. data/rbi/openai/models/conversations/conversation_item.rbi +835 -0
  122. data/rbi/openai/models/conversations/conversation_item_list.rbi +101 -0
  123. data/rbi/openai/models/conversations/conversation_retrieve_params.rbi +32 -0
  124. data/rbi/openai/models/conversations/conversation_update_params.rbi +56 -0
  125. data/rbi/openai/models/conversations/file_citation_body.rbi +61 -0
  126. data/rbi/openai/models/conversations/input_file_content.rbi +72 -0
  127. data/rbi/openai/models/conversations/input_image_content.rbi +113 -0
  128. data/rbi/openai/models/conversations/input_text_content.rbi +38 -0
  129. data/rbi/openai/models/conversations/item_create_params.rbi +150 -0
  130. data/rbi/openai/models/conversations/item_delete_params.rbi +40 -0
  131. data/rbi/openai/models/conversations/item_list_params.rbi +174 -0
  132. data/rbi/openai/models/conversations/item_retrieve_params.rbi +70 -0
  133. data/rbi/openai/models/conversations/lob_prob.rbi +50 -0
  134. data/rbi/openai/models/conversations/message.rbi +196 -0
  135. data/rbi/openai/models/conversations/output_text_content.rbi +110 -0
  136. data/rbi/openai/models/conversations/refusal_content.rbi +38 -0
  137. data/rbi/openai/models/conversations/summary_text_content.rbi +31 -0
  138. data/rbi/openai/models/conversations/text_content.rbi +28 -0
  139. data/rbi/openai/models/conversations/top_log_prob.rbi +41 -0
  140. data/rbi/openai/models/conversations/url_citation_body.rbi +74 -0
  141. data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +33 -33
  142. data/rbi/openai/models/file_create_params.rbi +56 -0
  143. data/rbi/openai/models/graders/text_similarity_grader.rbi +11 -6
  144. data/rbi/openai/models/reasoning.rbi +1 -1
  145. data/rbi/openai/models/responses/input_item_list_params.rbi +0 -11
  146. data/rbi/openai/models/responses/response.rbi +57 -11
  147. data/rbi/openai/models/responses/response_conversation_param.rbi +33 -0
  148. data/rbi/openai/models/responses/response_create_params.rbi +62 -11
  149. data/rbi/openai/models/responses/tool.rbi +243 -31
  150. data/rbi/openai/models/upload_create_params.rbi +56 -0
  151. data/rbi/openai/models.rbi +2 -0
  152. data/rbi/openai/resources/batches.rbi +5 -0
  153. data/rbi/openai/resources/beta/threads/runs.rbi +2 -2
  154. data/rbi/openai/resources/beta/threads.rbi +2 -2
  155. data/rbi/openai/resources/chat/completions.rbi +6 -8
  156. data/rbi/openai/resources/conversations/items.rbi +152 -0
  157. data/rbi/openai/resources/conversations.rbi +110 -0
  158. data/rbi/openai/resources/files.rbi +5 -1
  159. data/rbi/openai/resources/responses/input_items.rbi +0 -3
  160. data/rbi/openai/resources/responses.rbi +32 -8
  161. data/rbi/openai/resources/uploads.rbi +4 -0
  162. data/sig/openai/client.rbs +2 -0
  163. data/sig/openai/internal/conversation_cursor_page.rbs +15 -0
  164. data/sig/openai/models/batch_create_params.rbs +22 -1
  165. data/sig/openai/models/conversations/computer_screenshot_content.rbs +28 -0
  166. data/sig/openai/models/conversations/container_file_citation_body.rbs +47 -0
  167. data/sig/openai/models/conversations/conversation.rbs +37 -0
  168. data/sig/openai/models/conversations/conversation_create_params.rbs +33 -0
  169. data/sig/openai/models/conversations/conversation_delete_params.rbs +17 -0
  170. data/sig/openai/models/conversations/conversation_deleted.rbs +28 -0
  171. data/sig/openai/models/conversations/conversation_deleted_resource.rbs +28 -0
  172. data/sig/openai/models/conversations/conversation_item.rbs +403 -0
  173. data/sig/openai/models/conversations/conversation_item_list.rbs +44 -0
  174. data/sig/openai/models/conversations/conversation_retrieve_params.rbs +17 -0
  175. data/sig/openai/models/conversations/conversation_update_params.rbs +26 -0
  176. data/sig/openai/models/conversations/file_citation_body.rbs +37 -0
  177. data/sig/openai/models/conversations/input_file_content.rbs +41 -0
  178. data/sig/openai/models/conversations/input_image_content.rbs +49 -0
  179. data/sig/openai/models/conversations/input_text_content.rbs +17 -0
  180. data/sig/openai/models/conversations/item_create_params.rbs +37 -0
  181. data/sig/openai/models/conversations/item_delete_params.rbs +25 -0
  182. data/sig/openai/models/conversations/item_list_params.rbs +66 -0
  183. data/sig/openai/models/conversations/item_retrieve_params.rbs +37 -0
  184. data/sig/openai/models/conversations/lob_prob.rbs +37 -0
  185. data/sig/openai/models/conversations/message.rbs +95 -0
  186. data/sig/openai/models/conversations/output_text_content.rbs +52 -0
  187. data/sig/openai/models/conversations/refusal_content.rbs +17 -0
  188. data/sig/openai/models/conversations/summary_text_content.rbs +17 -0
  189. data/sig/openai/models/conversations/text_content.rbs +17 -0
  190. data/sig/openai/models/conversations/top_log_prob.rbs +28 -0
  191. data/sig/openai/models/conversations/url_citation_body.rbs +42 -0
  192. data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +22 -22
  193. data/sig/openai/models/file_create_params.rbs +22 -1
  194. data/sig/openai/models/graders/text_similarity_grader.rbs +3 -1
  195. data/sig/openai/models/responses/input_item_list_params.rbs +0 -7
  196. data/sig/openai/models/responses/response.rbs +15 -0
  197. data/sig/openai/models/responses/response_conversation_param.rbs +15 -0
  198. data/sig/openai/models/responses/response_create_params.rbs +14 -0
  199. data/sig/openai/models/responses/tool.rbs +83 -18
  200. data/sig/openai/models/upload_create_params.rbs +22 -1
  201. data/sig/openai/models.rbs +2 -0
  202. data/sig/openai/resources/batches.rbs +1 -0
  203. data/sig/openai/resources/conversations/items.rbs +38 -0
  204. data/sig/openai/resources/conversations.rbs +31 -0
  205. data/sig/openai/resources/files.rbs +1 -0
  206. data/sig/openai/resources/responses/input_items.rbs +0 -1
  207. data/sig/openai/resources/responses.rbs +2 -0
  208. data/sig/openai/resources/uploads.rbs +1 -0
  209. metadata +95 -2
@@ -0,0 +1,42 @@
1
+ module OpenAI
2
+ module Models
3
+ module Conversations
4
+ type url_citation_body =
5
+ {
6
+ end_index: Integer,
7
+ start_index: Integer,
8
+ title: String,
9
+ type: :url_citation,
10
+ url: String
11
+ }
12
+
13
+ class URLCitationBody < OpenAI::Internal::Type::BaseModel
14
+ attr_accessor end_index: Integer
15
+
16
+ attr_accessor start_index: Integer
17
+
18
+ attr_accessor title: String
19
+
20
+ attr_accessor type: :url_citation
21
+
22
+ attr_accessor url: String
23
+
24
+ def initialize: (
25
+ end_index: Integer,
26
+ start_index: Integer,
27
+ title: String,
28
+ url: String,
29
+ ?type: :url_citation
30
+ ) -> void
31
+
32
+ def to_hash: -> {
33
+ end_index: Integer,
34
+ start_index: Integer,
35
+ title: String,
36
+ type: :url_citation,
37
+ url: String
38
+ }
39
+ end
40
+ end
41
+ end
42
+ end
@@ -195,46 +195,46 @@ module OpenAI
195
195
 
196
196
  type template =
197
197
  OpenAI::Responses::EasyInputMessage
198
- | OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message
198
+ | OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem
199
199
 
200
200
  module Template
201
201
  extend OpenAI::Internal::Type::Union
202
202
 
203
- type message =
203
+ type eval_item =
204
204
  {
205
- content: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::content,
206
- role: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::role,
207
- type: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::type_
205
+ content: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::content,
206
+ role: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::role,
207
+ type: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::type_
208
208
  }
209
209
 
210
- class Message < OpenAI::Internal::Type::BaseModel
211
- attr_accessor content: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::content
210
+ class EvalItem < OpenAI::Internal::Type::BaseModel
211
+ attr_accessor content: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::content
212
212
 
213
- attr_accessor role: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::role
213
+ attr_accessor role: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::role
214
214
 
215
- attr_reader type: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::type_?
215
+ attr_reader type: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::type_?
216
216
 
217
217
  def type=: (
218
- OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::type_
219
- ) -> OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::type_
218
+ OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::type_
219
+ ) -> OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::type_
220
220
 
221
221
  def initialize: (
222
- content: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::content,
223
- role: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::role,
224
- ?type: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::type_
222
+ content: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::content,
223
+ role: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::role,
224
+ ?type: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::type_
225
225
  ) -> void
226
226
 
227
227
  def to_hash: -> {
228
- content: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::content,
229
- role: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::role,
230
- type: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::type_
228
+ content: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::content,
229
+ role: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::role,
230
+ type: OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::type_
231
231
  }
232
232
 
233
233
  type content =
234
234
  String
235
235
  | OpenAI::Responses::ResponseInputText
236
- | OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::OutputText
237
- | OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::Content::InputImage
236
+ | OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::OutputText
237
+ | OpenAI::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::Content::InputImage
238
238
  | ::Array[top]
239
239
 
240
240
  module Content
@@ -277,7 +277,7 @@ module OpenAI
277
277
  }
278
278
  end
279
279
 
280
- def self?.variants: -> ::Array[OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::content]
280
+ def self?.variants: -> ::Array[OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::content]
281
281
 
282
282
  AnArrayOfInputTextAndInputImageArray: OpenAI::Internal::Type::Converter
283
283
  end
@@ -292,7 +292,7 @@ module OpenAI
292
292
  SYSTEM: :system
293
293
  DEVELOPER: :developer
294
294
 
295
- def self?.values: -> ::Array[OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::role]
295
+ def self?.values: -> ::Array[OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::role]
296
296
  end
297
297
 
298
298
  type type_ = :message
@@ -302,7 +302,7 @@ module OpenAI
302
302
 
303
303
  MESSAGE: :message
304
304
 
305
- def self?.values: -> ::Array[OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::Message::type_]
305
+ def self?.values: -> ::Array[OpenAI::Models::Evals::CreateEvalCompletionsRunDataSource::InputMessages::Template::Template::EvalItem::type_]
306
306
  end
307
307
  end
308
308
 
@@ -3,7 +3,8 @@ module OpenAI
3
3
  type file_create_params =
4
4
  {
5
5
  file: OpenAI::Internal::file_input,
6
- purpose: OpenAI::Models::file_purpose
6
+ purpose: OpenAI::Models::file_purpose,
7
+ expires_after: OpenAI::FileCreateParams::ExpiresAfter
7
8
  }
8
9
  & OpenAI::Internal::Type::request_parameters
9
10
 
@@ -15,17 +16,37 @@ module OpenAI
15
16
 
16
17
  attr_accessor purpose: OpenAI::Models::file_purpose
17
18
 
19
+ attr_reader expires_after: OpenAI::FileCreateParams::ExpiresAfter?
20
+
21
+ def expires_after=: (
22
+ OpenAI::FileCreateParams::ExpiresAfter
23
+ ) -> OpenAI::FileCreateParams::ExpiresAfter
24
+
18
25
  def initialize: (
19
26
  file: OpenAI::Internal::file_input,
20
27
  purpose: OpenAI::Models::file_purpose,
28
+ ?expires_after: OpenAI::FileCreateParams::ExpiresAfter,
21
29
  ?request_options: OpenAI::request_opts
22
30
  ) -> void
23
31
 
24
32
  def to_hash: -> {
25
33
  file: OpenAI::Internal::file_input,
26
34
  purpose: OpenAI::Models::file_purpose,
35
+ expires_after: OpenAI::FileCreateParams::ExpiresAfter,
27
36
  request_options: OpenAI::RequestOptions
28
37
  }
38
+
39
+ type expires_after = { anchor: :created_at, seconds: Integer }
40
+
41
+ class ExpiresAfter < OpenAI::Internal::Type::BaseModel
42
+ attr_accessor anchor: :created_at
43
+
44
+ attr_accessor seconds: Integer
45
+
46
+ def initialize: (seconds: Integer, ?anchor: :created_at) -> void
47
+
48
+ def to_hash: -> { anchor: :created_at, seconds: Integer }
49
+ end
29
50
  end
30
51
  end
31
52
  end
@@ -40,7 +40,8 @@ module OpenAI
40
40
  }
41
41
 
42
42
  type evaluation_metric =
43
- :fuzzy_match
43
+ :cosine
44
+ | :fuzzy_match
44
45
  | :bleu
45
46
  | :gleu
46
47
  | :meteor
@@ -54,6 +55,7 @@ module OpenAI
54
55
  module EvaluationMetric
55
56
  extend OpenAI::Internal::Type::Enum
56
57
 
58
+ COSINE: :cosine
57
59
  FUZZY_MATCH: :fuzzy_match
58
60
  BLEU: :bleu
59
61
  GLEU: :gleu
@@ -4,7 +4,6 @@ module OpenAI
4
4
  type input_item_list_params =
5
5
  {
6
6
  after: String,
7
- before: String,
8
7
  include: ::Array[OpenAI::Models::Responses::response_includable],
9
8
  limit: Integer,
10
9
  order: OpenAI::Models::Responses::InputItemListParams::order
@@ -19,10 +18,6 @@ module OpenAI
19
18
 
20
19
  def after=: (String) -> String
21
20
 
22
- attr_reader before: String?
23
-
24
- def before=: (String) -> String
25
-
26
21
  attr_reader include: ::Array[OpenAI::Models::Responses::response_includable]?
27
22
 
28
23
  def include=: (
@@ -41,7 +36,6 @@ module OpenAI
41
36
 
42
37
  def initialize: (
43
38
  ?after: String,
44
- ?before: String,
45
39
  ?include: ::Array[OpenAI::Models::Responses::response_includable],
46
40
  ?limit: Integer,
47
41
  ?order: OpenAI::Models::Responses::InputItemListParams::order,
@@ -50,7 +44,6 @@ module OpenAI
50
44
 
51
45
  def to_hash: -> {
52
46
  after: String,
53
- before: String,
54
47
  include: ::Array[OpenAI::Models::Responses::response_includable],
55
48
  limit: Integer,
56
49
  order: OpenAI::Models::Responses::InputItemListParams::order,
@@ -18,6 +18,7 @@ module OpenAI
18
18
  tools: ::Array[OpenAI::Models::Responses::tool],
19
19
  top_p: Float?,
20
20
  background: bool?,
21
+ conversation: OpenAI::Responses::Response::Conversation?,
21
22
  max_output_tokens: Integer?,
22
23
  max_tool_calls: Integer?,
23
24
  previous_response_id: String?,
@@ -65,6 +66,8 @@ module OpenAI
65
66
 
66
67
  attr_accessor background: bool?
67
68
 
69
+ attr_accessor conversation: OpenAI::Responses::Response::Conversation?
70
+
68
71
  attr_accessor max_output_tokens: Integer?
69
72
 
70
73
  attr_accessor max_tool_calls: Integer?
@@ -126,6 +129,7 @@ module OpenAI
126
129
  tools: ::Array[OpenAI::Models::Responses::tool],
127
130
  top_p: Float?,
128
131
  ?background: bool?,
132
+ ?conversation: OpenAI::Responses::Response::Conversation?,
129
133
  ?max_output_tokens: Integer?,
130
134
  ?max_tool_calls: Integer?,
131
135
  ?previous_response_id: String?,
@@ -159,6 +163,7 @@ module OpenAI
159
163
  tools: ::Array[OpenAI::Models::Responses::tool],
160
164
  top_p: Float?,
161
165
  background: bool?,
166
+ conversation: OpenAI::Responses::Response::Conversation?,
162
167
  max_output_tokens: Integer?,
163
168
  max_tool_calls: Integer?,
164
169
  previous_response_id: String?,
@@ -232,6 +237,16 @@ module OpenAI
232
237
  def self?.variants: -> ::Array[OpenAI::Models::Responses::Response::tool_choice]
233
238
  end
234
239
 
240
+ type conversation = { id: String }
241
+
242
+ class Conversation < OpenAI::Internal::Type::BaseModel
243
+ attr_accessor id: String
244
+
245
+ def initialize: (id: String) -> void
246
+
247
+ def to_hash: -> { id: String }
248
+ end
249
+
235
250
  type service_tier = :auto | :default | :flex | :scale | :priority
236
251
 
237
252
  module ServiceTier
@@ -0,0 +1,15 @@
1
+ module OpenAI
2
+ module Models
3
+ module Responses
4
+ type response_conversation_param = { id: String }
5
+
6
+ class ResponseConversationParam < OpenAI::Internal::Type::BaseModel
7
+ attr_accessor id: String
8
+
9
+ def initialize: (id: String) -> void
10
+
11
+ def to_hash: -> { id: String }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -4,6 +4,7 @@ module OpenAI
4
4
  type response_create_params =
5
5
  {
6
6
  background: bool?,
7
+ conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?,
7
8
  include: ::Array[OpenAI::Models::Responses::response_includable]?,
8
9
  input: OpenAI::Models::Responses::ResponseCreateParams::input,
9
10
  instructions: String?,
@@ -37,6 +38,8 @@ module OpenAI
37
38
 
38
39
  attr_accessor background: bool?
39
40
 
41
+ attr_accessor conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?
42
+
40
43
  attr_accessor include: ::Array[OpenAI::Models::Responses::response_includable]?
41
44
 
42
45
  attr_reader input: OpenAI::Models::Responses::ResponseCreateParams::input?
@@ -113,6 +116,7 @@ module OpenAI
113
116
 
114
117
  def initialize: (
115
118
  ?background: bool?,
119
+ ?conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?,
116
120
  ?include: ::Array[OpenAI::Models::Responses::response_includable]?,
117
121
  ?input: OpenAI::Models::Responses::ResponseCreateParams::input,
118
122
  ?instructions: String?,
@@ -142,6 +146,7 @@ module OpenAI
142
146
 
143
147
  def to_hash: -> {
144
148
  background: bool?,
149
+ conversation: OpenAI::Models::Responses::ResponseCreateParams::conversation?,
145
150
  include: ::Array[OpenAI::Models::Responses::response_includable]?,
146
151
  input: OpenAI::Models::Responses::ResponseCreateParams::input,
147
152
  instructions: String?,
@@ -169,6 +174,15 @@ module OpenAI
169
174
  request_options: OpenAI::RequestOptions
170
175
  }
171
176
 
177
+ type conversation =
178
+ String | OpenAI::Responses::ResponseConversationParam
179
+
180
+ module Conversation
181
+ extend OpenAI::Internal::Type::Union
182
+
183
+ def self?.variants: -> ::Array[OpenAI::Models::Responses::ResponseCreateParams::conversation]
184
+ end
185
+
172
186
  type input = String | OpenAI::Models::Responses::response_input
173
187
 
174
188
  module Input
@@ -18,23 +18,33 @@ module OpenAI
18
18
  type mcp =
19
19
  {
20
20
  server_label: String,
21
- server_url: String,
22
21
  type: :mcp,
23
22
  allowed_tools: OpenAI::Models::Responses::Tool::Mcp::allowed_tools?,
23
+ authorization: String,
24
+ connector_id: OpenAI::Models::Responses::Tool::Mcp::connector_id,
24
25
  headers: ::Hash[Symbol, String]?,
25
26
  require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?,
26
- server_description: String
27
+ server_description: String,
28
+ server_url: String
27
29
  }
28
30
 
29
31
  class Mcp < OpenAI::Internal::Type::BaseModel
30
32
  attr_accessor server_label: String
31
33
 
32
- attr_accessor server_url: String
33
-
34
34
  attr_accessor type: :mcp
35
35
 
36
36
  attr_accessor allowed_tools: OpenAI::Models::Responses::Tool::Mcp::allowed_tools?
37
37
 
38
+ attr_reader authorization: String?
39
+
40
+ def authorization=: (String) -> String
41
+
42
+ attr_reader connector_id: OpenAI::Models::Responses::Tool::Mcp::connector_id?
43
+
44
+ def connector_id=: (
45
+ OpenAI::Models::Responses::Tool::Mcp::connector_id
46
+ ) -> OpenAI::Models::Responses::Tool::Mcp::connector_id
47
+
38
48
  attr_accessor headers: ::Hash[Symbol, String]?
39
49
 
40
50
  attr_accessor require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?
@@ -43,43 +53,59 @@ module OpenAI
43
53
 
44
54
  def server_description=: (String) -> String
45
55
 
56
+ attr_reader server_url: String?
57
+
58
+ def server_url=: (String) -> String
59
+
46
60
  def initialize: (
47
61
  server_label: String,
48
- server_url: String,
49
62
  ?allowed_tools: OpenAI::Models::Responses::Tool::Mcp::allowed_tools?,
63
+ ?authorization: String,
64
+ ?connector_id: OpenAI::Models::Responses::Tool::Mcp::connector_id,
50
65
  ?headers: ::Hash[Symbol, String]?,
51
66
  ?require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?,
52
67
  ?server_description: String,
68
+ ?server_url: String,
53
69
  ?type: :mcp
54
70
  ) -> void
55
71
 
56
72
  def to_hash: -> {
57
73
  server_label: String,
58
- server_url: String,
59
74
  type: :mcp,
60
75
  allowed_tools: OpenAI::Models::Responses::Tool::Mcp::allowed_tools?,
76
+ authorization: String,
77
+ connector_id: OpenAI::Models::Responses::Tool::Mcp::connector_id,
61
78
  headers: ::Hash[Symbol, String]?,
62
79
  require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?,
63
- server_description: String
80
+ server_description: String,
81
+ server_url: String
64
82
  }
65
83
 
66
84
  type allowed_tools =
67
85
  ::Array[String]
68
- | OpenAI::Responses::Tool::Mcp::AllowedTools::McpAllowedToolsFilter
86
+ | OpenAI::Responses::Tool::Mcp::AllowedTools::McpToolFilter
69
87
 
70
88
  module AllowedTools
71
89
  extend OpenAI::Internal::Type::Union
72
90
 
73
- type mcp_allowed_tools_filter = { tool_names: ::Array[String] }
91
+ type mcp_tool_filter =
92
+ { read_only: bool, tool_names: ::Array[String] }
93
+
94
+ class McpToolFilter < OpenAI::Internal::Type::BaseModel
95
+ attr_reader read_only: bool?
96
+
97
+ def read_only=: (bool) -> bool
74
98
 
75
- class McpAllowedToolsFilter < OpenAI::Internal::Type::BaseModel
76
99
  attr_reader tool_names: ::Array[String]?
77
100
 
78
101
  def tool_names=: (::Array[String]) -> ::Array[String]
79
102
 
80
- def initialize: (?tool_names: ::Array[String]) -> void
103
+ def initialize: (
104
+ ?read_only: bool,
105
+ ?tool_names: ::Array[String]
106
+ ) -> void
81
107
 
82
- def to_hash: -> { tool_names: ::Array[String] }
108
+ def to_hash: -> { read_only: bool, tool_names: ::Array[String] }
83
109
  end
84
110
 
85
111
  def self?.variants: -> ::Array[OpenAI::Models::Responses::Tool::Mcp::allowed_tools]
@@ -87,6 +113,31 @@ module OpenAI
87
113
  StringArray: OpenAI::Internal::Type::Converter
88
114
  end
89
115
 
116
+ type connector_id =
117
+ :connector_dropbox
118
+ | :connector_gmail
119
+ | :connector_googlecalendar
120
+ | :connector_googledrive
121
+ | :connector_microsoftteams
122
+ | :connector_outlookcalendar
123
+ | :connector_outlookemail
124
+ | :connector_sharepoint
125
+
126
+ module ConnectorID
127
+ extend OpenAI::Internal::Type::Enum
128
+
129
+ CONNECTOR_DROPBOX: :connector_dropbox
130
+ CONNECTOR_GMAIL: :connector_gmail
131
+ CONNECTOR_GOOGLECALENDAR: :connector_googlecalendar
132
+ CONNECTOR_GOOGLEDRIVE: :connector_googledrive
133
+ CONNECTOR_MICROSOFTTEAMS: :connector_microsoftteams
134
+ CONNECTOR_OUTLOOKCALENDAR: :connector_outlookcalendar
135
+ CONNECTOR_OUTLOOKEMAIL: :connector_outlookemail
136
+ CONNECTOR_SHAREPOINT: :connector_sharepoint
137
+
138
+ def self?.values: -> ::Array[OpenAI::Models::Responses::Tool::Mcp::connector_id]
139
+ end
140
+
90
141
  type require_approval =
91
142
  OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter
92
143
  | OpenAI::Models::Responses::Tool::Mcp::RequireApproval::mcp_tool_approval_setting
@@ -123,28 +174,42 @@ module OpenAI
123
174
  never: OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Never
124
175
  }
125
176
 
126
- type always = { tool_names: ::Array[String] }
177
+ type always = { read_only: bool, tool_names: ::Array[String] }
127
178
 
128
179
  class Always < OpenAI::Internal::Type::BaseModel
180
+ attr_reader read_only: bool?
181
+
182
+ def read_only=: (bool) -> bool
183
+
129
184
  attr_reader tool_names: ::Array[String]?
130
185
 
131
186
  def tool_names=: (::Array[String]) -> ::Array[String]
132
187
 
133
- def initialize: (?tool_names: ::Array[String]) -> void
188
+ def initialize: (
189
+ ?read_only: bool,
190
+ ?tool_names: ::Array[String]
191
+ ) -> void
134
192
 
135
- def to_hash: -> { tool_names: ::Array[String] }
193
+ def to_hash: -> { read_only: bool, tool_names: ::Array[String] }
136
194
  end
137
195
 
138
- type never = { tool_names: ::Array[String] }
196
+ type never = { read_only: bool, tool_names: ::Array[String] }
139
197
 
140
198
  class Never < OpenAI::Internal::Type::BaseModel
199
+ attr_reader read_only: bool?
200
+
201
+ def read_only=: (bool) -> bool
202
+
141
203
  attr_reader tool_names: ::Array[String]?
142
204
 
143
205
  def tool_names=: (::Array[String]) -> ::Array[String]
144
206
 
145
- def initialize: (?tool_names: ::Array[String]) -> void
207
+ def initialize: (
208
+ ?read_only: bool,
209
+ ?tool_names: ::Array[String]
210
+ ) -> void
146
211
 
147
- def to_hash: -> { tool_names: ::Array[String] }
212
+ def to_hash: -> { read_only: bool, tool_names: ::Array[String] }
148
213
  end
149
214
  end
150
215
 
@@ -5,7 +5,8 @@ module OpenAI
5
5
  bytes: Integer,
6
6
  filename: String,
7
7
  mime_type: String,
8
- purpose: OpenAI::Models::file_purpose
8
+ purpose: OpenAI::Models::file_purpose,
9
+ expires_after: OpenAI::UploadCreateParams::ExpiresAfter
9
10
  }
10
11
  & OpenAI::Internal::Type::request_parameters
11
12
 
@@ -21,11 +22,18 @@ module OpenAI
21
22
 
22
23
  attr_accessor purpose: OpenAI::Models::file_purpose
23
24
 
25
+ attr_reader expires_after: OpenAI::UploadCreateParams::ExpiresAfter?
26
+
27
+ def expires_after=: (
28
+ OpenAI::UploadCreateParams::ExpiresAfter
29
+ ) -> OpenAI::UploadCreateParams::ExpiresAfter
30
+
24
31
  def initialize: (
25
32
  bytes: Integer,
26
33
  filename: String,
27
34
  mime_type: String,
28
35
  purpose: OpenAI::Models::file_purpose,
36
+ ?expires_after: OpenAI::UploadCreateParams::ExpiresAfter,
29
37
  ?request_options: OpenAI::request_opts
30
38
  ) -> void
31
39
 
@@ -34,8 +42,21 @@ module OpenAI
34
42
  filename: String,
35
43
  mime_type: String,
36
44
  purpose: OpenAI::Models::file_purpose,
45
+ expires_after: OpenAI::UploadCreateParams::ExpiresAfter,
37
46
  request_options: OpenAI::RequestOptions
38
47
  }
48
+
49
+ type expires_after = { anchor: :created_at, seconds: Integer }
50
+
51
+ class ExpiresAfter < OpenAI::Internal::Type::BaseModel
52
+ attr_accessor anchor: :created_at
53
+
54
+ attr_accessor seconds: Integer
55
+
56
+ def initialize: (seconds: Integer, ?anchor: :created_at) -> void
57
+
58
+ def to_hash: -> { anchor: :created_at, seconds: Integer }
59
+ end
39
60
  end
40
61
  end
41
62
  end
@@ -51,6 +51,8 @@ module OpenAI
51
51
 
52
52
  module Containers = OpenAI::Models::Containers
53
53
 
54
+ module Conversations = OpenAI::Models::Conversations
55
+
54
56
  class CreateEmbeddingResponse = OpenAI::Models::CreateEmbeddingResponse
55
57
 
56
58
  module CustomToolInputFormat = OpenAI::Models::CustomToolInputFormat
@@ -6,6 +6,7 @@ module OpenAI
6
6
  endpoint: OpenAI::Models::BatchCreateParams::endpoint,
7
7
  input_file_id: String,
8
8
  ?metadata: OpenAI::Models::metadata?,
9
+ ?output_expires_after: OpenAI::BatchCreateParams::OutputExpiresAfter,
9
10
  ?request_options: OpenAI::request_opts
10
11
  ) -> OpenAI::Batch
11
12
 
@@ -0,0 +1,38 @@
1
+ module OpenAI
2
+ module Resources
3
+ class Conversations
4
+ class Items
5
+ def create: (
6
+ String conversation_id,
7
+ items: ::Array[OpenAI::Models::Responses::response_input_item],
8
+ ?include: ::Array[OpenAI::Models::Responses::response_includable],
9
+ ?request_options: OpenAI::request_opts
10
+ ) -> OpenAI::Conversations::ConversationItemList
11
+
12
+ def retrieve: (
13
+ String item_id,
14
+ conversation_id: String,
15
+ ?include: ::Array[OpenAI::Models::Responses::response_includable],
16
+ ?request_options: OpenAI::request_opts
17
+ ) -> OpenAI::Models::Conversations::conversation_item
18
+
19
+ def list: (
20
+ String conversation_id,
21
+ ?after: String,
22
+ ?include: ::Array[OpenAI::Models::Responses::response_includable],
23
+ ?limit: Integer,
24
+ ?order: OpenAI::Models::Conversations::ItemListParams::order,
25
+ ?request_options: OpenAI::request_opts
26
+ ) -> OpenAI::Internal::ConversationCursorPage[OpenAI::Models::Conversations::conversation_item]
27
+
28
+ def delete: (
29
+ String item_id,
30
+ conversation_id: String,
31
+ ?request_options: OpenAI::request_opts
32
+ ) -> OpenAI::Conversations::Conversation
33
+
34
+ def initialize: (client: OpenAI::Client) -> void
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,31 @@
1
+ module OpenAI
2
+ module Resources
3
+ class Conversations
4
+ attr_reader items: OpenAI::Resources::Conversations::Items
5
+
6
+ def create: (
7
+ ?items: ::Array[OpenAI::Models::Responses::response_input_item]?,
8
+ ?metadata: OpenAI::Models::metadata?,
9
+ ?request_options: OpenAI::request_opts
10
+ ) -> OpenAI::Conversations::Conversation
11
+
12
+ def retrieve: (
13
+ String conversation_id,
14
+ ?request_options: OpenAI::request_opts
15
+ ) -> OpenAI::Conversations::Conversation
16
+
17
+ def update: (
18
+ String conversation_id,
19
+ metadata: ::Hash[Symbol, String],
20
+ ?request_options: OpenAI::request_opts
21
+ ) -> OpenAI::Conversations::Conversation
22
+
23
+ def delete: (
24
+ String conversation_id,
25
+ ?request_options: OpenAI::request_opts
26
+ ) -> OpenAI::Conversations::ConversationDeletedResource
27
+
28
+ def initialize: (client: OpenAI::Client) -> void
29
+ end
30
+ end
31
+ end