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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/README.md +1 -1
- data/lib/openai/client.rb +4 -0
- data/lib/openai/helpers/structured_output/array_of.rb +2 -10
- data/lib/openai/helpers/structured_output/base_model.rb +4 -11
- data/lib/openai/helpers/structured_output/boolean.rb +1 -0
- data/lib/openai/helpers/structured_output/json_schema_converter.rb +19 -3
- data/lib/openai/helpers/structured_output/union_of.rb +2 -10
- data/lib/openai/internal/conversation_cursor_page.rb +92 -0
- data/lib/openai/internal/transport/base_client.rb +1 -4
- data/lib/openai/internal/transport/pooled_net_requester.rb +1 -9
- data/lib/openai/internal/util.rb +1 -1
- data/lib/openai/models/audio/transcription.rb +1 -4
- data/lib/openai/models/audio/transcription_create_params.rb +2 -7
- data/lib/openai/models/audio/transcription_text_done_event.rb +1 -4
- data/lib/openai/models/batch_create_params.rb +38 -1
- data/lib/openai/models/beta/assistant_create_params.rb +6 -19
- data/lib/openai/models/beta/assistant_stream_event.rb +6 -24
- data/lib/openai/models/beta/assistant_update_params.rb +1 -4
- data/lib/openai/models/beta/message_stream_event.rb +1 -4
- data/lib/openai/models/beta/run_step_stream_event.rb +1 -4
- data/lib/openai/models/beta/thread_create_and_run_params.rb +12 -34
- data/lib/openai/models/beta/thread_create_params.rb +7 -22
- data/lib/openai/models/beta/threads/message.rb +3 -10
- data/lib/openai/models/beta/threads/message_create_params.rb +2 -7
- data/lib/openai/models/beta/threads/run.rb +4 -9
- data/lib/openai/models/beta/threads/run_create_params.rb +5 -12
- data/lib/openai/models/beta/threads/run_submit_tool_outputs_params.rb +1 -3
- data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call.rb +5 -17
- data/lib/openai/models/beta/threads/runs/code_interpreter_tool_call_delta.rb +1 -3
- data/lib/openai/models/beta/threads/runs/file_search_tool_call.rb +4 -12
- data/lib/openai/models/beta/threads/runs/run_step_delta_message_delta.rb +1 -4
- data/lib/openai/models/beta/threads/runs/tool_calls_step_details.rb +1 -4
- data/lib/openai/models/beta/threads/text.rb +1 -4
- data/lib/openai/models/chat/chat_completion.rb +6 -6
- data/lib/openai/models/chat/chat_completion_chunk.rb +7 -9
- data/lib/openai/models/chat/chat_completion_custom_tool.rb +2 -7
- data/lib/openai/models/chat/completion_create_params.rb +7 -7
- data/lib/openai/models/conversations/computer_screenshot_content.rb +38 -0
- data/lib/openai/models/conversations/container_file_citation_body.rb +58 -0
- data/lib/openai/models/conversations/conversation.rb +51 -0
- data/lib/openai/models/conversations/conversation_create_params.rb +39 -0
- data/lib/openai/models/conversations/conversation_delete_params.rb +16 -0
- data/lib/openai/models/conversations/conversation_deleted.rb +29 -0
- data/lib/openai/models/conversations/conversation_deleted_resource.rb +30 -0
- data/lib/openai/models/conversations/conversation_item.rb +568 -0
- data/lib/openai/models/conversations/conversation_item_list.rb +55 -0
- data/lib/openai/models/conversations/conversation_retrieve_params.rb +16 -0
- data/lib/openai/models/conversations/conversation_update_params.rb +31 -0
- data/lib/openai/models/conversations/file_citation_body.rb +42 -0
- data/lib/openai/models/conversations/input_file_content.rb +42 -0
- data/lib/openai/models/conversations/input_image_content.rb +62 -0
- data/lib/openai/models/conversations/input_text_content.rb +26 -0
- data/lib/openai/models/conversations/item_create_params.rb +37 -0
- data/lib/openai/models/conversations/item_delete_params.rb +22 -0
- data/lib/openai/models/conversations/item_list_params.rb +84 -0
- data/lib/openai/models/conversations/item_retrieve_params.rb +36 -0
- data/lib/openai/models/conversations/lob_prob.rb +35 -0
- data/lib/openai/models/conversations/message.rb +115 -0
- data/lib/openai/models/conversations/output_text_content.rb +57 -0
- data/lib/openai/models/conversations/refusal_content.rb +26 -0
- data/lib/openai/models/conversations/summary_text_content.rb +23 -0
- data/lib/openai/models/conversations/text_content.rb +23 -0
- data/lib/openai/models/conversations/top_log_prob.rb +29 -0
- data/lib/openai/models/conversations/url_citation_body.rb +50 -0
- data/lib/openai/models/eval_create_params.rb +6 -20
- data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +29 -53
- data/lib/openai/models/evals/create_eval_jsonl_run_data_source.rb +1 -3
- data/lib/openai/models/evals/run_create_params.rb +18 -54
- data/lib/openai/models/file_create_params.rb +37 -1
- data/lib/openai/models/fine_tuning/reinforcement_hyperparameters.rb +1 -4
- data/lib/openai/models/graders/text_similarity_grader.rb +6 -5
- data/lib/openai/models/moderation.rb +5 -15
- data/lib/openai/models/reasoning.rb +1 -1
- data/lib/openai/models/responses/input_item_list_params.rb +1 -9
- data/lib/openai/models/responses/response.rb +32 -9
- data/lib/openai/models/responses/response_computer_tool_call.rb +2 -6
- data/lib/openai/models/responses/response_computer_tool_call_output_item.rb +1 -3
- data/lib/openai/models/responses/response_conversation_param.rb +20 -0
- data/lib/openai/models/responses/response_create_params.rb +40 -9
- data/lib/openai/models/responses/response_input_item.rb +2 -7
- data/lib/openai/models/responses/response_input_message_item.rb +1 -4
- data/lib/openai/models/responses/response_output_item.rb +1 -3
- data/lib/openai/models/responses/response_output_message.rb +1 -3
- data/lib/openai/models/responses/response_output_text.rb +3 -10
- data/lib/openai/models/responses/response_stream_event.rb +4 -16
- data/lib/openai/models/responses/response_text_delta_event.rb +1 -3
- data/lib/openai/models/responses/response_text_done_event.rb +1 -3
- data/lib/openai/models/responses/tool.rb +145 -34
- data/lib/openai/models/upload_create_params.rb +37 -1
- data/lib/openai/models.rb +2 -0
- data/lib/openai/resources/batches.rb +3 -1
- data/lib/openai/resources/conversations/items.rb +141 -0
- data/lib/openai/resources/conversations.rb +112 -0
- data/lib/openai/resources/files.rb +4 -2
- data/lib/openai/resources/responses/input_items.rb +1 -3
- data/lib/openai/resources/responses.rb +8 -4
- data/lib/openai/resources/uploads.rb +3 -1
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +31 -0
- data/rbi/openai/client.rbi +3 -0
- data/rbi/openai/errors.rbi +5 -5
- data/rbi/openai/helpers/structured_output/array_of.rbi +0 -3
- data/rbi/openai/helpers/structured_output/json_schema_converter.rbi +10 -0
- data/rbi/openai/internal/conversation_cursor_page.rbi +25 -0
- data/rbi/openai/models/batch_create_params.rbi +60 -0
- data/rbi/openai/models/beta/thread_create_and_run_params.rbi +3 -3
- data/rbi/openai/models/beta/threads/run.rbi +3 -3
- data/rbi/openai/models/beta/threads/run_create_params.rbi +3 -3
- data/rbi/openai/models/chat/chat_completion.rbi +6 -9
- data/rbi/openai/models/chat/chat_completion_chunk.rbi +6 -9
- data/rbi/openai/models/chat/completion_create_params.rbi +8 -11
- data/rbi/openai/models/conversations/computer_screenshot_content.rbi +60 -0
- data/rbi/openai/models/conversations/container_file_citation_body.rbi +82 -0
- data/rbi/openai/models/conversations/conversation.rbi +76 -0
- data/rbi/openai/models/conversations/conversation_create_params.rbi +144 -0
- data/rbi/openai/models/conversations/conversation_delete_params.rbi +32 -0
- data/rbi/openai/models/conversations/conversation_deleted.rbi +40 -0
- data/rbi/openai/models/conversations/conversation_deleted_resource.rbi +40 -0
- data/rbi/openai/models/conversations/conversation_item.rbi +835 -0
- data/rbi/openai/models/conversations/conversation_item_list.rbi +101 -0
- data/rbi/openai/models/conversations/conversation_retrieve_params.rbi +32 -0
- data/rbi/openai/models/conversations/conversation_update_params.rbi +56 -0
- data/rbi/openai/models/conversations/file_citation_body.rbi +61 -0
- data/rbi/openai/models/conversations/input_file_content.rbi +72 -0
- data/rbi/openai/models/conversations/input_image_content.rbi +113 -0
- data/rbi/openai/models/conversations/input_text_content.rbi +38 -0
- data/rbi/openai/models/conversations/item_create_params.rbi +150 -0
- data/rbi/openai/models/conversations/item_delete_params.rbi +40 -0
- data/rbi/openai/models/conversations/item_list_params.rbi +174 -0
- data/rbi/openai/models/conversations/item_retrieve_params.rbi +70 -0
- data/rbi/openai/models/conversations/lob_prob.rbi +50 -0
- data/rbi/openai/models/conversations/message.rbi +196 -0
- data/rbi/openai/models/conversations/output_text_content.rbi +110 -0
- data/rbi/openai/models/conversations/refusal_content.rbi +38 -0
- data/rbi/openai/models/conversations/summary_text_content.rbi +31 -0
- data/rbi/openai/models/conversations/text_content.rbi +28 -0
- data/rbi/openai/models/conversations/top_log_prob.rbi +41 -0
- data/rbi/openai/models/conversations/url_citation_body.rbi +74 -0
- data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +33 -33
- data/rbi/openai/models/file_create_params.rbi +56 -0
- data/rbi/openai/models/graders/text_similarity_grader.rbi +11 -6
- data/rbi/openai/models/reasoning.rbi +1 -1
- data/rbi/openai/models/responses/input_item_list_params.rbi +0 -11
- data/rbi/openai/models/responses/response.rbi +57 -11
- data/rbi/openai/models/responses/response_conversation_param.rbi +33 -0
- data/rbi/openai/models/responses/response_create_params.rbi +62 -11
- data/rbi/openai/models/responses/tool.rbi +243 -31
- data/rbi/openai/models/upload_create_params.rbi +56 -0
- data/rbi/openai/models.rbi +2 -0
- data/rbi/openai/resources/batches.rbi +5 -0
- data/rbi/openai/resources/beta/threads/runs.rbi +2 -2
- data/rbi/openai/resources/beta/threads.rbi +2 -2
- data/rbi/openai/resources/chat/completions.rbi +6 -8
- data/rbi/openai/resources/conversations/items.rbi +152 -0
- data/rbi/openai/resources/conversations.rbi +110 -0
- data/rbi/openai/resources/files.rbi +5 -1
- data/rbi/openai/resources/responses/input_items.rbi +0 -3
- data/rbi/openai/resources/responses.rbi +32 -8
- data/rbi/openai/resources/uploads.rbi +4 -0
- data/sig/openai/client.rbs +2 -0
- data/sig/openai/internal/conversation_cursor_page.rbs +15 -0
- data/sig/openai/models/batch_create_params.rbs +22 -1
- data/sig/openai/models/conversations/computer_screenshot_content.rbs +28 -0
- data/sig/openai/models/conversations/container_file_citation_body.rbs +47 -0
- data/sig/openai/models/conversations/conversation.rbs +37 -0
- data/sig/openai/models/conversations/conversation_create_params.rbs +33 -0
- data/sig/openai/models/conversations/conversation_delete_params.rbs +17 -0
- data/sig/openai/models/conversations/conversation_deleted.rbs +28 -0
- data/sig/openai/models/conversations/conversation_deleted_resource.rbs +28 -0
- data/sig/openai/models/conversations/conversation_item.rbs +403 -0
- data/sig/openai/models/conversations/conversation_item_list.rbs +44 -0
- data/sig/openai/models/conversations/conversation_retrieve_params.rbs +17 -0
- data/sig/openai/models/conversations/conversation_update_params.rbs +26 -0
- data/sig/openai/models/conversations/file_citation_body.rbs +37 -0
- data/sig/openai/models/conversations/input_file_content.rbs +41 -0
- data/sig/openai/models/conversations/input_image_content.rbs +49 -0
- data/sig/openai/models/conversations/input_text_content.rbs +17 -0
- data/sig/openai/models/conversations/item_create_params.rbs +37 -0
- data/sig/openai/models/conversations/item_delete_params.rbs +25 -0
- data/sig/openai/models/conversations/item_list_params.rbs +66 -0
- data/sig/openai/models/conversations/item_retrieve_params.rbs +37 -0
- data/sig/openai/models/conversations/lob_prob.rbs +37 -0
- data/sig/openai/models/conversations/message.rbs +95 -0
- data/sig/openai/models/conversations/output_text_content.rbs +52 -0
- data/sig/openai/models/conversations/refusal_content.rbs +17 -0
- data/sig/openai/models/conversations/summary_text_content.rbs +17 -0
- data/sig/openai/models/conversations/text_content.rbs +17 -0
- data/sig/openai/models/conversations/top_log_prob.rbs +28 -0
- data/sig/openai/models/conversations/url_citation_body.rbs +42 -0
- data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +22 -22
- data/sig/openai/models/file_create_params.rbs +22 -1
- data/sig/openai/models/graders/text_similarity_grader.rbs +3 -1
- data/sig/openai/models/responses/input_item_list_params.rbs +0 -7
- data/sig/openai/models/responses/response.rbs +15 -0
- data/sig/openai/models/responses/response_conversation_param.rbs +15 -0
- data/sig/openai/models/responses/response_create_params.rbs +14 -0
- data/sig/openai/models/responses/tool.rbs +83 -18
- data/sig/openai/models/upload_create_params.rbs +22 -1
- data/sig/openai/models.rbs +2 -0
- data/sig/openai/resources/batches.rbs +1 -0
- data/sig/openai/resources/conversations/items.rbs +38 -0
- data/sig/openai/resources/conversations.rbs +31 -0
- data/sig/openai/resources/files.rbs +1 -0
- data/sig/openai/resources/responses/input_items.rbs +0 -1
- data/sig/openai/resources/responses.rbs +2 -0
- data/sig/openai/resources/uploads.rbs +1 -0
- metadata +95 -2
@@ -47,12 +47,6 @@ module OpenAI
|
|
47
47
|
# @return [String]
|
48
48
|
required :server_label, String
|
49
49
|
|
50
|
-
# @!attribute server_url
|
51
|
-
# The URL for the MCP server.
|
52
|
-
#
|
53
|
-
# @return [String]
|
54
|
-
required :server_url, String
|
55
|
-
|
56
50
|
# @!attribute type
|
57
51
|
# The type of the MCP tool. Always `mcp`.
|
58
52
|
#
|
@@ -62,9 +56,37 @@ module OpenAI
|
|
62
56
|
# @!attribute allowed_tools
|
63
57
|
# List of allowed tool names or a filter object.
|
64
58
|
#
|
65
|
-
# @return [Array<String>, OpenAI::Models::Responses::Tool::Mcp::AllowedTools::
|
59
|
+
# @return [Array<String>, OpenAI::Models::Responses::Tool::Mcp::AllowedTools::McpToolFilter, nil]
|
66
60
|
optional :allowed_tools, union: -> { OpenAI::Responses::Tool::Mcp::AllowedTools }, nil?: true
|
67
61
|
|
62
|
+
# @!attribute authorization
|
63
|
+
# An OAuth access token that can be used with a remote MCP server, either with a
|
64
|
+
# custom MCP server URL or a service connector. Your application must handle the
|
65
|
+
# OAuth authorization flow and provide the token here.
|
66
|
+
#
|
67
|
+
# @return [String, nil]
|
68
|
+
optional :authorization, String
|
69
|
+
|
70
|
+
# @!attribute connector_id
|
71
|
+
# Identifier for service connectors, like those available in ChatGPT. One of
|
72
|
+
# `server_url` or `connector_id` must be provided. Learn more about service
|
73
|
+
# connectors
|
74
|
+
# [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
|
75
|
+
#
|
76
|
+
# Currently supported `connector_id` values are:
|
77
|
+
#
|
78
|
+
# - Dropbox: `connector_dropbox`
|
79
|
+
# - Gmail: `connector_gmail`
|
80
|
+
# - Google Calendar: `connector_googlecalendar`
|
81
|
+
# - Google Drive: `connector_googledrive`
|
82
|
+
# - Microsoft Teams: `connector_microsoftteams`
|
83
|
+
# - Outlook Calendar: `connector_outlookcalendar`
|
84
|
+
# - Outlook Email: `connector_outlookemail`
|
85
|
+
# - SharePoint: `connector_sharepoint`
|
86
|
+
#
|
87
|
+
# @return [Symbol, OpenAI::Models::Responses::Tool::Mcp::ConnectorID, nil]
|
88
|
+
optional :connector_id, enum: -> { OpenAI::Responses::Tool::Mcp::ConnectorID }
|
89
|
+
|
68
90
|
# @!attribute headers
|
69
91
|
# Optional HTTP headers to send to the MCP server. Use for authentication or other
|
70
92
|
# purposes.
|
@@ -84,7 +106,14 @@ module OpenAI
|
|
84
106
|
# @return [String, nil]
|
85
107
|
optional :server_description, String
|
86
108
|
|
87
|
-
# @!
|
109
|
+
# @!attribute server_url
|
110
|
+
# The URL for the MCP server. One of `server_url` or `connector_id` must be
|
111
|
+
# provided.
|
112
|
+
#
|
113
|
+
# @return [String, nil]
|
114
|
+
optional :server_url, String
|
115
|
+
|
116
|
+
# @!method initialize(server_label:, allowed_tools: nil, authorization: nil, connector_id: nil, headers: nil, require_approval: nil, server_description: nil, server_url: nil, type: :mcp)
|
88
117
|
# Some parameter documentations has been truncated, see
|
89
118
|
# {OpenAI::Models::Responses::Tool::Mcp} for more details.
|
90
119
|
#
|
@@ -94,9 +123,11 @@ module OpenAI
|
|
94
123
|
#
|
95
124
|
# @param server_label [String] A label for this MCP server, used to identify it in tool calls.
|
96
125
|
#
|
97
|
-
# @param
|
126
|
+
# @param allowed_tools [Array<String>, OpenAI::Models::Responses::Tool::Mcp::AllowedTools::McpToolFilter, nil] List of allowed tool names or a filter object.
|
127
|
+
#
|
128
|
+
# @param authorization [String] An OAuth access token that can be used with a remote MCP server, either
|
98
129
|
#
|
99
|
-
# @param
|
130
|
+
# @param connector_id [Symbol, OpenAI::Models::Responses::Tool::Mcp::ConnectorID] Identifier for service connectors, like those available in ChatGPT. One of
|
100
131
|
#
|
101
132
|
# @param headers [Hash{Symbol=>String}, nil] Optional HTTP headers to send to the MCP server. Use for authentication
|
102
133
|
#
|
@@ -104,6 +135,8 @@ module OpenAI
|
|
104
135
|
#
|
105
136
|
# @param server_description [String] Optional description of the MCP server, used to provide more context.
|
106
137
|
#
|
138
|
+
# @param server_url [String] The URL for the MCP server. One of `server_url` or `connector_id` must be
|
139
|
+
#
|
107
140
|
# @param type [Symbol, :mcp] The type of the MCP tool. Always `mcp`.
|
108
141
|
|
109
142
|
# List of allowed tool names or a filter object.
|
@@ -116,34 +149,85 @@ module OpenAI
|
|
116
149
|
variant -> { OpenAI::Models::Responses::Tool::Mcp::AllowedTools::StringArray }
|
117
150
|
|
118
151
|
# A filter object to specify which tools are allowed.
|
119
|
-
variant -> { OpenAI::Responses::Tool::Mcp::AllowedTools::
|
152
|
+
variant -> { OpenAI::Responses::Tool::Mcp::AllowedTools::McpToolFilter }
|
153
|
+
|
154
|
+
class McpToolFilter < OpenAI::Internal::Type::BaseModel
|
155
|
+
# @!attribute read_only
|
156
|
+
# Indicates whether or not a tool modifies data or is read-only. If an MCP server
|
157
|
+
# is
|
158
|
+
# [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
|
159
|
+
# it will match this filter.
|
160
|
+
#
|
161
|
+
# @return [Boolean, nil]
|
162
|
+
optional :read_only, OpenAI::Internal::Type::Boolean
|
120
163
|
|
121
|
-
class McpAllowedToolsFilter < OpenAI::Internal::Type::BaseModel
|
122
164
|
# @!attribute tool_names
|
123
165
|
# List of allowed tool names.
|
124
166
|
#
|
125
167
|
# @return [Array<String>, nil]
|
126
168
|
optional :tool_names, OpenAI::Internal::Type::ArrayOf[String]
|
127
169
|
|
128
|
-
# @!method initialize(tool_names: nil)
|
170
|
+
# @!method initialize(read_only: nil, tool_names: nil)
|
171
|
+
# Some parameter documentations has been truncated, see
|
172
|
+
# {OpenAI::Models::Responses::Tool::Mcp::AllowedTools::McpToolFilter} for more
|
173
|
+
# details.
|
174
|
+
#
|
129
175
|
# A filter object to specify which tools are allowed.
|
130
176
|
#
|
177
|
+
# @param read_only [Boolean] Indicates whether or not a tool modifies data or is read-only. If an
|
178
|
+
#
|
131
179
|
# @param tool_names [Array<String>] List of allowed tool names.
|
132
180
|
end
|
133
181
|
|
134
182
|
# @!method self.variants
|
135
|
-
# @return [Array(Array<String>, OpenAI::Models::Responses::Tool::Mcp::AllowedTools::
|
183
|
+
# @return [Array(Array<String>, OpenAI::Models::Responses::Tool::Mcp::AllowedTools::McpToolFilter)]
|
136
184
|
|
137
185
|
# @type [OpenAI::Internal::Type::Converter]
|
138
186
|
StringArray = OpenAI::Internal::Type::ArrayOf[String]
|
139
187
|
end
|
140
188
|
|
189
|
+
# Identifier for service connectors, like those available in ChatGPT. One of
|
190
|
+
# `server_url` or `connector_id` must be provided. Learn more about service
|
191
|
+
# connectors
|
192
|
+
# [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).
|
193
|
+
#
|
194
|
+
# Currently supported `connector_id` values are:
|
195
|
+
#
|
196
|
+
# - Dropbox: `connector_dropbox`
|
197
|
+
# - Gmail: `connector_gmail`
|
198
|
+
# - Google Calendar: `connector_googlecalendar`
|
199
|
+
# - Google Drive: `connector_googledrive`
|
200
|
+
# - Microsoft Teams: `connector_microsoftteams`
|
201
|
+
# - Outlook Calendar: `connector_outlookcalendar`
|
202
|
+
# - Outlook Email: `connector_outlookemail`
|
203
|
+
# - SharePoint: `connector_sharepoint`
|
204
|
+
#
|
205
|
+
# @see OpenAI::Models::Responses::Tool::Mcp#connector_id
|
206
|
+
module ConnectorID
|
207
|
+
extend OpenAI::Internal::Type::Enum
|
208
|
+
|
209
|
+
CONNECTOR_DROPBOX = :connector_dropbox
|
210
|
+
CONNECTOR_GMAIL = :connector_gmail
|
211
|
+
CONNECTOR_GOOGLECALENDAR = :connector_googlecalendar
|
212
|
+
CONNECTOR_GOOGLEDRIVE = :connector_googledrive
|
213
|
+
CONNECTOR_MICROSOFTTEAMS = :connector_microsoftteams
|
214
|
+
CONNECTOR_OUTLOOKCALENDAR = :connector_outlookcalendar
|
215
|
+
CONNECTOR_OUTLOOKEMAIL = :connector_outlookemail
|
216
|
+
CONNECTOR_SHAREPOINT = :connector_sharepoint
|
217
|
+
|
218
|
+
# @!method self.values
|
219
|
+
# @return [Array<Symbol>]
|
220
|
+
end
|
221
|
+
|
141
222
|
# Specify which of the MCP server's tools require approval.
|
142
223
|
#
|
143
224
|
# @see OpenAI::Models::Responses::Tool::Mcp#require_approval
|
144
225
|
module RequireApproval
|
145
226
|
extend OpenAI::Internal::Type::Union
|
146
227
|
|
228
|
+
# Specify which of the MCP server's tools require approval. Can be
|
229
|
+
# `always`, `never`, or a filter object associated with tools
|
230
|
+
# that require approval.
|
147
231
|
variant -> { OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter }
|
148
232
|
|
149
233
|
# Specify a single approval policy for all tools. One of `always` or
|
@@ -153,58 +237,85 @@ module OpenAI
|
|
153
237
|
|
154
238
|
class McpToolApprovalFilter < OpenAI::Internal::Type::BaseModel
|
155
239
|
# @!attribute always
|
156
|
-
# A
|
240
|
+
# A filter object to specify which tools are allowed.
|
157
241
|
#
|
158
242
|
# @return [OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Always, nil]
|
159
|
-
optional :always,
|
160
|
-
-> {
|
161
|
-
OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Always
|
162
|
-
}
|
243
|
+
optional :always, -> { OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Always }
|
163
244
|
|
164
245
|
# @!attribute never
|
165
|
-
# A
|
246
|
+
# A filter object to specify which tools are allowed.
|
166
247
|
#
|
167
248
|
# @return [OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Never, nil]
|
168
|
-
optional :never,
|
169
|
-
-> {
|
170
|
-
OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Never
|
171
|
-
}
|
249
|
+
optional :never, -> { OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Never }
|
172
250
|
|
173
251
|
# @!method initialize(always: nil, never: nil)
|
174
252
|
# Some parameter documentations has been truncated, see
|
175
253
|
# {OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter}
|
176
254
|
# for more details.
|
177
255
|
#
|
178
|
-
#
|
256
|
+
# Specify which of the MCP server's tools require approval. Can be `always`,
|
257
|
+
# `never`, or a filter object associated with tools that require approval.
|
258
|
+
#
|
259
|
+
# @param always [OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Always] A filter object to specify which tools are allowed.
|
179
260
|
#
|
180
|
-
# @param never [OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Never] A
|
261
|
+
# @param never [OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Never] A filter object to specify which tools are allowed.
|
181
262
|
|
182
263
|
# @see OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter#always
|
183
264
|
class Always < OpenAI::Internal::Type::BaseModel
|
265
|
+
# @!attribute read_only
|
266
|
+
# Indicates whether or not a tool modifies data or is read-only. If an MCP server
|
267
|
+
# is
|
268
|
+
# [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
|
269
|
+
# it will match this filter.
|
270
|
+
#
|
271
|
+
# @return [Boolean, nil]
|
272
|
+
optional :read_only, OpenAI::Internal::Type::Boolean
|
273
|
+
|
184
274
|
# @!attribute tool_names
|
185
|
-
# List of
|
275
|
+
# List of allowed tool names.
|
186
276
|
#
|
187
277
|
# @return [Array<String>, nil]
|
188
278
|
optional :tool_names, OpenAI::Internal::Type::ArrayOf[String]
|
189
279
|
|
190
|
-
# @!method initialize(tool_names: nil)
|
191
|
-
#
|
280
|
+
# @!method initialize(read_only: nil, tool_names: nil)
|
281
|
+
# Some parameter documentations has been truncated, see
|
282
|
+
# {OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Always}
|
283
|
+
# for more details.
|
284
|
+
#
|
285
|
+
# A filter object to specify which tools are allowed.
|
192
286
|
#
|
193
|
-
# @param
|
287
|
+
# @param read_only [Boolean] Indicates whether or not a tool modifies data or is read-only. If an
|
288
|
+
#
|
289
|
+
# @param tool_names [Array<String>] List of allowed tool names.
|
194
290
|
end
|
195
291
|
|
196
292
|
# @see OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter#never
|
197
293
|
class Never < OpenAI::Internal::Type::BaseModel
|
294
|
+
# @!attribute read_only
|
295
|
+
# Indicates whether or not a tool modifies data or is read-only. If an MCP server
|
296
|
+
# is
|
297
|
+
# [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),
|
298
|
+
# it will match this filter.
|
299
|
+
#
|
300
|
+
# @return [Boolean, nil]
|
301
|
+
optional :read_only, OpenAI::Internal::Type::Boolean
|
302
|
+
|
198
303
|
# @!attribute tool_names
|
199
|
-
# List of
|
304
|
+
# List of allowed tool names.
|
200
305
|
#
|
201
306
|
# @return [Array<String>, nil]
|
202
307
|
optional :tool_names, OpenAI::Internal::Type::ArrayOf[String]
|
203
308
|
|
204
|
-
# @!method initialize(tool_names: nil)
|
205
|
-
#
|
309
|
+
# @!method initialize(read_only: nil, tool_names: nil)
|
310
|
+
# Some parameter documentations has been truncated, see
|
311
|
+
# {OpenAI::Models::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter::Never}
|
312
|
+
# for more details.
|
313
|
+
#
|
314
|
+
# A filter object to specify which tools are allowed.
|
315
|
+
#
|
316
|
+
# @param read_only [Boolean] Indicates whether or not a tool modifies data or is read-only. If an
|
206
317
|
#
|
207
|
-
# @param tool_names [Array<String>] List of
|
318
|
+
# @param tool_names [Array<String>] List of allowed tool names.
|
208
319
|
end
|
209
320
|
end
|
210
321
|
|
@@ -37,7 +37,14 @@ module OpenAI
|
|
37
37
|
# @return [Symbol, OpenAI::Models::FilePurpose]
|
38
38
|
required :purpose, enum: -> { OpenAI::FilePurpose }
|
39
39
|
|
40
|
-
# @!
|
40
|
+
# @!attribute expires_after
|
41
|
+
# The expiration policy for a file. By default, files with `purpose=batch` expire
|
42
|
+
# after 30 days and all other files are persisted until they are manually deleted.
|
43
|
+
#
|
44
|
+
# @return [OpenAI::Models::UploadCreateParams::ExpiresAfter, nil]
|
45
|
+
optional :expires_after, -> { OpenAI::UploadCreateParams::ExpiresAfter }
|
46
|
+
|
47
|
+
# @!method initialize(bytes:, filename:, mime_type:, purpose:, expires_after: nil, request_options: {})
|
41
48
|
# Some parameter documentations has been truncated, see
|
42
49
|
# {OpenAI::Models::UploadCreateParams} for more details.
|
43
50
|
#
|
@@ -49,7 +56,36 @@ module OpenAI
|
|
49
56
|
#
|
50
57
|
# @param purpose [Symbol, OpenAI::Models::FilePurpose] The intended purpose of the uploaded file.
|
51
58
|
#
|
59
|
+
# @param expires_after [OpenAI::Models::UploadCreateParams::ExpiresAfter] The expiration policy for a file. By default, files with `purpose=batch` expire
|
60
|
+
#
|
52
61
|
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
|
62
|
+
|
63
|
+
class ExpiresAfter < OpenAI::Internal::Type::BaseModel
|
64
|
+
# @!attribute anchor
|
65
|
+
# Anchor timestamp after which the expiration policy applies. Supported anchors:
|
66
|
+
# `created_at`.
|
67
|
+
#
|
68
|
+
# @return [Symbol, :created_at]
|
69
|
+
required :anchor, const: :created_at
|
70
|
+
|
71
|
+
# @!attribute seconds
|
72
|
+
# The number of seconds after the anchor time that the file will expire. Must be
|
73
|
+
# between 3600 (1 hour) and 2592000 (30 days).
|
74
|
+
#
|
75
|
+
# @return [Integer]
|
76
|
+
required :seconds, Integer
|
77
|
+
|
78
|
+
# @!method initialize(seconds:, anchor: :created_at)
|
79
|
+
# Some parameter documentations has been truncated, see
|
80
|
+
# {OpenAI::Models::UploadCreateParams::ExpiresAfter} for more details.
|
81
|
+
#
|
82
|
+
# The expiration policy for a file. By default, files with `purpose=batch` expire
|
83
|
+
# after 30 days and all other files are persisted until they are manually deleted.
|
84
|
+
#
|
85
|
+
# @param seconds [Integer] The number of seconds after the anchor time that the file will expire. Must be b
|
86
|
+
#
|
87
|
+
# @param anchor [Symbol, :created_at] Anchor timestamp after which the expiration policy applies. Supported anchors: `
|
88
|
+
end
|
53
89
|
end
|
54
90
|
end
|
55
91
|
end
|
data/lib/openai/models.rb
CHANGED
@@ -8,7 +8,7 @@ module OpenAI
|
|
8
8
|
#
|
9
9
|
# Creates and executes a batch from an uploaded file of requests
|
10
10
|
#
|
11
|
-
# @overload create(completion_window:, endpoint:, input_file_id:, metadata: nil, request_options: {})
|
11
|
+
# @overload create(completion_window:, endpoint:, input_file_id:, metadata: nil, output_expires_after: nil, request_options: {})
|
12
12
|
#
|
13
13
|
# @param completion_window [Symbol, OpenAI::Models::BatchCreateParams::CompletionWindow] The time frame within which the batch should be processed. Currently only `24h`
|
14
14
|
#
|
@@ -18,6 +18,8 @@ module OpenAI
|
|
18
18
|
#
|
19
19
|
# @param metadata [Hash{Symbol=>String}, nil] Set of 16 key-value pairs that can be attached to an object. This can be
|
20
20
|
#
|
21
|
+
# @param output_expires_after [OpenAI::Models::BatchCreateParams::OutputExpiresAfter] The expiration policy for the output and/or error file that are generated for a
|
22
|
+
#
|
21
23
|
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
22
24
|
#
|
23
25
|
# @return [OpenAI::Models::Batch]
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Resources
|
5
|
+
class Conversations
|
6
|
+
class Items
|
7
|
+
# Some parameter documentations has been truncated, see
|
8
|
+
# {OpenAI::Models::Conversations::ItemCreateParams} for more details.
|
9
|
+
#
|
10
|
+
# Create items in a conversation with the given ID.
|
11
|
+
#
|
12
|
+
# @overload create(conversation_id, items:, include: nil, request_options: {})
|
13
|
+
#
|
14
|
+
# @param conversation_id [String] Path param: The ID of the conversation to add the item to.
|
15
|
+
#
|
16
|
+
# @param items [Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::ItemReference>] Body param: The items to add to the conversation. You may add up to 20 items at
|
17
|
+
#
|
18
|
+
# @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>] Query param: Additional fields to include in the response. See the `include`
|
19
|
+
#
|
20
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
21
|
+
#
|
22
|
+
# @return [OpenAI::Models::Conversations::ConversationItemList]
|
23
|
+
#
|
24
|
+
# @see OpenAI::Models::Conversations::ItemCreateParams
|
25
|
+
def create(conversation_id, params)
|
26
|
+
parsed, options = OpenAI::Conversations::ItemCreateParams.dump_request(params)
|
27
|
+
query_params = [:include]
|
28
|
+
@client.request(
|
29
|
+
method: :post,
|
30
|
+
path: ["conversations/%1$s/items", conversation_id],
|
31
|
+
query: parsed.slice(*query_params),
|
32
|
+
body: parsed.except(*query_params),
|
33
|
+
model: OpenAI::Conversations::ConversationItemList,
|
34
|
+
options: options
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Some parameter documentations has been truncated, see
|
39
|
+
# {OpenAI::Models::Conversations::ItemRetrieveParams} for more details.
|
40
|
+
#
|
41
|
+
# Get a single item from a conversation with the given IDs.
|
42
|
+
#
|
43
|
+
# @overload retrieve(item_id, conversation_id:, include: nil, request_options: {})
|
44
|
+
#
|
45
|
+
# @param item_id [String] Path param: The ID of the item to retrieve.
|
46
|
+
#
|
47
|
+
# @param conversation_id [String] Path param: The ID of the conversation that contains the item.
|
48
|
+
#
|
49
|
+
# @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>] Query param: Additional fields to include in the response. See the `include`
|
50
|
+
#
|
51
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
52
|
+
#
|
53
|
+
# @return [OpenAI::Models::Conversations::Message, OpenAI::Models::Responses::ResponseFunctionToolCallItem, OpenAI::Models::Responses::ResponseFunctionToolCallOutputItem, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseComputerToolCallOutputItem, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Conversations::ConversationItem::LocalShellCall, OpenAI::Models::Conversations::ConversationItem::LocalShellCallOutput, OpenAI::Models::Conversations::ConversationItem::McpListTools, OpenAI::Models::Conversations::ConversationItem::McpApprovalRequest, OpenAI::Models::Conversations::ConversationItem::McpApprovalResponse, OpenAI::Models::Conversations::ConversationItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput]
|
54
|
+
#
|
55
|
+
# @see OpenAI::Models::Conversations::ItemRetrieveParams
|
56
|
+
def retrieve(item_id, params)
|
57
|
+
parsed, options = OpenAI::Conversations::ItemRetrieveParams.dump_request(params)
|
58
|
+
conversation_id =
|
59
|
+
parsed.delete(:conversation_id) do
|
60
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
61
|
+
end
|
62
|
+
@client.request(
|
63
|
+
method: :get,
|
64
|
+
path: ["conversations/%1$s/items/%2$s", conversation_id, item_id],
|
65
|
+
query: parsed,
|
66
|
+
model: OpenAI::Conversations::ConversationItem,
|
67
|
+
options: options
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Some parameter documentations has been truncated, see
|
72
|
+
# {OpenAI::Models::Conversations::ItemListParams} for more details.
|
73
|
+
#
|
74
|
+
# List all items for a conversation with the given ID.
|
75
|
+
#
|
76
|
+
# @overload list(conversation_id, after: nil, include: nil, limit: nil, order: nil, request_options: {})
|
77
|
+
#
|
78
|
+
# @param conversation_id [String] The ID of the conversation to list items for.
|
79
|
+
#
|
80
|
+
# @param after [String] An item ID to list items after, used in pagination.
|
81
|
+
#
|
82
|
+
# @param include [Array<Symbol, OpenAI::Models::Responses::ResponseIncludable>] Specify additional output data to include in the model response. Currently
|
83
|
+
#
|
84
|
+
# @param limit [Integer] A limit on the number of objects to be returned. Limit can range between
|
85
|
+
#
|
86
|
+
# @param order [Symbol, OpenAI::Models::Conversations::ItemListParams::Order] The order to return the input items in. Default is `desc`.
|
87
|
+
#
|
88
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
89
|
+
#
|
90
|
+
# @return [OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Conversations::Message, OpenAI::Models::Responses::ResponseFunctionToolCallItem, OpenAI::Models::Responses::ResponseFunctionToolCallOutputItem, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Conversations::ConversationItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseComputerToolCallOutputItem, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Conversations::ConversationItem::LocalShellCall, OpenAI::Models::Conversations::ConversationItem::LocalShellCallOutput, OpenAI::Models::Conversations::ConversationItem::McpListTools, OpenAI::Models::Conversations::ConversationItem::McpApprovalRequest, OpenAI::Models::Conversations::ConversationItem::McpApprovalResponse, OpenAI::Models::Conversations::ConversationItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput>]
|
91
|
+
#
|
92
|
+
# @see OpenAI::Models::Conversations::ItemListParams
|
93
|
+
def list(conversation_id, params = {})
|
94
|
+
parsed, options = OpenAI::Conversations::ItemListParams.dump_request(params)
|
95
|
+
@client.request(
|
96
|
+
method: :get,
|
97
|
+
path: ["conversations/%1$s/items", conversation_id],
|
98
|
+
query: parsed,
|
99
|
+
page: OpenAI::Internal::ConversationCursorPage,
|
100
|
+
model: OpenAI::Conversations::ConversationItem,
|
101
|
+
options: options
|
102
|
+
)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Delete an item from a conversation with the given IDs.
|
106
|
+
#
|
107
|
+
# @overload delete(item_id, conversation_id:, request_options: {})
|
108
|
+
#
|
109
|
+
# @param item_id [String] The ID of the item to delete.
|
110
|
+
#
|
111
|
+
# @param conversation_id [String] The ID of the conversation that contains the item.
|
112
|
+
#
|
113
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
114
|
+
#
|
115
|
+
# @return [OpenAI::Models::Conversations::Conversation]
|
116
|
+
#
|
117
|
+
# @see OpenAI::Models::Conversations::ItemDeleteParams
|
118
|
+
def delete(item_id, params)
|
119
|
+
parsed, options = OpenAI::Conversations::ItemDeleteParams.dump_request(params)
|
120
|
+
conversation_id =
|
121
|
+
parsed.delete(:conversation_id) do
|
122
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
123
|
+
end
|
124
|
+
@client.request(
|
125
|
+
method: :delete,
|
126
|
+
path: ["conversations/%1$s/items/%2$s", conversation_id, item_id],
|
127
|
+
model: OpenAI::Conversations::Conversation,
|
128
|
+
options: options
|
129
|
+
)
|
130
|
+
end
|
131
|
+
|
132
|
+
# @api private
|
133
|
+
#
|
134
|
+
# @param client [OpenAI::Client]
|
135
|
+
def initialize(client:)
|
136
|
+
@client = client
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Resources
|
5
|
+
class Conversations
|
6
|
+
# @return [OpenAI::Resources::Conversations::Items]
|
7
|
+
attr_reader :items
|
8
|
+
|
9
|
+
# Some parameter documentations has been truncated, see
|
10
|
+
# {OpenAI::Models::Conversations::ConversationCreateParams} for more details.
|
11
|
+
#
|
12
|
+
# Create a conversation with the given ID.
|
13
|
+
#
|
14
|
+
# @overload create(items: nil, metadata: nil, request_options: {})
|
15
|
+
#
|
16
|
+
# @param items [Array<OpenAI::Models::Responses::EasyInputMessage, OpenAI::Models::Responses::ResponseInputItem::Message, OpenAI::Models::Responses::ResponseOutputMessage, OpenAI::Models::Responses::ResponseFileSearchToolCall, OpenAI::Models::Responses::ResponseComputerToolCall, OpenAI::Models::Responses::ResponseInputItem::ComputerCallOutput, OpenAI::Models::Responses::ResponseFunctionWebSearch, OpenAI::Models::Responses::ResponseFunctionToolCall, OpenAI::Models::Responses::ResponseInputItem::FunctionCallOutput, OpenAI::Models::Responses::ResponseReasoningItem, OpenAI::Models::Responses::ResponseInputItem::ImageGenerationCall, OpenAI::Models::Responses::ResponseCodeInterpreterToolCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCall, OpenAI::Models::Responses::ResponseInputItem::LocalShellCallOutput, OpenAI::Models::Responses::ResponseInputItem::McpListTools, OpenAI::Models::Responses::ResponseInputItem::McpApprovalRequest, OpenAI::Models::Responses::ResponseInputItem::McpApprovalResponse, OpenAI::Models::Responses::ResponseInputItem::McpCall, OpenAI::Models::Responses::ResponseCustomToolCallOutput, OpenAI::Models::Responses::ResponseCustomToolCall, OpenAI::Models::Responses::ResponseInputItem::ItemReference>, nil] Initial items to include in the conversation context.
|
17
|
+
#
|
18
|
+
# @param metadata [Hash{Symbol=>String}, nil] Set of 16 key-value pairs that can be attached to an object. Useful for
|
19
|
+
#
|
20
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
21
|
+
#
|
22
|
+
# @return [OpenAI::Models::Conversations::Conversation]
|
23
|
+
#
|
24
|
+
# @see OpenAI::Models::Conversations::ConversationCreateParams
|
25
|
+
def create(params = {})
|
26
|
+
parsed, options = OpenAI::Conversations::ConversationCreateParams.dump_request(params)
|
27
|
+
@client.request(
|
28
|
+
method: :post,
|
29
|
+
path: "conversations",
|
30
|
+
body: parsed,
|
31
|
+
model: OpenAI::Conversations::Conversation,
|
32
|
+
options: options
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Get a conversation with the given ID.
|
37
|
+
#
|
38
|
+
# @overload retrieve(conversation_id, request_options: {})
|
39
|
+
#
|
40
|
+
# @param conversation_id [String] The ID of the conversation to retrieve.
|
41
|
+
#
|
42
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
43
|
+
#
|
44
|
+
# @return [OpenAI::Models::Conversations::Conversation]
|
45
|
+
#
|
46
|
+
# @see OpenAI::Models::Conversations::ConversationRetrieveParams
|
47
|
+
def retrieve(conversation_id, params = {})
|
48
|
+
@client.request(
|
49
|
+
method: :get,
|
50
|
+
path: ["conversations/%1$s", conversation_id],
|
51
|
+
model: OpenAI::Conversations::Conversation,
|
52
|
+
options: params[:request_options]
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Some parameter documentations has been truncated, see
|
57
|
+
# {OpenAI::Models::Conversations::ConversationUpdateParams} for more details.
|
58
|
+
#
|
59
|
+
# Update a conversation's metadata with the given ID.
|
60
|
+
#
|
61
|
+
# @overload update(conversation_id, metadata:, request_options: {})
|
62
|
+
#
|
63
|
+
# @param conversation_id [String] The ID of the conversation to update.
|
64
|
+
#
|
65
|
+
# @param metadata [Hash{Symbol=>String}] Set of 16 key-value pairs that can be attached to an object. This can be
|
66
|
+
#
|
67
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
68
|
+
#
|
69
|
+
# @return [OpenAI::Models::Conversations::Conversation]
|
70
|
+
#
|
71
|
+
# @see OpenAI::Models::Conversations::ConversationUpdateParams
|
72
|
+
def update(conversation_id, params)
|
73
|
+
parsed, options = OpenAI::Conversations::ConversationUpdateParams.dump_request(params)
|
74
|
+
@client.request(
|
75
|
+
method: :post,
|
76
|
+
path: ["conversations/%1$s", conversation_id],
|
77
|
+
body: parsed,
|
78
|
+
model: OpenAI::Conversations::Conversation,
|
79
|
+
options: options
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Delete a conversation with the given ID.
|
84
|
+
#
|
85
|
+
# @overload delete(conversation_id, request_options: {})
|
86
|
+
#
|
87
|
+
# @param conversation_id [String] The ID of the conversation to delete.
|
88
|
+
#
|
89
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
90
|
+
#
|
91
|
+
# @return [OpenAI::Models::Conversations::ConversationDeletedResource]
|
92
|
+
#
|
93
|
+
# @see OpenAI::Models::Conversations::ConversationDeleteParams
|
94
|
+
def delete(conversation_id, params = {})
|
95
|
+
@client.request(
|
96
|
+
method: :delete,
|
97
|
+
path: ["conversations/%1$s", conversation_id],
|
98
|
+
model: OpenAI::Conversations::ConversationDeletedResource,
|
99
|
+
options: params[:request_options]
|
100
|
+
)
|
101
|
+
end
|
102
|
+
|
103
|
+
# @api private
|
104
|
+
#
|
105
|
+
# @param client [OpenAI::Client]
|
106
|
+
def initialize(client:)
|
107
|
+
@client = client
|
108
|
+
@items = OpenAI::Resources::Conversations::Items.new(client: client)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -8,7 +8,7 @@ module OpenAI
|
|
8
8
|
#
|
9
9
|
# Upload a file that can be used across various endpoints. Individual files can be
|
10
10
|
# up to 512 MB, and the size of all files uploaded by one organization can be up
|
11
|
-
# to
|
11
|
+
# to 1 TB.
|
12
12
|
#
|
13
13
|
# The Assistants API supports files up to 2 million tokens and of specific file
|
14
14
|
# types. See the
|
@@ -28,12 +28,14 @@ module OpenAI
|
|
28
28
|
# Please [contact us](https://help.openai.com/) if you need to increase these
|
29
29
|
# storage limits.
|
30
30
|
#
|
31
|
-
# @overload create(file:, purpose:, request_options: {})
|
31
|
+
# @overload create(file:, purpose:, expires_after: nil, request_options: {})
|
32
32
|
#
|
33
33
|
# @param file [Pathname, StringIO, IO, String, OpenAI::FilePart] The File object (not file name) to be uploaded.
|
34
34
|
#
|
35
35
|
# @param purpose [Symbol, OpenAI::Models::FilePurpose] The intended purpose of the uploaded file. One of: - `assistants`: Used in the A
|
36
36
|
#
|
37
|
+
# @param expires_after [OpenAI::Models::FileCreateParams::ExpiresAfter] The expiration policy for a file. By default, files with `purpose=batch` expire
|
38
|
+
#
|
37
39
|
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
38
40
|
#
|
39
41
|
# @return [OpenAI::Models::FileObject]
|