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
@@ -32,10 +32,6 @@ module OpenAI
32
32
  sig { returns(String) }
33
33
  attr_accessor :server_label
34
34
 
35
- # The URL for the MCP server.
36
- sig { returns(String) }
37
- attr_accessor :server_url
38
-
39
35
  # The type of the MCP tool. Always `mcp`.
40
36
  sig { returns(Symbol) }
41
37
  attr_accessor :type
@@ -46,13 +42,51 @@ module OpenAI
46
42
  T.nilable(
47
43
  T.any(
48
44
  T::Array[String],
49
- OpenAI::Responses::Tool::Mcp::AllowedTools::McpAllowedToolsFilter
45
+ OpenAI::Responses::Tool::Mcp::AllowedTools::McpToolFilter
50
46
  )
51
47
  )
52
48
  )
53
49
  end
54
50
  attr_accessor :allowed_tools
55
51
 
52
+ # An OAuth access token that can be used with a remote MCP server, either with a
53
+ # custom MCP server URL or a service connector. Your application must handle the
54
+ # OAuth authorization flow and provide the token here.
55
+ sig { returns(T.nilable(String)) }
56
+ attr_reader :authorization
57
+
58
+ sig { params(authorization: String).void }
59
+ attr_writer :authorization
60
+
61
+ # Identifier for service connectors, like those available in ChatGPT. One of
62
+ # `server_url` or `connector_id` must be provided. Learn more about service
63
+ # connectors
64
+ # [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
65
+ #
66
+ # Currently supported `connector_id` values are:
67
+ #
68
+ # - Dropbox: `connector_dropbox`
69
+ # - Gmail: `connector_gmail`
70
+ # - Google Calendar: `connector_googlecalendar`
71
+ # - Google Drive: `connector_googledrive`
72
+ # - Microsoft Teams: `connector_microsoftteams`
73
+ # - Outlook Calendar: `connector_outlookcalendar`
74
+ # - Outlook Email: `connector_outlookemail`
75
+ # - SharePoint: `connector_sharepoint`
76
+ sig do
77
+ returns(
78
+ T.nilable(OpenAI::Responses::Tool::Mcp::ConnectorID::OrSymbol)
79
+ )
80
+ end
81
+ attr_reader :connector_id
82
+
83
+ sig do
84
+ params(
85
+ connector_id: OpenAI::Responses::Tool::Mcp::ConnectorID::OrSymbol
86
+ ).void
87
+ end
88
+ attr_writer :connector_id
89
+
56
90
  # Optional HTTP headers to send to the MCP server. Use for authentication or other
57
91
  # purposes.
58
92
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
@@ -78,20 +112,29 @@ module OpenAI
78
112
  sig { params(server_description: String).void }
79
113
  attr_writer :server_description
80
114
 
115
+ # The URL for the MCP server. One of `server_url` or `connector_id` must be
116
+ # provided.
117
+ sig { returns(T.nilable(String)) }
118
+ attr_reader :server_url
119
+
120
+ sig { params(server_url: String).void }
121
+ attr_writer :server_url
122
+
81
123
  # Give the model access to additional tools via remote Model Context Protocol
82
124
  # (MCP) servers.
83
125
  # [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
84
126
  sig do
85
127
  params(
86
128
  server_label: String,
87
- server_url: String,
88
129
  allowed_tools:
89
130
  T.nilable(
90
131
  T.any(
91
132
  T::Array[String],
92
- OpenAI::Responses::Tool::Mcp::AllowedTools::McpAllowedToolsFilter::OrHash
133
+ OpenAI::Responses::Tool::Mcp::AllowedTools::McpToolFilter::OrHash
93
134
  )
94
135
  ),
136
+ authorization: String,
137
+ connector_id: OpenAI::Responses::Tool::Mcp::ConnectorID::OrSymbol,
95
138
  headers: T.nilable(T::Hash[Symbol, String]),
96
139
  require_approval:
97
140
  T.nilable(
@@ -101,16 +144,35 @@ module OpenAI
101
144
  )
102
145
  ),
103
146
  server_description: String,
