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
@@ -0,0 +1,33 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
class ResponseConversationParam < OpenAI::Internal::Type::BaseModel
|
7
|
+
OrHash =
|
8
|
+
T.type_alias do
|
9
|
+
T.any(
|
10
|
+
OpenAI::Responses::ResponseConversationParam,
|
11
|
+
OpenAI::Internal::AnyHash
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
# The unique ID of the conversation.
|
16
|
+
sig { returns(String) }
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
# The conversation that this response belongs to.
|
20
|
+
sig { params(id: String).returns(T.attached_class) }
|
21
|
+
def self.new(
|
22
|
+
# The unique ID of the conversation.
|
23
|
+
id:
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
sig { override.returns({ id: String }) }
|
28
|
+
def to_hash
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -20,6 +20,19 @@ module OpenAI
|
|
20
20
|
sig { returns(T.nilable(T::Boolean)) }
|
21
21
|
attr_accessor :background
|
22
22
|
|
23
|
+
# The conversation that this response belongs to. Items from this conversation are
|
24
|
+
# prepended to `input_items` for this response request. Input items and output
|
25
|
+
# items from this response are automatically added to this conversation after this
|
26
|
+
# response completes.
|
27
|
+
sig do
|
28
|
+
returns(
|
29
|
+
T.nilable(
|
30
|
+
T.any(String, OpenAI::Responses::ResponseConversationParam)
|
31
|
+
)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
attr_accessor :conversation
|
35
|
+
|
23
36
|
# Specify additional output data to include in the model response. Currently
|
24
37
|
# supported values are:
|
25
38
|
#
|
@@ -133,6 +146,7 @@ module OpenAI
|
|
133
146
|
# The unique ID of the previous response to the model. Use this to create
|
134
147
|
# multi-turn conversations. Learn more about
|
135
148
|
# [conversation state](https://platform.openai.com/docs/guides/conversation-state).
|
149
|
+
# Cannot be used in conjunction with `conversation`.
|
136
150
|
sig { returns(T.nilable(String)) }
|
137
151
|
attr_accessor :previous_response_id
|
138
152
|
|
@@ -157,7 +171,7 @@ module OpenAI
|
|
157
171
|
sig { params(prompt_cache_key: String).void }
|
158
172
|
attr_writer :prompt_cache_key
|
159
173
|
|
160
|
-
# **o-series models only**
|
174
|
+
# **gpt-5 and o-series models only**
|
161
175
|
#
|
162
176
|
# Configuration options for
|
163
177
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
@@ -186,9 +200,8 @@ module OpenAI
|
|
186
200
|
# - If set to 'default', then the request will be processed with the standard
|
187
201
|
# pricing and performance for the selected model.
|
188
202
|
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
189
|
-
# 'priority', then the request
|
190
|
-
#
|
191
|
-
# Priority processing.
|
203
|
+
# '[priority](https://openai.com/api-priority-processing/)', then the request
|
204
|
+
# will be processed with the corresponding service tier.
|
192
205
|
# - When not set, the default behavior is 'auto'.
|
193
206
|
#
|
194
207
|
# When the `service_tier` parameter is set, the response body will include the
|
@@ -386,6 +399,13 @@ module OpenAI
|
|
386
399
|
sig do
|
387
400
|
params(
|
388
401
|
background: T.nilable(T::Boolean),
|
402
|
+
conversation:
|
403
|
+
T.nilable(
|
404
|
+
T.any(
|
405
|
+
String,
|
406
|
+
OpenAI::Responses::ResponseConversationParam::OrHash
|
407
|
+
)
|
408
|
+
),
|
389
409
|
include:
|
390
410
|
T.nilable(
|
391
411
|
T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
|
@@ -455,6 +475,11 @@ module OpenAI
|
|
455
475
|
# Whether to run the model response in the background.
|
456
476
|
# [Learn more](https://platform.openai.com/docs/guides/background).
|
457
477
|
background: nil,
|
478
|
+
# The conversation that this response belongs to. Items from this conversation are
|
479
|
+
# prepended to `input_items` for this response request. Input items and output
|
480
|
+
# items from this response are automatically added to this conversation after this
|
481
|
+
# response completes.
|
482
|
+
conversation: nil,
|
458
483
|
# Specify additional output data to include in the model response. Currently
|
459
484
|
# supported values are:
|
460
485
|
#
|
@@ -515,6 +540,7 @@ module OpenAI
|
|
515
540
|
# The unique ID of the previous response to the model. Use this to create
|
516
541
|
# multi-turn conversations. Learn more about
|
517
542
|
# [conversation state](https://platform.openai.com/docs/guides/conversation-state).
|
543
|
+
# Cannot be used in conjunction with `conversation`.
|
518
544
|
previous_response_id: nil,
|
519
545
|
# Reference to a prompt template and its variables.
|
520
546
|
# [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
|
@@ -523,7 +549,7 @@ module OpenAI
|
|
523
549
|
# hit rates. Replaces the `user` field.
|
524
550
|
# [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
525
551
|
prompt_cache_key: nil,
|
526
|
-
# **o-series models only**
|
552
|
+
# **gpt-5 and o-series models only**
|
527
553
|
#
|
528
554
|
# Configuration options for
|
529
555
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
@@ -542,9 +568,8 @@ module OpenAI
|
|
542
568
|
# - If set to 'default', then the request will be processed with the standard
|
543
569
|
# pricing and performance for the selected model.
|
544
570
|
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
545
|
-
# 'priority', then the request
|
546
|
-
#
|
547
|
-
# Priority processing.
|
571
|
+
# '[priority](https://openai.com/api-priority-processing/)', then the request
|
572
|
+
# will be processed with the corresponding service tier.
|
548
573
|
# - When not set, the default behavior is 'auto'.
|
549
574
|
#
|
550
575
|
# When the `service_tier` parameter is set, the response body will include the
|
@@ -619,6 +644,10 @@ module OpenAI
|
|
619
644
|
override.returns(
|
620
645
|
{
|
621
646
|
background: T.nilable(T::Boolean),
|
647
|
+
conversation:
|
648
|
+
T.nilable(
|
649
|
+
T.any(String, OpenAI::Responses::ResponseConversationParam)
|
650
|
+
),
|
622
651
|
include:
|
623
652
|
T.nilable(
|
624
653
|
T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
|
@@ -688,6 +717,29 @@ module OpenAI
|
|
688
717
|
def to_hash
|
689
718
|
end
|
690
719
|
|
720
|
+
# The conversation that this response belongs to. Items from this conversation are
|
721
|
+
# prepended to `input_items` for this response request. Input items and output
|
722
|
+
# items from this response are automatically added to this conversation after this
|
723
|
+
# response completes.
|
724
|
+
module Conversation
|
725
|
+
extend OpenAI::Internal::Type::Union
|
726
|
+
|
727
|
+
Variants =
|
728
|
+
T.type_alias do
|
729
|
+
T.any(String, OpenAI::Responses::ResponseConversationParam)
|
730
|
+
end
|
731
|
+
|
732
|
+
sig do
|
733
|
+
override.returns(
|
734
|
+
T::Array[
|
735
|
+
OpenAI::Responses::ResponseCreateParams::Conversation::Variants
|
736
|
+
]
|
737
|
+
)
|
738
|
+
end
|
739
|
+
def self.variants
|
740
|
+
end
|
741
|
+
end
|
742
|
+
|
691
743
|
# Text, image, or file inputs to the model, used to generate a response.
|
692
744
|
#
|
693
745
|
# Learn more:
|
@@ -725,9 +777,8 @@ module OpenAI
|
|
725
777
|
# - If set to 'default', then the request will be processed with the standard
|
726
778
|
# pricing and performance for the selected model.
|
727
779
|
# - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or
|
728
|
-
# 'priority', then the request
|
729
|
-
#
|
730
|
-
# Priority processing.
|
780
|
+
# '[priority](https://openai.com/api-priority-processing/)', then the request
|
781
|
+
# will be processed with the corresponding service tier.
|
731
782
|
# - When not set, the default behavior is 'auto'.
|
732
783
|
#
|
733
784
|
# When the `service_tier` parameter is set, the response body will include the
|
@@ -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::
|
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::
|
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::
|
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::
|
230
|
+
OpenAI::Responses::Tool::Mcp::AllowedTools::McpToolFilter
|
163
231
|
)
|
164
232
|
end
|
165
233
|
|
166
|
-
class
|
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::
|
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(
|
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
|
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
|
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
|
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
|
446
|
+
# A filter object to specify which tools are allowed.
|
279
447
|
always: nil,
|
280
|
-
# A
|
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
|
-
#
|
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
|
492
|
+
# A filter object to specify which tools are allowed.
|
315
493
|
sig do
|
316
|
-
params(
|
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
|
-
#
|
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
|
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
|
-
#
|
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
|
545
|
+
# A filter object to specify which tools are allowed.
|
346
546
|
sig do
|
347
|
-
params(
|
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
|
-
#
|
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
|
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
|