openai 0.15.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 +47 -0
- data/README.md +14 -20
- data/lib/openai/helpers/structured_output/json_schema_converter.rb +20 -21
- data/lib/openai/helpers/structured_output/union_of.rb +11 -1
- 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_store_message.rb +32 -1
- 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 +65 -16
- 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 +70 -16
- data/lib/openai/models/responses/response_create_params.rb +78 -14
- 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 +26 -12
- data/lib/openai/resources/responses.rb +77 -36
- 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_store_message.rbi +68 -3
- 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 +150 -31
- 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 +59 -11
- data/rbi/openai/models/responses/response_create_params.rbi +138 -13
- 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 +78 -25
- data/rbi/openai/resources/responses.rbi +249 -47
- 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_store_message.rbs +29 -3
- 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 +37 -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 +16 -0
- data/sig/openai/models/responses/response_create_params.rbs +33 -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 +8 -2
- data/sig/openai/resources/responses.rbs +36 -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
@@ -1176,6 +1176,7 @@ module OpenAI
|
|
1176
1176
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1177
1177
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1178
1178
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1179
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1179
1180
|
OpenAI::Responses::WebSearchTool::OrHash
|
1180
1181
|
)
|
1181
1182
|
]
|
@@ -1207,6 +1208,7 @@ module OpenAI
|
|
1207
1208
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
1208
1209
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
1209
1210
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
1211
|
+
OpenAI::Responses::CustomTool::OrHash,
|
1210
1212
|
OpenAI::Responses::WebSearchTool::OrHash
|
1211
1213
|
)
|
1212
1214
|
],
|
@@ -6,12 +6,11 @@ module OpenAI
|
|
6
6
|
OrHash =
|
7
7
|
T.type_alias { T.any(OpenAI::Reasoning, OpenAI::Internal::AnyHash) }
|
8
8
|
|
9
|
-
# **o-series models only**
|
10
|
-
#
|
11
9
|
# Constrains effort on reasoning for
|
12
10
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
13
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
14
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
11
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
12
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
13
|
+
# response.
|
15
14
|
sig { returns(T.nilable(OpenAI::ReasoningEffort::OrSymbol)) }
|
16
15
|
attr_accessor :effort
|
17
16
|
|
@@ -42,12 +41,11 @@ module OpenAI
|
|
42
41
|
).returns(T.attached_class)
|
43
42
|
end
|
44
43
|
def self.new(
|
45
|
-
# **o-series models only**
|
46
|
-
#
|
47
44
|
# Constrains effort on reasoning for
|
48
45
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
49
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
50
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
46
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
47
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
48
|
+
# response.
|
51
49
|
effort: nil,
|
52
50
|
# **Deprecated:** use `summary` instead.
|
53
51
|
#
|
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
module OpenAI
|
4
4
|
module Models
|
5
|
-
# **o-series models only**
|
6
|
-
#
|
7
5
|
# Constrains effort on reasoning for
|
8
6
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
9
|
-
# supported values are `low`, `medium`, and `high`. Reducing reasoning
|
10
|
-
# result in faster responses and fewer tokens used on reasoning in a
|
7
|
+
# supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
8
|
+
# effort can result in faster responses and fewer tokens used on reasoning in a
|
9
|
+
# response.
|
11
10
|
module ReasoningEffort
|
12
11
|
extend OpenAI::Internal::Type::Enum
|
13
12
|
|
14
13
|
TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::ReasoningEffort) }
|
15
14
|
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
16
15
|
|
16
|
+
MINIMAL = T.let(:minimal, OpenAI::ReasoningEffort::TaggedSymbol)
|
17
17
|
LOW = T.let(:low, OpenAI::ReasoningEffort::TaggedSymbol)
|
18
18
|
MEDIUM = T.let(:medium, OpenAI::ReasoningEffort::TaggedSymbol)
|
19
19
|
HIGH = T.let(:high, OpenAI::ReasoningEffort::TaggedSymbol)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
class ResponseFormatTextGrammar < OpenAI::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(OpenAI::ResponseFormatTextGrammar, OpenAI::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# The custom grammar for the model to follow.
|
12
|
+
sig { returns(String) }
|
13
|
+
attr_accessor :grammar
|
14
|
+
|
15
|
+
# The type of response format being defined. Always `grammar`.
|
16
|
+
sig { returns(Symbol) }
|
17
|
+
attr_accessor :type
|
18
|
+
|
19
|
+
# A custom grammar for the model to follow when generating text. Learn more in the
|
20
|
+
# [custom grammars guide](https://platform.openai.com/docs/guides/custom-grammars).
|
21
|
+
sig { params(grammar: String, type: Symbol).returns(T.attached_class) }
|
22
|
+
def self.new(
|
23
|
+
# The custom grammar for the model to follow.
|
24
|
+
grammar:,
|
25
|
+
# The type of response format being defined. Always `grammar`.
|
26
|
+
type: :grammar
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
sig { override.returns({ grammar: String, type: Symbol }) }
|
31
|
+
def to_hash
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
class ResponseFormatTextPython < OpenAI::Internal::Type::BaseModel
|
6
|
+
OrHash =
|
7
|
+
T.type_alias do
|
8
|
+
T.any(OpenAI::ResponseFormatTextPython, OpenAI::Internal::AnyHash)
|
9
|
+
end
|
10
|
+
|
11
|
+
# The type of response format being defined. Always `python`.
|
12
|
+
sig { returns(Symbol) }
|
13
|
+
attr_accessor :type
|
14
|
+
|
15
|
+
# Configure the model to generate valid Python code. See the
|
16
|
+
# [custom grammars guide](https://platform.openai.com/docs/guides/custom-grammars)
|
17
|
+
# for more details.
|
18
|
+
sig { params(type: Symbol).returns(T.attached_class) }
|
19
|
+
def self.new(
|
20
|
+
# The type of response format being defined. Always `python`.
|
21
|
+
type: :python
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
sig { override.returns({ type: Symbol }) }
|
26
|
+
def to_hash
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module OpenAI
|
4
|
+
module Models
|
5
|
+
module Responses
|
6
|
+
class CustomTool < OpenAI::Internal::Type::BaseModel
|
7
|
+
OrHash =
|
8
|
+
T.type_alias do
|
9
|
+
T.any(OpenAI::Responses::CustomTool, OpenAI::Internal::AnyHash)
|
10
|
+
end
|
11
|
+
|
12
|
+
# The name of the custom tool, used to identify it in tool calls.
|
13
|
+
sig { returns(String) }
|
14
|
+
attr_accessor :name
|
15
|
+
|
16
|
+
# The type of the custom tool. Always `custom`.
|
17
|
+
sig { returns(Symbol) }
|
18
|
+
attr_accessor :type
|
19
|
+
|
20
|
+
# Optional description of the custom tool, used to provide more context.
|
21
|
+
sig { returns(T.nilable(String)) }
|
22
|
+
attr_reader :description
|
23
|
+
|
24
|
+
sig { params(description: String).void }
|
25
|
+
attr_writer :description
|
26
|
+
|
27
|
+
# The input format for the custom tool. Default is unconstrained text.
|
28
|
+
sig do
|
29
|
+
returns(
|
30
|
+
T.nilable(
|
31
|
+
T.any(
|
32
|
+
OpenAI::CustomToolInputFormat::Text,
|
33
|
+
OpenAI::CustomToolInputFormat::Grammar
|
34
|
+
)
|
35
|
+
)
|
36
|
+
)
|
37
|
+
end
|
38
|
+
attr_reader :format_
|
39
|
+
|
40
|
+
sig do
|
41
|
+
params(
|
42
|
+
format_:
|
43
|
+
T.any(
|
44
|
+
OpenAI::CustomToolInputFormat::Text::OrHash,
|
45
|
+
OpenAI::CustomToolInputFormat::Grammar::OrHash
|
46
|
+
)
|
47
|
+
).void
|
48
|
+
end
|
49
|
+
attr_writer :format_
|
50
|
+
|
51
|
+
# A custom tool that processes input using a specified format. Learn more about
|
52
|
+
# [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools).
|
53
|
+
sig do
|
54
|
+
params(
|
55
|
+
name: String,
|
56
|
+
description: String,
|
57
|
+
format_:
|
58
|
+
T.any(
|
59
|
+
OpenAI::CustomToolInputFormat::Text::OrHash,
|
60
|
+
OpenAI::CustomToolInputFormat::Grammar::OrHash
|
61
|
+
),
|
62
|
+
type: Symbol
|
63
|
+
).returns(T.attached_class)
|
64
|
+
end
|
65
|
+
def self.new(
|
66
|
+
# The name of the custom tool, used to identify it in tool calls.
|
67
|
+
name:,
|
68
|
+
# Optional description of the custom tool, used to provide more context.
|
69
|
+
description: nil,
|
70
|
+
# The input format for the custom tool. Default is unconstrained text.
|
71
|
+
format_: nil,
|
72
|
+
# The type of the custom tool. Always `custom`.
|
73
|
+
type: :custom
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
sig do
|
78
|
+
override.returns(
|
79
|
+
{
|
80
|
+
name: String,
|
81
|
+
type: Symbol,
|
82
|
+
description: String,
|
83
|
+
format_:
|
84
|
+
T.any(
|
85
|
+
OpenAI::CustomToolInputFormat::Text,
|
86
|
+
OpenAI::CustomToolInputFormat::Grammar
|
87
|
+
)
|
88
|
+
}
|
89
|
+
)
|
90
|
+
end
|
91
|
+
def to_hash
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -116,8 +116,10 @@ module OpenAI
|
|
116
116
|
# Learn more about
|
117
117
|
# [built-in tools](https://platform.openai.com/docs/guides/tools).
|
118
118
|
# - **Function calls (custom tools)**: Functions that are defined by you, enabling
|
119
|
-
# the model to call your own code
|
119
|
+
# the model to call your own code with strongly typed arguments and outputs.
|
120
|
+
# Learn more about
|
120
121
|
# [function calling](https://platform.openai.com/docs/guides/function-calling).
|
122
|
+
# You can also use custom tools to call your own code.
|
121
123
|
sig { returns(T::Array[OpenAI::Responses::Tool::Variants]) }
|
122
124
|
attr_accessor :tools
|
123
125
|
|
@@ -165,6 +167,15 @@ module OpenAI
|
|
165
167
|
end
|
166
168
|
attr_writer :prompt
|
167
169
|
|
170
|
+
# Used by OpenAI to cache responses for similar requests to optimize your cache
|
171
|
+
# hit rates. Replaces the `user` field.
|
172
|
+
# [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
173
|
+
sig { returns(T.nilable(String)) }
|
174
|
+
attr_reader :prompt_cache_key
|
175
|
+
|
176
|
+
sig { params(prompt_cache_key: String).void }
|
177
|
+
attr_writer :prompt_cache_key
|
178
|
+
|
168
179
|
# **o-series models only**
|
169
180
|
#
|
170
181
|
# Configuration options for
|
@@ -175,6 +186,17 @@ module OpenAI
|
|
175
186
|
sig { params(reasoning: T.nilable(OpenAI::Reasoning::OrHash)).void }
|
176
187
|
attr_writer :reasoning
|
177
188
|
|
189
|
+
# A stable identifier used to help detect users of your application that may be
|
190
|
+
# violating OpenAI's usage policies. The IDs should be a string that uniquely
|
191
|
+
# identifies each user. We recommend hashing their username or email address, in
|
192
|
+
# order to avoid sending us any identifying information.
|
193
|
+
# [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
194
|
+
sig { returns(T.nilable(String)) }
|
195
|
+
attr_reader :safety_identifier
|
196
|
+
|
197
|
+
sig { params(safety_identifier: String).void }
|
198
|
+
attr_writer :safety_identifier
|
199
|
+
|
178
200
|
# Specifies the processing type used for serving the request.
|
179
201
|
#
|
180
202
|
# - If set to 'auto', then the request will be processed with the service tier
|
@@ -247,9 +269,11 @@ module OpenAI
|
|
247
269
|
sig { params(usage: OpenAI::Responses::ResponseUsage::OrHash).void }
|
248
270
|
attr_writer :usage
|
249
271
|
|
250
|
-
#
|
251
|
-
#
|
252
|
-
#
|
272
|
+
# This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
|
273
|
+
# `prompt_cache_key` instead to maintain caching optimizations. A stable
|
274
|
+
# identifier for your end-users. Used to boost cache hit rates by better bucketing
|
275
|
+
# similar requests and to help OpenAI detect and prevent abuse.
|
276
|
+
# [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
253
277
|
sig { returns(T.nilable(String)) }
|
254
278
|
attr_reader :user
|
255
279
|
|
@@ -286,7 +310,8 @@ module OpenAI
|
|
286
310
|
OpenAI::Responses::ResponseOutputItem::LocalShellCall::OrHash,
|
287
311
|
OpenAI::Responses::ResponseOutputItem::McpCall::OrHash,
|
288
312
|
OpenAI::Responses::ResponseOutputItem::McpListTools::OrHash,
|
289
|
-
OpenAI::Responses::ResponseOutputItem::McpApprovalRequest::OrHash
|
313
|
+
OpenAI::Responses::ResponseOutputItem::McpApprovalRequest::OrHash,
|
314
|
+
OpenAI::Responses::ResponseCustomToolCall::OrHash
|
290
315
|
)
|
291
316
|
],
|
292
317
|
parallel_tool_calls: T::Boolean,
|
@@ -294,9 +319,11 @@ module OpenAI
|
|
294
319
|
tool_choice:
|
295
320
|
T.any(
|
296
321
|
OpenAI::Responses::ToolChoiceOptions::OrSymbol,
|
322
|
+
OpenAI::Responses::ToolChoiceAllowed::OrHash,
|
297
323
|
OpenAI::Responses::ToolChoiceTypes::OrHash,
|
298
324
|
OpenAI::Responses::ToolChoiceFunction::OrHash,
|
299
|
-
OpenAI::Responses::ToolChoiceMcp::OrHash
|
325
|
+
OpenAI::Responses::ToolChoiceMcp::OrHash,
|
326
|
+
OpenAI::Responses::ToolChoiceCustom::OrHash
|
300
327
|
),
|
301
328
|
tools:
|
302
329
|
T::Array[
|
@@ -308,6 +335,7 @@ module OpenAI
|
|
308
335
|
OpenAI::Responses::Tool::CodeInterpreter::OrHash,
|
309
336
|
OpenAI::Responses::Tool::ImageGeneration::OrHash,
|
310
337
|
OpenAI::Responses::Tool::LocalShell::OrHash,
|
338
|
+
OpenAI::Responses::CustomTool::OrHash,
|
311
339
|
OpenAI::Responses::WebSearchTool::OrHash
|
312
340
|
)
|
313
341
|
],
|
@@ -317,7 +345,9 @@ module OpenAI
|
|
317
345
|
max_tool_calls: T.nilable(Integer),
|
318
346
|
previous_response_id: T.nilable(String),
|
319
347
|
prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
|
348
|
+
prompt_cache_key: String,
|
320
349
|
reasoning: T.nilable(OpenAI::Reasoning::OrHash),
|
350
|
+
safety_identifier: String,
|
321
351
|
service_tier:
|
322
352
|
T.nilable(OpenAI::Responses::Response::ServiceTier::OrSymbol),
|
323
353
|
status: OpenAI::Responses::ResponseStatus::OrSymbol,
|
@@ -389,8 +419,10 @@ module OpenAI
|
|
389
419
|
# Learn more about
|
390
420
|
# [built-in tools](https://platform.openai.com/docs/guides/tools).
|
391
421
|
# - **Function calls (custom tools)**: Functions that are defined by you, enabling
|
392
|
-
# the model to call your own code
|
422
|
+
# the model to call your own code with strongly typed arguments and outputs.
|
423
|
+
# Learn more about
|
393
424
|
# [function calling](https://platform.openai.com/docs/guides/function-calling).
|
425
|
+
# You can also use custom tools to call your own code.
|
394
426
|
tools:,
|
395
427
|
# An alternative to sampling with temperature, called nucleus sampling, where the
|
396
428
|
# model considers the results of the tokens with top_p probability mass. So 0.1
|
@@ -417,11 +449,21 @@ module OpenAI
|
|
417
449
|
# Reference to a prompt template and its variables.
|
418
450
|
# [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
|
419
451
|
prompt: nil,
|
452
|
+
# Used by OpenAI to cache responses for similar requests to optimize your cache
|
453
|
+
# hit rates. Replaces the `user` field.
|
454
|
+
# [Learn more](https://platform.openai.com/docs/guides/prompt-caching).
|
455
|
+
prompt_cache_key: nil,
|
420
456
|
# **o-series models only**
|
421
457
|
#
|
422
458
|
# Configuration options for
|
423
459
|
# [reasoning models](https://platform.openai.com/docs/guides/reasoning).
|
424
460
|
reasoning: nil,
|
461
|
+
# A stable identifier used to help detect users of your application that may be
|
462
|
+
# violating OpenAI's usage policies. The IDs should be a string that uniquely
|
463
|
+
# identifies each user. We recommend hashing their username or email address, in
|
464
|
+
# order to avoid sending us any identifying information.
|
465
|
+
# [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
466
|
+
safety_identifier: nil,
|
425
467
|
# Specifies the processing type used for serving the request.
|
426
468
|
#
|
427
469
|
# - If set to 'auto', then the request will be processed with the service tier
|
@@ -463,9 +505,11 @@ module OpenAI
|
|
463
505
|
# Represents token usage details including input tokens, output tokens, a
|
464
506
|
# breakdown of output tokens, and the total tokens used.
|
465
507
|
usage: nil,
|
466
|
-
#
|
467
|
-
#
|
468
|
-
#
|
508
|
+
# This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use
|
509
|
+
# `prompt_cache_key` instead to maintain caching optimizations. A stable
|
510
|
+
# identifier for your end-users. Used to boost cache hit rates by better bucketing
|
511
|
+
# similar requests and to help OpenAI detect and prevent abuse.
|
512
|
+
# [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
|
469
513
|
user: nil,
|
470
514
|
# The object type of this resource - always set to `response`.
|
471
515
|
object: :response
|
@@ -496,7 +540,9 @@ module OpenAI
|
|
496
540
|
max_tool_calls: T.nilable(Integer),
|
497
541
|
previous_response_id: T.nilable(String),
|
498
542
|
prompt: T.nilable(OpenAI::Responses::ResponsePrompt),
|
543
|
+
prompt_cache_key: String,
|
499
544
|
reasoning: T.nilable(OpenAI::Reasoning),
|
545
|
+
safety_identifier: String,
|
500
546
|
service_tier:
|
501
547
|
T.nilable(
|
502
548
|
OpenAI::Responses::Response::ServiceTier::TaggedSymbol
|
@@ -646,9 +692,11 @@ module OpenAI
|
|
646
692
|
T.type_alias do
|
647
693
|
T.any(
|
648
694
|
OpenAI::Responses::ToolChoiceOptions::TaggedSymbol,
|
695
|
+
OpenAI::Responses::ToolChoiceAllowed,
|
649
696
|
OpenAI::Responses::ToolChoiceTypes,
|
650
697
|
OpenAI::Responses::ToolChoiceFunction,
|
651
|
-
OpenAI::Responses::ToolChoiceMcp
|
698
|
+
OpenAI::Responses::ToolChoiceMcp,
|
699
|
+
OpenAI::Responses::ToolChoiceCustom
|
652
700
|
)
|
653
701
|
end
|
654
702
|
|