147
+ server_url: String,
104
148
  type: Symbol
105
149
  ).returns(T.attached_class)
106
150
  end
107
151
  def self.new(
108
152
  # A label for this MCP server, used to identify it in tool calls.
109
153
  server_label:,
110
- # The URL for the MCP server.
111
- server_url:,
112
154
  # List of allowed tool names or a filter object.
113
155
  allowed_tools: nil,
156
+ # An OAuth access token that can be used with a remote MCP server, either with a
157
+ # custom MCP server URL or a service connector. Your application must handle the
158
+ # OAuth authorization flow and provide the token here.
159
+ authorization: nil,
160
+ # Identifier for service connectors, like those available in ChatGPT. One of
161
+ # `server_url` or `connector_id` must be provided. Learn more about service
162
+ # connectors
163
+ # [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
164
+ #
165
+ # Currently supported `connector_id` values are:
166
+ #
167
+ # - Dropbox: `connector_dropbox`
168
+ # - Gmail: `connector_gmail`
169
+ # - Google Calendar: `connector_googlecalendar`
170
+ # - Google Drive: `connector_googledrive`
171
+ # - Microsoft Teams: `connector_microsoftteams`
172
+ # - Outlook Calendar: `connector_outlookcalendar`
173
+ # - Outlook Email: `connector_outlookemail`
174
+ # - SharePoint: `connector_sharepoint`
175
+ connector_id: nil,
114
176
  # Optional HTTP headers to send to the MCP server. Use for authentication or other
115
177
  # purposes.
116
178
  headers: nil,
@@ -118,6 +180,9 @@ module OpenAI
118
180
  require_approval: nil,
119
181
  # Optional description of the MCP server, used to provide more context.
120
182
  server_description: nil,
183
+ # The URL for the MCP server. One of `server_url` or `connector_id` must be
184
+ # provided.
185
+ server_url: nil,
121
186
  # The type of the MCP tool. Always `mcp`.
122
187
  type: :mcp
123
188
  )
@@ -127,15 +192,17 @@ module OpenAI
127
192
  override.returns(
128
193
  {
129
194
  server_label: String,
130
- server_url: String,
131
195
  type: Symbol,
132
196
  allowed_tools:
133
197
  T.nilable(
134
198
  T.any(
135
199
  T::Array[String],
136
- OpenAI::Responses::Tool::Mcp::AllowedTools::McpAllowedToolsFilter
200
+ OpenAI::Responses::Tool::Mcp::AllowedTools::McpToolFilter
137
201
  )
138
202
  ),
203
+ authorization: String,
204
+ connector_id:
205
+ OpenAI::Responses::Tool::Mcp::ConnectorID::OrSymbol,
139
206
  headers: T.nilable(T::Hash[Symbol, String]),
140
207
  require_approval:
141
208
  T.nilable(
@@ -144,7 +211,8 @@ module OpenAI
144
211
  OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalSetting::OrSymbol
145
212
  )
146
213
  ),
147
- server_description: String
214
+ server_description: String,
215
+ server_url: String
148
216
  }
149
217
  )
150
218
  end
@@ -159,19 +227,29 @@ module OpenAI
159
227
  T.type_alias do
160
228
  T.any(
161
229
  T::Array[String],
162
- OpenAI::Responses::Tool::Mcp::AllowedTools::McpAllowedToolsFilter
230
+ OpenAI::Responses::Tool::Mcp::AllowedTools::McpToolFilter
163
231
  )
164
232
  end
165
233
 
166
- class McpAllowedToolsFilter < OpenAI::Internal::Type::BaseModel
234
+ class McpToolFilter < OpenAI::Internal::Type::BaseModel
167
235
  OrHash =
168
236
  T.type_alias do
169
237
  T.any(
170
- OpenAI::Responses::Tool::Mcp::AllowedTools::McpAllowedToolsFilter,
238
+ OpenAI::Responses::Tool::Mcp::AllowedTools::McpToolFilter,
171
239
  OpenAI::Internal::AnyHash
172
240
  )
173
241
  end
174
242
 
