openai 0.16.0 → 0.17.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 +24 -0
- data/README.md +14 -20
- data/lib/openai/internal/transport/base_client.rb +1 -1
- data/lib/openai/internal/type/enum.rb +6 -6
- data/lib/openai/internal/type/union.rb +13 -17
- data/lib/openai/models/beta/assistant_create_params.rb +4 -5
- data/lib/openai/models/beta/assistant_update_params.rb +22 -5
- data/lib/openai/models/beta/threads/run_create_params.rb +4 -5
- data/lib/openai/models/chat/chat_completion_allowed_tool_choice.rb +33 -0
- data/lib/openai/models/chat/chat_completion_allowed_tools.rb +64 -0
- data/lib/openai/models/chat/chat_completion_assistant_message_param.rb +3 -5
- data/lib/openai/models/chat/chat_completion_custom_tool.rb +163 -0
- data/lib/openai/models/chat/chat_completion_function_tool.rb +29 -0
- data/lib/openai/models/chat/chat_completion_message.rb +3 -5
- data/lib/openai/models/chat/chat_completion_message_custom_tool_call.rb +60 -0
- data/lib/openai/models/chat/chat_completion_message_function_tool_call.rb +73 -0
- data/lib/openai/models/chat/chat_completion_message_tool_call.rb +10 -56
- data/lib/openai/models/chat/chat_completion_named_tool_choice.rb +2 -2
- data/lib/openai/models/chat/chat_completion_named_tool_choice_custom.rb +42 -0
- data/lib/openai/models/chat/chat_completion_stream_options.rb +14 -1
- data/lib/openai/models/chat/chat_completion_tool.rb +12 -14
- data/lib/openai/models/chat/chat_completion_tool_choice_option.rb +7 -1
- data/lib/openai/models/chat/completion_create_params.rb +35 -12
- data/lib/openai/models/chat_model.rb +7 -0
- data/lib/openai/models/custom_tool_input_format.rb +76 -0
- data/lib/openai/models/evals/create_eval_completions_run_data_source.rb +3 -3
- data/lib/openai/models/evals/run_cancel_response.rb +2 -2
- data/lib/openai/models/evals/run_create_params.rb +2 -2
- data/lib/openai/models/evals/run_create_response.rb +2 -2
- data/lib/openai/models/evals/run_list_response.rb +2 -2
- data/lib/openai/models/evals/run_retrieve_response.rb +2 -2
- data/lib/openai/models/reasoning.rb +4 -5
- data/lib/openai/models/reasoning_effort.rb +4 -4
- data/lib/openai/models/response_format_text_grammar.rb +27 -0
- data/lib/openai/models/response_format_text_python.rb +20 -0
- data/lib/openai/models/responses/custom_tool.rb +48 -0
- data/lib/openai/models/responses/response.rb +20 -12
- data/lib/openai/models/responses/response_create_params.rb +48 -10
- data/lib/openai/models/responses/response_custom_tool_call.rb +55 -0
- data/lib/openai/models/responses/response_custom_tool_call_input_delta_event.rb +52 -0
- data/lib/openai/models/responses/response_custom_tool_call_input_done_event.rb +52 -0
- data/lib/openai/models/responses/response_custom_tool_call_output.rb +47 -0
- data/lib/openai/models/responses/response_input_item.rb +7 -1
- data/lib/openai/models/responses/response_output_item.rb +4 -1
- data/lib/openai/models/responses/response_output_item_added_event.rb +2 -2
- data/lib/openai/models/responses/response_output_item_done_event.rb +2 -2
- data/lib/openai/models/responses/response_reasoning_item.rb +36 -5
- data/lib/openai/models/responses/response_reasoning_text_delta_event.rb +63 -0
- data/lib/openai/models/responses/response_reasoning_text_done_event.rb +63 -0
- data/lib/openai/models/responses/response_retrieve_params.rb +14 -1
- data/lib/openai/models/responses/response_stream_event.rb +13 -11
- data/lib/openai/models/responses/response_text_config.rb +27 -1
- data/lib/openai/models/responses/tool.rb +5 -1
- data/lib/openai/models/responses/tool_choice_allowed.rb +73 -0
- data/lib/openai/models/responses/tool_choice_custom.rb +28 -0
- data/lib/openai/models/vector_store_search_params.rb +6 -1
- data/lib/openai/models.rb +6 -0
- data/lib/openai/resources/beta/assistants.rb +2 -2
- data/lib/openai/resources/beta/threads/runs.rb +2 -2
- data/lib/openai/resources/chat/completions.rb +16 -10
- data/lib/openai/resources/responses.rb +38 -22
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +19 -2
- data/rbi/openai/internal/transport/base_client.rbi +1 -1
- data/rbi/openai/models/beta/assistant_create_params.rbi +6 -8
- data/rbi/openai/models/beta/assistant_update_params.rbi +36 -8
- data/rbi/openai/models/beta/threads/run_create_params.rbi +6 -8
- data/rbi/openai/models/chat/chat_completion_allowed_tool_choice.rbi +60 -0
- data/rbi/openai/models/chat/chat_completion_allowed_tools.rbi +118 -0
- data/rbi/openai/models/chat/chat_completion_assistant_message_param.rbi +27 -4
- data/rbi/openai/models/chat/chat_completion_custom_tool.rbi +335 -0
- data/rbi/openai/models/chat/chat_completion_function_tool.rbi +51 -0
- data/rbi/openai/models/chat/chat_completion_message.rbi +17 -4
- data/rbi/openai/models/chat/chat_completion_message_custom_tool_call.rbi +105 -0
- data/rbi/openai/models/chat/chat_completion_message_function_tool_call.rbi +118 -0
- data/rbi/openai/models/chat/chat_completion_message_tool_call.rbi +9 -92
- data/rbi/openai/models/chat/chat_completion_named_tool_choice.rbi +2 -2
- data/rbi/openai/models/chat/chat_completion_named_tool_choice_custom.rbi +89 -0
- data/rbi/openai/models/chat/chat_completion_stream_options.rbi +30 -2
- data/rbi/openai/models/chat/chat_completion_tool.rbi +11 -30
- data/rbi/openai/models/chat/chat_completion_tool_choice_option.rbi +3 -1
- data/rbi/openai/models/chat/completion_create_params.rbi +106 -25
- data/rbi/openai/models/chat_model.rbi +11 -0
- data/rbi/openai/models/custom_tool_input_format.rbi +136 -0
- data/rbi/openai/models/evals/create_eval_completions_run_data_source.rbi +8 -4
- data/rbi/openai/models/evals/run_cancel_response.rbi +2 -0
- data/rbi/openai/models/evals/run_create_params.rbi +4 -0
- data/rbi/openai/models/evals/run_create_response.rbi +2 -0
- data/rbi/openai/models/evals/run_list_response.rbi +2 -0
- data/rbi/openai/models/evals/run_retrieve_response.rbi +2 -0
- data/rbi/openai/models/reasoning.rbi +6 -8
- data/rbi/openai/models/reasoning_effort.rbi +4 -4
- data/rbi/openai/models/response_format_text_grammar.rbi +35 -0
- data/rbi/openai/models/response_format_text_python.rbi +30 -0
- data/rbi/openai/models/responses/custom_tool.rbi +96 -0
- data/rbi/openai/models/responses/response.rbi +15 -5
- data/rbi/openai/models/responses/response_create_params.rbi +94 -7
- data/rbi/openai/models/responses/response_custom_tool_call.rbi +78 -0
- data/rbi/openai/models/responses/response_custom_tool_call_input_delta_event.rbi +75 -0
- data/rbi/openai/models/responses/response_custom_tool_call_input_done_event.rbi +75 -0
- data/rbi/openai/models/responses/response_custom_tool_call_output.rbi +65 -0
- data/rbi/openai/models/responses/response_input_item.rbi +2 -0
- data/rbi/openai/models/responses/response_output_item.rbi +2 -1
- data/rbi/openai/models/responses/response_output_item_added_event.rbi +2 -1
- data/rbi/openai/models/responses/response_output_item_done_event.rbi +2 -1
- data/rbi/openai/models/responses/response_reasoning_item.rbi +63 -4
- data/rbi/openai/models/responses/response_reasoning_text_delta_event.rbi +83 -0
- data/rbi/openai/models/responses/{response_reasoning_summary_done_event.rbi → response_reasoning_text_done_event.rbi} +20 -20
- data/rbi/openai/models/responses/response_retrieve_params.rbi +21 -0
- data/rbi/openai/models/responses/response_stream_event.rbi +4 -2
- data/rbi/openai/models/responses/response_text_config.rbi +64 -1
- data/rbi/openai/models/responses/tool.rbi +1 -0
- data/rbi/openai/models/responses/tool_choice_allowed.rbi +124 -0
- data/rbi/openai/models/responses/tool_choice_custom.rbi +39 -0
- data/rbi/openai/models/vector_store_search_params.rbi +12 -1
- data/rbi/openai/models.rbi +6 -0
- data/rbi/openai/resources/beta/assistants.rbi +6 -8
- data/rbi/openai/resources/beta/threads/runs.rbi +8 -10
- data/rbi/openai/resources/chat/completions.rbi +44 -19
- data/rbi/openai/resources/responses.rbi +215 -41
- data/sig/openai/internal/transport/base_client.rbs +1 -1
- data/sig/openai/models/beta/assistant_update_params.rbs +12 -0
- data/sig/openai/models/chat/chat_completion_allowed_tool_choice.rbs +29 -0
- data/sig/openai/models/chat/chat_completion_allowed_tools.rbs +38 -0
- data/sig/openai/models/chat/chat_completion_assistant_message_param.rbs +6 -6
- data/sig/openai/models/chat/chat_completion_custom_tool.rbs +137 -0
- data/sig/openai/models/chat/chat_completion_function_tool.rbs +26 -0
- data/sig/openai/models/chat/chat_completion_message.rbs +6 -6
- data/sig/openai/models/chat/chat_completion_message_custom_tool_call.rbs +46 -0
- data/sig/openai/models/chat/chat_completion_message_function_tool_call.rbs +46 -0
- data/sig/openai/models/chat/chat_completion_message_tool_call.rbs +6 -35
- data/sig/openai/models/chat/chat_completion_named_tool_choice_custom.rbs +39 -0
- data/sig/openai/models/chat/chat_completion_stream_options.rbs +11 -3
- data/sig/openai/models/chat/chat_completion_tool.rbs +6 -15
- data/sig/openai/models/chat/chat_completion_tool_choice_option.rbs +2 -0
- data/sig/openai/models/chat/completion_create_params.rbs +23 -6
- data/sig/openai/models/chat_model.rbs +15 -1
- data/sig/openai/models/custom_tool_input_format.rbs +61 -0
- data/sig/openai/models/evals/create_eval_completions_run_data_source.rbs +6 -6
- data/sig/openai/models/reasoning_effort.rbs +2 -1
- data/sig/openai/models/response_format_text_grammar.rbs +15 -0
- data/sig/openai/models/response_format_text_python.rbs +13 -0
- data/sig/openai/models/responses/custom_tool.rbs +43 -0
- data/sig/openai/models/responses/response.rbs +2 -0
- data/sig/openai/models/responses/response_create_params.rbs +19 -0
- data/sig/openai/models/responses/response_custom_tool_call.rbs +44 -0
- data/sig/openai/models/responses/response_custom_tool_call_input_delta_event.rbs +42 -0
- data/sig/openai/models/responses/response_custom_tool_call_input_done_event.rbs +42 -0
- data/sig/openai/models/responses/response_custom_tool_call_output.rbs +39 -0
- data/sig/openai/models/responses/response_input_item.rbs +2 -0
- data/sig/openai/models/responses/response_output_item.rbs +1 -0
- data/sig/openai/models/responses/response_reasoning_item.rbs +21 -0
- data/sig/openai/models/responses/{response_reasoning_summary_delta_event.rbs → response_reasoning_text_delta_event.rbs} +15 -15
- data/sig/openai/models/responses/{response_reasoning_summary_done_event.rbs → response_reasoning_text_done_event.rbs} +11 -11
- data/sig/openai/models/responses/response_retrieve_params.rbs +7 -0
- data/sig/openai/models/responses/response_stream_event.rbs +4 -2
- data/sig/openai/models/responses/response_text_config.rbs +22 -3
- data/sig/openai/models/responses/tool.rbs +1 -0
- data/sig/openai/models/responses/tool_choice_allowed.rbs +43 -0
- data/sig/openai/models/responses/tool_choice_custom.rbs +17 -0
- data/sig/openai/models/vector_store_search_params.rbs +2 -1
- data/sig/openai/models.rbs +6 -0
- data/sig/openai/resources/chat/completions.rbs +4 -2
- data/sig/openai/resources/responses.rbs +32 -0
- metadata +59 -8
- data/lib/openai/models/responses/response_reasoning_summary_delta_event.rb +0 -65
- data/lib/openai/models/responses/response_reasoning_summary_done_event.rb +0 -60
- data/rbi/openai/models/responses/response_reasoning_summary_delta_event.rbi +0 -85
@@ -44,7 +44,8 @@ module OpenAI
|
|
44
44
|
OpenAI::Responses::ResponseOutputItem::LocalShellCall::OrHash,
|
45
45
|
OpenAI::Responses::ResponseOutputItem::McpCall::OrHash,
|
46
46
|
OpenAI::Responses::ResponseOutputItem::McpListTools::OrHash,
|
47
|
-
OpenAI::Responses::ResponseOutputItem::McpApprovalRequest::OrHash
|
47
|
+
OpenAI::Responses::ResponseOutputItem::McpApprovalRequest::OrHash,
|
48
|
+
OpenAI::Responses::ResponseCustomToolCall::OrHash
|
48
49
|
),
|
49
50
|
output_index: Integer,
|
50
51
|
sequence_number: Integer,
|
@@ -44,7 +44,8 @@ module OpenAI
|
|
44
44
|
OpenAI::Responses::ResponseOutputItem::LocalShellCall::OrHash,
|
45
45
|
OpenAI::Responses::ResponseOutputItem::McpCall::OrHash,
|
46
46
|
OpenAI::Responses::ResponseOutputItem::McpListTools::OrHash,
|
47
|
-
OpenAI::Responses::ResponseOutputItem::McpApprovalRequest::OrHash
|
47
|
+
OpenAI::Responses::ResponseOutputItem::McpApprovalRequest::OrHash,
|
48
|
+
OpenAI::Responses::ResponseCustomToolCall::OrHash
|
48
49
|
),
|
49
50
|
output_index: Integer,
|
50
51
|
sequence_number: Integer,
|
@@ -16,7 +16,7 @@ module OpenAI
|
|
16
16
|
sig { returns(String) }
|
17
17
|
attr_accessor :id
|
18
18
|
|
19
|
-
# Reasoning
|
19
|
+
# Reasoning summary content.
|
20
20
|
sig do
|
21
21
|
returns(T::Array[OpenAI::Responses::ResponseReasoningItem::Summary])
|
22
22
|
end
|
@@ -26,6 +26,26 @@ module OpenAI
|
|
26
26
|
sig { returns(Symbol) }
|
27
27
|
attr_accessor :type
|
28
28
|
|
29
|
+
# Reasoning text content.
|
30
|
+
sig do
|
31
|
+
returns(
|
32
|
+
T.nilable(
|
33
|
+
T::Array[OpenAI::Responses::ResponseReasoningItem::Content]
|
34
|
+
)
|
35
|
+
)
|
36
|
+
end
|
37
|
+
attr_reader :content
|
38
|
+
|
39
|
+
sig do
|
40
|
+
params(
|
41
|
+
content:
|
42
|
+
T::Array[
|
43
|
+
OpenAI::Responses::ResponseReasoningItem::Content::OrHash
|
44
|
+
]
|
45
|
+
).void
|
46
|
+
end
|
47
|
+
attr_writer :content
|
48
|
+
|
29
49
|
# The encrypted content of the reasoning item - populated when a response is
|
30
50
|
# generated with `reasoning.encrypted_content` in the `include` parameter.
|
31
51
|
sig { returns(T.nilable(String)) }
|
@@ -60,6 +80,10 @@ module OpenAI
|
|
60
80
|
T::Array[
|
61
81
|
OpenAI::Responses::ResponseReasoningItem::Summary::OrHash
|
62
82
|
],
|
83
|
+
content:
|
84
|
+
T::Array[
|
85
|
+
OpenAI::Responses::ResponseReasoningItem::Content::OrHash
|
86
|
+
],
|
63
87
|
encrypted_content: T.nilable(String),
|
64
88
|
status: OpenAI::Responses::ResponseReasoningItem::Status::OrSymbol,
|
65
89
|
type: Symbol
|
@@ -68,8 +92,10 @@ module OpenAI
|
|
68
92
|
def self.new(
|
69
93
|
# The unique identifier of the reasoning content.
|
70
94
|
id:,
|
71
|
-
# Reasoning
|
95
|
+
# Reasoning summary content.
|
72
96
|
summary:,
|
97
|
+
# Reasoning text content.
|
98
|
+
content: nil,
|
73
99
|
# The encrypted content of the reasoning item - populated when a response is
|
74
100
|
# generated with `reasoning.encrypted_content` in the `include` parameter.
|
75
101
|
encrypted_content: nil,
|
@@ -88,6 +114,8 @@ module OpenAI
|
|
88
114
|
summary:
|
89
115
|
T::Array[OpenAI::Responses::ResponseReasoningItem::Summary],
|
90
116
|
type: Symbol,
|
117
|
+
content:
|
118
|
+
T::Array[OpenAI::Responses::ResponseReasoningItem::Content],
|
91
119
|
encrypted_content: T.nilable(String),
|
92
120
|
status: OpenAI::Responses::ResponseReasoningItem::Status::OrSymbol
|
93
121
|
}
|
@@ -105,7 +133,7 @@ module OpenAI
|
|
105
133
|
)
|
106
134
|
end
|
107
135
|
|
108
|
-
# A
|
136
|
+
# A summary of the reasoning output from the model so far.
|
109
137
|
sig { returns(String) }
|
110
138
|
attr_accessor :text
|
111
139
|
|
@@ -115,7 +143,7 @@ module OpenAI
|
|
115
143
|
|
116
144
|
sig { params(text: String, type: Symbol).returns(T.attached_class) }
|
117
145
|
def self.new(
|
118
|
-
# A
|
146
|
+
# A summary of the reasoning output from the model so far.
|
119
147
|
text:,
|
120
148
|
# The type of the object. Always `summary_text`.
|
121
149
|
type: :summary_text
|
@@ -127,6 +155,37 @@ module OpenAI
|
|
127
155
|
end
|
128
156
|
end
|
129
157
|
|
158
|
+
class Content < OpenAI::Internal::Type::BaseModel
|
159
|
+
OrHash =
|
160
|
+
T.type_alias do
|
161
|
+
T.any(
|
162
|
+
OpenAI::Responses::ResponseReasoningItem::Content,
|
163
|
+
OpenAI::Internal::AnyHash
|
164
|
+
)
|
165
|
+
end
|
166
|
+
|
167
|
+
# Reasoning text output from the model.
|
168
|
+
sig { returns(String) }
|
169
|
+
attr_accessor :text
|
170
|
+
|
171
|
+
# The type of the object. Always `reasoning_text`.
|
172
|
+
sig { returns(Symbol) }
|
173
|
+
attr_accessor :type
|
174
|
+
|
175
|
+
sig { params(text: String, type: Symbol).returns(T.attached_class) }
|
176
|
+
def self.new(
|
177
|
+
# Reasoning text output from the model.
|
178
|
+
text:,
|
179
|
+
# The type of the object. Always `reasoning_text`.
|
180
|
+
type: :reasoning_text
|
181
|
+
)
|
182
|
+
end
|
183
|
+
|
184
|
+
sig { override.returns({ text: String, type: Symbol }) }
|
185
|
+
def to_hash
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
130
189
|
# The status of the item. One of `in_progress`, `completed`, or `incomplete`.
|
131
190
|
# Populated when items are returned via API.
|
132
191
|
module Status
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
class ResponseReasoningTextDeltaEvent < OpenAI::Internal::Type::BaseModel
|
7
|
+
OrHash =
|
8
|
+
T.type_alias do
|
9
|
+
T.any(
|
10
|
+
OpenAI::Responses::ResponseReasoningTextDeltaEvent,
|
11
|
+
OpenAI::Internal::AnyHash
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
# The index of the reasoning content part this delta is associated with.
|
16
|
+
sig { returns(Integer) }
|
17
|
+
attr_accessor :content_index
|
18
|
+
|
19
|
+
# The text delta that was added to the reasoning content.
|
20
|
+
sig { returns(String) }
|
21
|
+
attr_accessor :delta
|
22
|
+
|
23
|
+
# The ID of the item this reasoning text delta is associated with.
|
24
|
+
sig { returns(String) }
|
25
|
+
attr_accessor :item_id
|
26
|
+
|
27
|
+
# The index of the output item this reasoning text delta is associated with.
|
28
|
+
sig { returns(Integer) }
|
29
|
+
attr_accessor :output_index
|
30
|
+
|
31
|
+
# The sequence number of this event.
|
32
|
+
sig { returns(Integer) }
|
33
|
+
attr_accessor :sequence_number
|
34
|
+
|
35
|
+
# The type of the event. Always `response.reasoning_text.delta`.
|
36
|
+
sig { returns(Symbol) }
|
37
|
+
attr_accessor :type
|
38
|
+
|
39
|
+
# Emitted when a delta is added to a reasoning text.
|
40
|
+
sig do
|
41
|
+
params(
|
42
|
+
content_index: Integer,
|
43
|
+
delta: String,
|
44
|
+
item_id: String,
|
45
|
+
output_index: Integer,
|
46
|
+
sequence_number: Integer,
|
47
|
+
type: Symbol
|
48
|
+
).returns(T.attached_class)
|
49
|
+
end
|
50
|
+
def self.new(
|
51
|
+
# The index of the reasoning content part this delta is associated with.
|
52
|
+
content_index:,
|
53
|
+
# The text delta that was added to the reasoning content.
|
54
|
+
delta:,
|
55
|
+
# The ID of the item this reasoning text delta is associated with.
|
56
|
+
item_id:,
|
57
|
+
# The index of the output item this reasoning text delta is associated with.
|
58
|
+
output_index:,
|
59
|
+
# The sequence number of this event.
|
60
|
+
sequence_number:,
|
61
|
+
# The type of the event. Always `response.reasoning_text.delta`.
|
62
|
+
type: :"response.reasoning_text.delta"
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
sig do
|
67
|
+
override.returns(
|
68
|
+
{
|
69
|
+
content_index: Integer,
|
70
|
+
delta: String,
|
71
|
+
item_id: String,
|
72
|
+
output_index: Integer,
|
73
|
+
sequence_number: Integer,
|
74
|
+
type: Symbol
|
75
|
+
}
|
76
|
+
)
|
77
|
+
end
|
78
|
+
def to_hash
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -3,20 +3,24 @@
|
|
3
3
|
module OpenAI
|
4
4
|
module Models
|
5
5
|
module Responses
|
6
|
-
class
|
6
|
+
class ResponseReasoningTextDoneEvent < OpenAI::Internal::Type::BaseModel
|
7
7
|
OrHash =
|
8
8
|
T.type_alias do
|
9
9
|
T.any(
|
10
|
-
OpenAI::Responses::
|
10
|
+
OpenAI::Responses::ResponseReasoningTextDoneEvent,
|
11
11
|
OpenAI::Internal::AnyHash
|
12
12
|
)
|
13
13
|
end
|
14
14
|
|
15
|
-
# The
|
15
|
+
# The index of the reasoning content part.
|
16
|
+
sig { returns(Integer) }
|
17
|
+
attr_accessor :content_index
|
18
|
+
|
19
|
+
# The ID of the item this reasoning text is associated with.
|
16
20
|
sig { returns(String) }
|
17
21
|
attr_accessor :item_id
|
18
22
|
|
19
|
-
# The index of the output item
|
23
|
+
# The index of the output item this reasoning text is associated with.
|
20
24
|
sig { returns(Integer) }
|
21
25
|
attr_accessor :output_index
|
22
26
|
|
@@ -24,52 +28,48 @@ module OpenAI
|
|
24
28
|
sig { returns(Integer) }
|
25
29
|
attr_accessor :sequence_number
|
26
30
|
|
27
|
-
# The
|
28
|
-
sig { returns(Integer) }
|
29
|
-
attr_accessor :summary_index
|
30
|
-
|
31
|
-
# The finalized reasoning summary text.
|
31
|
+
# The full text of the completed reasoning content.
|
32
32
|
sig { returns(String) }
|
33
33
|
attr_accessor :text
|
34
34
|
|
35
|
-
# The type of the event. Always
|
35
|
+
# The type of the event. Always `response.reasoning_text.done`.
|
36
36
|
sig { returns(Symbol) }
|
37
37
|
attr_accessor :type
|
38
38
|
|
39
|
-
# Emitted when
|
39
|
+
# Emitted when a reasoning text is completed.
|
40
40
|
sig do
|
41
41
|
params(
|
42
|
+
content_index: Integer,
|
42
43
|
item_id: String,
|
43
44
|
output_index: Integer,
|
44
45
|
sequence_number: Integer,
|
45
|
-
summary_index: Integer,
|
46
46
|
text: String,
|
47
47
|
type: Symbol
|
48
48
|
).returns(T.attached_class)
|
49
49
|
end
|
50
50
|
def self.new(
|
51
|
-
# The
|
51
|
+
# The index of the reasoning content part.
|
52
|
+
content_index:,
|
53
|
+
# The ID of the item this reasoning text is associated with.
|
52
54
|
item_id:,
|
53
|
-
# The index of the output item
|
55
|
+
# The index of the output item this reasoning text is associated with.
|
54
56
|
output_index:,
|
55
57
|
# The sequence number of this event.
|
56
58
|
sequence_number:,
|
57
|
-
# The
|
58
|
-
summary_index:,
|
59
|
-
# The finalized reasoning summary text.
|
59
|
+
# The full text of the completed reasoning content.
|
60
60
|
text:,
|
61
|
-
# The type of the event. Always
|
62
|
-
type: :"response.
|
61
|
+
# The type of the event. Always `response.reasoning_text.done`.
|
62
|
+
type: :"response.reasoning_text.done"
|
63
63
|
)
|
64
64
|
end
|
65
65
|
|
66
66
|
sig do
|
67
67
|
override.returns(
|
68
68
|
{
|
69
|
+
content_index: Integer,
|
69
70
|
item_id: String,
|
70
71
|
output_index: Integer,
|
71
72
|
sequence_number: Integer,
|
72
|
-
summary_index: Integer,
|
73
73
|
text: String,
|
74
74
|
type: Symbol
|
75
75
|
}
|
@@ -31,6 +31,18 @@ module OpenAI
|
|
31
31
|
end
|
32
32
|
attr_writer :include
|
33
33
|
|
34
|
+
# When true, stream obfuscation will be enabled. Stream obfuscation adds random
|
35
|
+
# characters to an `obfuscation` field on streaming delta events to normalize
|
36
|
+
# payload sizes as a mitigation to certain side-channel attacks. These obfuscation
|
37
|
+
# fields are included by default, but add a small amount of overhead to the data
|
38
|
+
# stream. You can set `include_obfuscation` to false to optimize for bandwidth if
|
39
|
+
# you trust the network links between your application and the OpenAI API.
|
40
|
+
sig { returns(T.nilable(T::Boolean)) }
|
41
|
+
attr_reader :include_obfuscation
|
42
|
+
|
43
|
+
sig { params(include_obfuscation: T::Boolean).void }
|
44
|
+
attr_writer :include_obfuscation
|
45
|
+
|
34
46
|
# The sequence number of the event after which to start streaming.
|
35
47
|
sig { returns(T.nilable(Integer)) }
|
36
48
|
attr_reader :starting_after
|
@@ -41,6 +53,7 @@ module OpenAI
|
|
41
53
|
sig do
|
42
54
|
params(
|
43
55
|
include: T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
|
56
|
+
include_obfuscation: T::Boolean,
|
44
57
|
starting_after: Integer,
|
45
58
|
request_options: OpenAI::RequestOptions::OrHash
|
46
59
|
).returns(T.attached_class)
|
@@ -49,6 +62,13 @@ module OpenAI
|
|
49
62
|
# Additional fields to include in the response. See the `include` parameter for
|
50
63
|
# Response creation above for more information.
|
51
64
|
include: nil,
|
65
|
+
# When true, stream obfuscation will be enabled. Stream obfuscation adds random
|
66
|
+
# characters to an `obfuscation` field on streaming delta events to normalize
|
67
|
+
# payload sizes as a mitigation to certain side-channel attacks. These obfuscation
|
68
|
+
# fields are included by default, but add a small amount of overhead to the data
|
69
|
+
# stream. You can set `include_obfuscation` to false to optimize for bandwidth if
|
70
|
+
# you trust the network links between your application and the OpenAI API.
|
71
|
+
include_obfuscation: nil,
|
52
72
|
# The sequence number of the event after which to start streaming.
|
53
73
|
starting_after: nil,
|
54
74
|
request_options: {}
|
@@ -60,6 +80,7 @@ module OpenAI
|
|
60
80
|
{
|
61
81
|
include:
|
62
82
|
T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol],
|
83
|
+
include_obfuscation: T::Boolean,
|
63
84
|
starting_after: Integer,
|
64
85
|
request_options: OpenAI::RequestOptions
|
65
86
|
}
|
@@ -38,6 +38,8 @@ module OpenAI
|
|
38
38
|
OpenAI::Responses::ResponseReasoningSummaryPartDoneEvent,
|
39
39
|
OpenAI::Responses::ResponseReasoningSummaryTextDeltaEvent,
|
40
40
|
OpenAI::Responses::ResponseReasoningSummaryTextDoneEvent,
|
41
|
+
OpenAI::Responses::ResponseReasoningTextDeltaEvent,
|
42
|
+
OpenAI::Responses::ResponseReasoningTextDoneEvent,
|
41
43
|
OpenAI::Responses::ResponseRefusalDeltaEvent,
|
42
44
|
OpenAI::Responses::ResponseRefusalDoneEvent,
|
43
45
|
OpenAI::Responses::ResponseTextDeltaEvent,
|
@@ -59,8 +61,8 @@ module OpenAI
|
|
59
61
|
OpenAI::Responses::ResponseMcpListToolsInProgressEvent,
|
60
62
|
OpenAI::Responses::ResponseOutputTextAnnotationAddedEvent,
|
61
63
|
OpenAI::Responses::ResponseQueuedEvent,
|
62
|
-
OpenAI::Responses::
|
63
|
-
OpenAI::Responses::
|
64
|
+
OpenAI::Responses::ResponseCustomToolCallInputDeltaEvent,
|
65
|
+
OpenAI::Responses::ResponseCustomToolCallInputDoneEvent
|
64
66
|
)
|
65
67
|
end
|
66
68
|
|
@@ -50,6 +50,18 @@ module OpenAI
|
|
50
50
|
end
|
51
51
|
attr_writer :format_
|
52
52
|
|
53
|
+
# Constrains the verbosity of the model's response. Lower values will result in
|
54
|
+
# more concise responses, while higher values will result in more verbose
|
55
|
+
# responses. Currently supported values are `low`, `medium`, and `high`.
|
56
|
+
sig do
|
57
|
+
returns(
|
58
|
+
T.nilable(
|
59
|
+
OpenAI::Responses::ResponseTextConfig::Verbosity::OrSymbol
|
60
|
+
)
|
61
|
+
)
|
62
|
+
end
|
63
|
+
attr_accessor :verbosity
|
64
|
+
|
53
65
|
# Configuration options for a text response from the model. Can be plain text or
|
54
66
|
# structured JSON data. Learn more:
|
55
67
|
#
|
@@ -62,6 +74,10 @@ module OpenAI
|
|
62
74
|
OpenAI::ResponseFormatText::OrHash,
|
63
75
|
OpenAI::Responses::ResponseFormatTextJSONSchemaConfig::OrHash,
|
64
76
|
OpenAI::ResponseFormatJSONObject::OrHash
|
77
|
+
),
|
78
|
+
verbosity:
|
79
|
+
T.nilable(
|
80
|
+
OpenAI::Responses::ResponseTextConfig::Verbosity::OrSymbol
|
65
81
|
)
|
66
82
|
).returns(T.attached_class)
|
67
83
|
end
|
@@ -79,7 +95,11 @@ module OpenAI
|
|
79
95
|
# Setting to `{ "type": "json_object" }` enables the older JSON mode, which
|
80
96
|
# ensures the message the model generates is valid JSON. Using `json_schema` is
|
81
97
|
# preferred for models that support it.
|
82
|
-
format_: nil
|
98
|
+
format_: nil,
|
99
|
+
# Constrains the verbosity of the model's response. Lower values will result in
|
100
|
+
# more concise responses, while higher values will result in more verbose
|
101
|
+
# responses. Currently supported values are `low`, `medium`, and `high`.
|
102
|
+
verbosity: nil
|
83
103
|
)
|
84
104
|
end
|
85
105
|
|
@@ -91,12 +111,55 @@ module OpenAI
|
|
91
111
|
OpenAI::ResponseFormatText,
|
92
112
|
OpenAI::Responses::ResponseFormatTextJSONSchemaConfig,
|
93
113
|
OpenAI::ResponseFormatJSONObject
|
114
|
+
),
|
115
|
+
verbosity:
|
116
|
+
T.nilable(
|
117
|
+
OpenAI::Responses::ResponseTextConfig::Verbosity::OrSymbol
|
94
118
|
)
|
95
119
|
}
|
96
120
|
)
|
97
121
|
end
|
98
122
|
def to_hash
|
99
123
|
end
|
124
|
+
|
125
|
+
# Constrains the verbosity of the model's response. Lower values will result in
|
126
|
+
# more concise responses, while higher values will result in more verbose
|
127
|
+
# responses. Currently supported values are `low`, `medium`, and `high`.
|
128
|
+
module Verbosity
|
129
|
+
extend OpenAI::Internal::Type::Enum
|
130
|
+
|
131
|
+
TaggedSymbol =
|
132
|
+
T.type_alias do
|
133
|
+
T.all(Symbol, OpenAI::Responses::ResponseTextConfig::Verbosity)
|
134
|
+
end
|
135
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
136
|
+
|
137
|
+
LOW =
|
138
|
+
T.let(
|
139
|
+
:low,
|
140
|
+
OpenAI::Responses::ResponseTextConfig::Verbosity::TaggedSymbol
|
141
|
+
)
|
142
|
+
MEDIUM =
|
143
|
+
T.let(
|
144
|
+
:medium,
|
145
|
+
OpenAI::Responses::ResponseTextConfig::Verbosity::TaggedSymbol
|
146
|
+
)
|
147
|
+
HIGH =
|
148
|
+
T.let(
|
149
|
+
:high,
|
150
|
+
OpenAI::Responses::ResponseTextConfig::Verbosity::TaggedSymbol
|
151
|
+
)
|
152
|
+
|
153
|
+
sig do
|
154
|
+
override.returns(
|
155
|
+
T::Array[
|
156
|
+
OpenAI::Responses::ResponseTextConfig::Verbosity::TaggedSymbol
|
157
|
+
]
|
158
|
+
)
|
159
|
+
end
|
160
|
+
def self.values
|
161
|
+
end
|
162
|
+
end
|
100
163
|
end
|
101
164
|
end
|
102
165
|
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
class ToolChoiceAllowed < OpenAI::Internal::Type::BaseModel
|
7
|
+
OrHash =
|
8
|
+
T.type_alias do
|
9
|
+
T.any(
|
10
|
+
OpenAI::Responses::ToolChoiceAllowed,
|
11
|
+
OpenAI::Internal::AnyHash
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Constrains the tools available to the model to a pre-defined set.
|
16
|
+
#
|
17
|
+
# `auto` allows the model to pick from among the allowed tools and generate a
|
18
|
+
# message.
|
19
|
+
#
|
20
|
+
# `required` requires the model to call one or more of the allowed tools.
|
21
|
+
sig { returns(OpenAI::Responses::ToolChoiceAllowed::Mode::OrSymbol) }
|
22
|
+
attr_accessor :mode
|
23
|
+
|
24
|
+
# A list of tool definitions that the model should be allowed to call.
|
25
|
+
#
|
26
|
+
# For the Responses API, the list of tool definitions might look like:
|
27
|
+
#
|
28
|
+
# ```json
|
29
|
+
# [
|
30
|
+
# { "type": "function", "name": "get_weather" },
|
31
|
+
# { "type": "mcp", "server_label": "deepwiki" },
|
32
|
+
# { "type": "image_generation" }
|
33
|
+
# ]
|
34
|
+
# ```
|
35
|
+
sig { returns(T::Array[T::Hash[Symbol, T.anything]]) }
|
36
|
+
attr_accessor :tools
|
37
|
+
|
38
|
+
# Allowed tool configuration type. Always `allowed_tools`.
|
39
|
+
sig { returns(Symbol) }
|
40
|
+
attr_accessor :type
|
41
|
+
|
42
|
+
# Constrains the tools available to the model to a pre-defined set.
|
43
|
+
sig do
|
44
|
+
params(
|
45
|
+
mode: OpenAI::Responses::ToolChoiceAllowed::Mode::OrSymbol,
|
46
|
+
tools: T::Array[T::Hash[Symbol, T.anything]],
|
47
|
+
type: Symbol
|
48
|
+
).returns(T.attached_class)
|
49
|
+
end
|
50
|
+
def self.new(
|
51
|
+
# Constrains the tools available to the model to a pre-defined set.
|
52
|
+
#
|
53
|
+
# `auto` allows the model to pick from among the allowed tools and generate a
|
54
|
+
# message.
|
55
|
+
#
|
56
|
+
# `required` requires the model to call one or more of the allowed tools.
|
57
|
+
mode:,
|
58
|
+
# A list of tool definitions that the model should be allowed to call.
|
59
|
+
#
|
60
|
+
# For the Responses API, the list of tool definitions might look like:
|
61
|
+
#
|
62
|
+
# ```json
|
63
|
+
# [
|
64
|
+
# { "type": "function", "name": "get_weather" },
|
65
|
+
# { "type": "mcp", "server_label": "deepwiki" },
|
66
|
+
# { "type": "image_generation" }
|
67
|
+
# ]
|
68
|
+
# ```
|
69
|
+
tools:,
|
70
|
+
# Allowed tool configuration type. Always `allowed_tools`.
|
71
|
+
type: :allowed_tools
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
sig do
|
76
|
+
override.returns(
|
77
|
+
{
|
78
|
+
mode: OpenAI::Responses::ToolChoiceAllowed::Mode::OrSymbol,
|
79
|
+
tools: T::Array[T::Hash[Symbol, T.anything]],
|
80
|
+
type: Symbol
|
81
|
+
}
|
82
|
+
)
|
83
|
+
end
|
84
|
+
def to_hash
|
85
|
+
end
|
86
|
+
|
87
|
+
# Constrains the tools available to the model to a pre-defined set.
|
88
|
+
#
|
89
|
+
# `auto` allows the model to pick from among the allowed tools and generate a
|
90
|
+
# message.
|
91
|
+
#
|
92
|
+
# `required` requires the model to call one or more of the allowed tools.
|
93
|
+
module Mode
|
94
|
+
extend OpenAI::Internal::Type::Enum
|
95
|
+
|
96
|
+
TaggedSymbol =
|
97
|
+
T.type_alias do
|
98
|
+
T.all(Symbol, OpenAI::Responses::ToolChoiceAllowed::Mode)
|
99
|
+
end
|
100
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
101
|
+
|
102
|
+
AUTO =
|
103
|
+
T.let(
|
104
|
+
:auto,
|
105
|
+
OpenAI::Responses::ToolChoiceAllowed::Mode::TaggedSymbol
|
106
|
+
)
|
107
|
+
REQUIRED =
|
108
|
+
T.let(
|
109
|
+
:required,
|
110
|
+
OpenAI::Responses::ToolChoiceAllowed::Mode::TaggedSymbol
|
111
|
+
)
|
112
|
+
|
113
|
+
sig do
|
114
|
+
override.returns(
|
115
|
+
T::Array[OpenAI::Responses::ToolChoiceAllowed::Mode::TaggedSymbol]
|
116
|
+
)
|
117
|
+
end
|
118
|
+
def self.values
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
class ToolChoiceCustom < OpenAI::Internal::Type::BaseModel
|
7
|
+
OrHash =
|
8
|
+
T.type_alias do
|
9
|
+
T.any(
|
10
|
+
OpenAI::Responses::ToolChoiceCustom,
|
11
|
+
OpenAI::Internal::AnyHash
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
# The name of the custom tool to call.
|
16
|
+
sig { returns(String) }
|
17
|
+
attr_accessor :name
|
18
|
+
|
19
|
+
# For custom tool calling, the type is always `custom`.
|
20
|
+
sig { returns(Symbol) }
|
21
|
+
attr_accessor :type
|
22
|
+
|
23
|
+
# Use this option to force the model to call a specific custom tool.
|
24
|
+
sig { params(name: String, type: Symbol).returns(T.attached_class) }
|
25
|
+
def self.new(
|
26
|
+
# The name of the custom tool to call.
|
27
|
+
name:,
|
28
|
+
# For custom tool calling, the type is always `custom`.
|
29
|
+
type: :custom
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
sig { override.returns({ name: String, type: Symbol }) }
|
34
|
+
def to_hash
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|