243
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
244
+ # is
245
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
246
+ # it will match this filter.
247
+ sig { returns(T.nilable(T::Boolean)) }
248
+ attr_reader :read_only
249
+
250
+ sig { params(read_only: T::Boolean).void }
251
+ attr_writer :read_only
252
+
175
253
  # List of allowed tool names.
176
254
  sig { returns(T.nilable(T::Array[String])) }
177
255
  attr_reader :tool_names
@@ -181,15 +259,27 @@ module OpenAI
181
259
 
182
260
  # A filter object to specify which tools are allowed.
183
261
  sig do
184
- params(tool_names: T::Array[String]).returns(T.attached_class)
262
+ params(
263
+ read_only: T::Boolean,
264
+ tool_names: T::Array[String]
265
+ ).returns(T.attached_class)
185
266
  end
186
267
  def self.new(
268
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
269
+ # is
270
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
271
+ # it will match this filter.
272
+ read_only: nil,
187
273
  # List of allowed tool names.
188
274
  tool_names: nil
189
275
  )
190
276
  end
191
277
 
192
- sig { override.returns({ tool_names: T::Array[String] }) }
278
+ sig do
279
+ override.returns(
280
+ { read_only: T::Boolean, tool_names: T::Array[String] }
281
+ )
282
+ end
193
283
  def to_hash
194
284
  end
195
285
  end
@@ -209,6 +299,82 @@ module OpenAI
209
299
  )
210
300
  end
211
301
 
302
+ # Identifier for service connectors, like those available in ChatGPT. One of
303
+ # `server_url` or `connector_id` must be provided. Learn more about service
304
+ # connectors
305
+ # [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
306
+ #
307
+ # Currently supported `connector_id` values are:
308
+ #
309
+ # - Dropbox: `connector_dropbox`
310
+ # - Gmail: `connector_gmail`
311
+ # - Google Calendar: `connector_googlecalendar`
312
+ # - Google Drive: `connector_googledrive`
313
+ # - Microsoft Teams: `connector_microsoftteams`
314
+ # - Outlook Calendar: `connector_outlookcalendar`
315
+ # - Outlook Email: `connector_outlookemail`
316
+ # - SharePoint: `connector_sharepoint`
317
+ module ConnectorID
318
+ extend OpenAI::Internal::Type::Enum
319
+
320
+ TaggedSymbol =
321
+ T.type_alias do
322
+ T.all(Symbol, OpenAI::Responses::Tool::Mcp::ConnectorID)
323
+ end
324
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
325
+
326
+ CONNECTOR_DROPBOX =
327
+ T.let(
328
+ :connector_dropbox,
329
+ OpenAI::Responses::Tool::Mcp::ConnectorID::TaggedSymbol
330
+ )
331
+ CONNECTOR_GMAIL =
332
+ T.let(
333
+ :connector_gmail,
334
+ OpenAI::Responses::Tool::Mcp::ConnectorID::TaggedSymbol
335
+ )
336
+ CONNECTOR_GOOGLECALENDAR =
337
+ T.let(
338
+ :connector_googlecalendar,
339
+ OpenAI::Responses::Tool::Mcp::ConnectorID::TaggedSymbol
340
+ )
341
+ CONNECTOR_GOOGLEDRIVE =
342
+ T.let(
343
+ :connector_googledrive,
344
+ OpenAI::Responses::Tool::Mcp::ConnectorID::TaggedSymbol
345
+ )
346
+ CONNECTOR_MICROSOFTTEAMS =
347
+ T.let(
348
+ :connector_microsoftteams,
349
+ OpenAI::Responses::Tool::Mcp::ConnectorID::TaggedSymbol
350
+ )
351
+ CONNECTOR_OUTLOOKCALENDAR =
352
+ T.let(
353
+ :connector_outlookcalendar,
354
+ OpenAI::Responses::Tool::Mcp::ConnectorID::TaggedSymbol
355
+ )
356
+ CONNECTOR_OUTLOOKEMAIL =
357
+ T.let(
358
+ :connector_outlookemail,
359
+ OpenAI::Responses::Tool::Mcp::ConnectorID::TaggedSymbol
360
+ )
361
+ CONNECTOR_SHAREPOINT =
362
+ T.let(
363
+ :connector_sharepoint,
364
+ OpenAI::Responses::Tool::Mcp::ConnectorID::TaggedSymbol
365
+ )
366
+
367
+ sig do
368
+ override.returns(
369
+ T::Array[
370
+ OpenAI::Responses::Tool::Mcp::ConnectorID::TaggedSymbol
371
+ ]
372
+ )
373
+ end
374
+ def self.values
375
+ end
376
+ end
377
+
212
378
  # Specify which of the MCP server's tools require approval.
213
379
  module RequireApproval
214
380
  extend OpenAI::Internal::Type::Union
@@ -230,7 +396,7 @@ module OpenAI
230
396
  )
231
397
  end
232
398
 
233
- # A list of tools that always require approval.
399
+ # A filter object to specify which tools are allowed.
234
400
  sig do
235
401
  returns(
236
402
  T.nilable(
@@ -248,7 +414,7 @@ module OpenAI
248
414
  end
249
415
  attr_writer :always
250
416
 
251
- # A list of tools that never require approval.
417
+ # A filter object to specify which tools are allowed.
252
418
  sig do
253
419
  returns(
254
420
  T.nilable(
@@ -266,6 +432,8 @@ module OpenAI
266
432
  end
267
433
  attr_writer :never
268
434
 
435
+ # Specify which of the MCP server's tools require approval. Can be `always`,
436
+ # `never`, or a filter object associated with tools that require approval.
269
437
  sig do
270
438
  params(
271
439
  always:
@@ -275,9 +443,9 @@ module OpenAI
275
443
  ).returns(T.attached_class)
276
444
  end
277
445
  def self.new(
278
- # A list of tools that always require approval.
446
+ # A filter object to specify which tools are allowed.
279
447
  always: nil,
280
- # A list of tools that never require approval.
448
+ # A filter object to specify which tools are allowed.
281
449
  never: nil
282
450
  )
283
451
  end
@@ -304,24 +472,46 @@ module OpenAI
304
472
  )
305
473
  end
306
474
 
307
- # List of tools that require approval.
475
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
476
+ # is
477
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
478
+ # it will match this filter.
479
+ sig { returns(T.nilable(T::Boolean)) }
480
+ attr_reader :read_only
481
+
482
+ sig { params(read_only: T::Boolean).void }
483
+ attr_writer :read_only
484
+
485
+ # List of allowed tool names.
308
486
  sig { returns(T.nilable(T::Array[String])) }
309
487
  attr_reader :tool_names
310
488
 
311
489
  sig { params(tool_names: T::Array[String]).void }
312
490
  attr_writer :tool_names
313
491
 
314
- # A list of tools that always require approval.
492
+ # A filter object to specify which tools are allowed.
315
493
  sig do
316
- params(tool_names: T::Array[String]).returns(T.attached_class)
494
+ params(
495
+ read_only: T::Boolean,
496
+ tool_names: T::Array[String]
497
+ ).returns(T.attached_class)
317
498
  end
318
499
  def self.new(
319
- # List of tools that require approval.
500
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
501
+ # is
502
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
503
+ # it will match this filter.
504
+ read_only: nil,
505
+ # List of allowed tool names.
320
506
  tool_names: nil
321
507
  )
322
508
  end
323
509
 
324
- sig { override.returns({ tool_names: T::Array[String] }) }
510
+ sig do
511
+ override.returns(
512
+ { read_only: T::Boolean, tool_names: T::Array[String] }
513
+ )
514
+ end
325
515
  def to_hash
326
516
  end
327
517
  end
@@ -335,24 +525,46 @@ module OpenAI
335
525
  )
336
526
  end
337
527
 
338
- # List of tools that do not require approval.
528
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
529
+ # is
530
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
531
+ # it will match this filter.
532
+ sig { returns(T.nilable(T::Boolean)) }
533
+ attr_reader :read_only
534
+
535
+ sig { params(read_only: T::Boolean).void }
536
+ attr_writer :read_only
537
+
538
+ # List of allowed tool names.
339
539
  sig { returns(T.nilable(T::Array[String])) }
340
540
  attr_reader :tool_names
341
541
 
342
542
  sig { params(tool_names: T::Array[String]).void }
343
543
  attr_writer :tool_names
344
544
 
345
- # A list of tools that never require approval.
545
+ # A filter object to specify which tools are allowed.
346
546
  sig do
347
- params(tool_names: T::Array[String]).returns(T.attached_class)
547
+ params(
548
+ read_only: T::Boolean,
549
+ tool_names: T::Array[String]
550
+ ).returns(T.attached_class)
348
551
  end
349
552
  def self.new(
350
- # List of tools that do not require approval.
553
+ # Indicates whether or not a tool modifies data or is read-only. If an MCP server
554
+ # is
555
+ # [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
556
+ # it will match this filter.
557
+ read_only: nil,
558
+ # List of allowed tool names.
351
559
  tool_names: nil
352
560
  )
353
561
  end
354
562
 
355
- sig { override.returns({ tool_names: T::Array[String] }) }
563
+ sig do
564
+ override.returns(
565
+ { read_only: T::Boolean, tool_names: T::Array[String] }
566
+ )
567
+ end
356
568
  def to_hash
357
569
  end
358
570
  end
@@ -53,6 +53,8 @@ module OpenAI
53
53
 
54
54
  Containers = OpenAI::Models::Containers
55
55
 
56
+ Conversations = OpenAI::Models::Conversations
57
+
56
58
  CreateEmbeddingResponse = OpenAI::Models::CreateEmbeddingResponse
57
59
 
58
60
  CustomToolInputFormat = OpenAI::Models::CustomToolInputFormat
@@ -0,0 +1,152 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Resources
5
+ class Conversations
6
+ class Items
7
+ # Create items in a conversation with the given ID.
8
+ sig do
9
+ params(
10
+ conversation_id: String,
11
+ items:
12
+ T::Array[
13
+ T.any(
14
+ OpenAI::Responses::EasyInputMessage::OrHash,
15
+ OpenAI::Responses::ResponseInputItem::Message::OrHash,
16
+ OpenAI::Responses::ResponseOutputMessage::OrHash,
17
+ OpenAI::Responses::ResponseFileSearchToolCall::OrHash,
18
+ OpenAI::Responses::ResponseComputerToolCall::OrHash,
19
+ OpenAI::Responses::ResponseInputItem::ComputerCallOutput::OrHash,
20
+ OpenAI::Responses::ResponseFunctionWebSearch::OrHash,
21
+ OpenAI::Responses::ResponseFunctionToolCall::OrHash,
22
+ OpenAI::Responses::ResponseInputItem::FunctionCallOutput::OrHash,
23
+ OpenAI::Responses::ResponseReasoningItem::OrHash,
24
+ OpenAI::Responses::ResponseInputItem::ImageGenerationCall::OrHash,
25
+ OpenAI::Responses::ResponseCodeInterpreterToolCall::OrHash,
26
+ OpenAI::Responses::ResponseInputItem::LocalShellCall::OrHash,
27
+ OpenAI::Responses::ResponseInputItem::LocalShellCallOutput::OrHash,
28
+ OpenAI::Responses::ResponseInputItem::McpListTools::OrHash,
29
+ OpenAI::Responses::ResponseInputItem::McpApprovalRequest::OrHash,
30
+ OpenAI::Responses::ResponseInputItem::McpApprovalResponse::OrHash,
31
+ OpenAI::Responses::ResponseInputItem::McpCall::OrHash,
32
+ OpenAI::Responses::ResponseCustomToolCallOutput::OrHash,
33
+ OpenAI::Responses::ResponseCustomToolCall::OrHash,
34
+ OpenAI::Responses::ResponseInputItem::ItemReference::OrHash
35
+ )
36
+ ],
37
+ include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
38
+ request_options: OpenAI::RequestOptions::OrHash
39
+ ).returns(OpenAI::Conversations::ConversationItemList)
40
+ end
41
+ def create(
42
+ # Path param: The ID of the conversation to add the item to.
43
+ conversation_id,
44
+ # Body param: The items to add to the conversation. You may add up to 20 items at
45
+ # a time.
46
+ items:,
47
+ # Query param: Additional fields to include in the response. See the `include`
48
+ # parameter for
49
+ # [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
50
+ # for more information.
51
+ include: nil,
52
+ request_options: {}
53
+ )
54
+ end
55
+
56
+ # Get a single item from a conversation with the given IDs.
57
+ sig do
58
+ params(
59
+ item_id: String,
60
+ conversation_id: String,
61
+ include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
62
+ request_options: OpenAI::RequestOptions::OrHash
63
+ ).returns(OpenAI::Conversations::ConversationItem::Variants)
64
+ end
65
+ def retrieve(
66
+ # Path param: The ID of the item to retrieve.
67
+ item_id,
68
+ # Path param: The ID of the conversation that contains the item.
69
+ conversation_id:,
70
+ # Query param: Additional fields to include in the response. See the `include`
71
+ # parameter for
72
+ # [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
73
+ # for more information.
74
+ include: nil,
75
+ request_options: {}
76
+ )
77
+ end
78
+
79
+ # List all items for a conversation with the given ID.
80
+ sig do
81
+ params(
82
+ conversation_id: String,
83
+ after: String,
84
+ include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
85
+ limit: Integer,
86
+ order: OpenAI::Conversations::ItemListParams::Order::OrSymbol,
87
+ request_options: OpenAI::RequestOptions::OrHash
88
+ ).returns(
89
+ OpenAI::Internal::ConversationCursorPage[
90
+ OpenAI::Conversations::ConversationItem::Variants
91
+ ]
92
+ )
93
+ end
94
+ def list(
95
+ # The ID of the conversation to list items for.
96
+ conversation_id,
97
+ # An item ID to list items after, used in pagination.
98
+ after: nil,
99
+ # Specify additional output data to include in the model response. Currently
100
+ # supported values are:
101
+ #
102
+ # - `code_interpreter_call.outputs`: Includes the outputs of python code execution
103
+ # in code interpreter tool call items.
104
+ # - `computer_call_output.output.image_url`: Include image urls from the computer
105
+ # call output.
106
+ # - `file_search_call.results`: Include the search results of the file search tool
107
+ # call.
108
+ # - `message.input_image.image_url`: Include image urls from the input message.
109
+ # - `message.output_text.logprobs`: Include logprobs with assistant messages.
110
+ # - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
111
+ # tokens in reasoning item outputs. This enables reasoning items to be used in
112
+ # multi-turn conversations when using the Responses API statelessly (like when
113
+ # the `store` parameter is set to `false`, or when an organization is enrolled
114
+ # in the zero data retention program).
115
+ include: nil,
116
+ # A limit on the number of objects to be returned. Limit can range between 1 and
117
+ # 100, and the default is 20.
118
+ limit: nil,
119
+ # The order to return the input items in. Default is `desc`.
120
+ #
121
+ # - `asc`: Return the input items in ascending order.
122
+ # - `desc`: Return the input items in descending order.
123
+ order: nil,
124
+ request_options: {}
125
+ )
126
+ end
127
+
128
+ # Delete an item from a conversation with the given IDs.
129
+ sig do
130
+ params(
131
+ item_id: String,
132
+ conversation_id: String,
133
+ request_options: OpenAI::RequestOptions::OrHash
134
+ ).returns(OpenAI::Conversations::Conversation)
135
+ end
136
+ def delete(
137
+ # The ID of the item to delete.
138
+ item_id,
139
+ # The ID of the conversation that contains the item.
140
+ conversation_id:,
141
+ request_options: {}
142
+ )
143
+ end
144
+
145
+ # @api private
146
+ sig { params(client: OpenAI::Client).returns(T.attached_class) }
147
+ def self.new(client:)
148
+ end
149
+ end
150
+ end
151
+ end
152
+ end