openai 0.100.0 → 0.101.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 +7 -0
- data/README.md +1 -1
- data/lib/openai/client.rb +4 -0
- data/lib/openai/models/beta/beta_response_tool_search_output_item_param.rb +1166 -3
- data/lib/openai/models/beta/beta_tool_search_output_namespace_tool.rb +176 -0
- data/lib/openai/models/decision.rb +313 -0
- data/lib/openai/models/decision_create_params.rb +233 -0
- data/lib/openai/models/decision_input_image.rb +53 -0
- data/lib/openai/models/decision_input_message.rb +60 -0
- data/lib/openai/models/decision_input_part.rb +20 -0
- data/lib/openai/models/decision_input_text.rb +21 -0
- data/lib/openai/models/responses/response_tool_search_output_item_param.rb +1166 -3
- data/lib/openai/models/responses/tool_search_output_namespace_tool.rb +174 -0
- data/lib/openai/models.rb +12 -0
- data/lib/openai/resources/decisions.rb +59 -0
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +9 -0
- data/rbi/openai/client.rbi +3 -0
- data/rbi/openai/models/beta/beta_response_tool_search_output_item_param.rbi +1893 -18
- data/rbi/openai/models/beta/beta_tool_search_output_namespace_tool.rbi +272 -0
- data/rbi/openai/models/decision.rbi +586 -0
- data/rbi/openai/models/decision_create_params.rbi +435 -0
- data/rbi/openai/models/decision_input_image.rbi +81 -0
- data/rbi/openai/models/decision_input_message.rbi +96 -0
- data/rbi/openai/models/decision_input_part.rbi +24 -0
- data/rbi/openai/models/decision_input_text.rbi +49 -0
- data/rbi/openai/models/responses/response_tool_search_output_item_param.rbi +1901 -18
- data/rbi/openai/models/responses/tool_search_output_namespace_tool.rbi +272 -0
- data/rbi/openai/models.rbi +12 -0
- data/rbi/openai/resources/decisions.rbi +57 -0
- data/sig/openai/client.rbs +2 -0
- data/sig/openai/models/beta/beta_response_tool_search_output_item_param.rbs +993 -4
- data/sig/openai/models/beta/beta_tool_search_output_namespace_tool.rbs +162 -0
- data/sig/openai/models/decision.rbs +296 -0
- data/sig/openai/models/decision_create_params.rbs +227 -0
- data/sig/openai/models/decision_input_image.rbs +51 -0
- data/sig/openai/models/decision_input_message.rbs +57 -0
- data/sig/openai/models/decision_input_part.rbs +12 -0
- data/sig/openai/models/decision_input_text.rbs +15 -0
- data/sig/openai/models/responses/response_tool_search_output_item_param.rbs +993 -4
- data/sig/openai/models/responses/tool_search_output_namespace_tool.rbs +160 -0
- data/sig/openai/models.rbs +12 -0
- data/sig/openai/resources/decisions.rbs +15 -0
- metadata +28 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Responses
|
|
6
|
+
class ToolSearchOutputNamespaceTool < OpenAI::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute description
|
|
8
|
+
# A description of the namespace shown to the model.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :description, String
|
|
12
|
+
|
|
13
|
+
# @!attribute name
|
|
14
|
+
# The namespace name used in tool calls (for example, `crm`).
|
|
15
|
+
#
|
|
16
|
+
# @return [String]
|
|
17
|
+
required :name, String
|
|
18
|
+
|
|
19
|
+
# @!attribute tools
|
|
20
|
+
# The function/custom tools loaded inside this namespace.
|
|
21
|
+
#
|
|
22
|
+
# @return [Array<OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Responses::CustomTool>]
|
|
23
|
+
required(
|
|
24
|
+
:tools,
|
|
25
|
+
-> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool] }
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# @!attribute type
|
|
29
|
+
# The type of the tool. Always `namespace`.
|
|
30
|
+
#
|
|
31
|
+
# @return [Symbol, :namespace]
|
|
32
|
+
required :type, const: :namespace
|
|
33
|
+
|
|
34
|
+
# @!method initialize(description:, name:, tools:, type: :namespace)
|
|
35
|
+
# Groups function/custom tools under a shared namespace.
|
|
36
|
+
#
|
|
37
|
+
# @param description [String]
|
|
38
|
+
# A description of the namespace shown to the model.
|
|
39
|
+
#
|
|
40
|
+
# @param name [String]
|
|
41
|
+
# The namespace name used in tool calls (for example, `crm`).
|
|
42
|
+
#
|
|
43
|
+
# @param tools [Array<OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Responses::CustomTool>]
|
|
44
|
+
# The function/custom tools loaded inside this namespace.
|
|
45
|
+
#
|
|
46
|
+
# @param type [Symbol, :namespace]
|
|
47
|
+
# The type of the tool. Always `namespace`.
|
|
48
|
+
|
|
49
|
+
# A function or custom tool loaded into a namespace by tool search.
|
|
50
|
+
module Tool
|
|
51
|
+
extend OpenAI::Internal::Type::Union
|
|
52
|
+
|
|
53
|
+
discriminator :type
|
|
54
|
+
|
|
55
|
+
variant :function, -> { OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function }
|
|
56
|
+
|
|
57
|
+
# A custom tool that processes input using a specified format. Learn more about [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools)
|
|
58
|
+
variant :custom, -> { OpenAI::Responses::CustomTool }
|
|
59
|
+
|
|
60
|
+
class Function < OpenAI::Internal::Type::BaseModel
|
|
61
|
+
# @!attribute name
|
|
62
|
+
# The name of the loaded function tool.
|
|
63
|
+
#
|
|
64
|
+
# @return [String]
|
|
65
|
+
required :name, String
|
|
66
|
+
|
|
67
|
+
# @!attribute type
|
|
68
|
+
#
|
|
69
|
+
# @return [Symbol, :function]
|
|
70
|
+
required :type, const: :function
|
|
71
|
+
|
|
72
|
+
# @!attribute allowed_callers
|
|
73
|
+
# The tool invocation context(s).
|
|
74
|
+
#
|
|
75
|
+
# @return [Array<Symbol, OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller>, nil]
|
|
76
|
+
optional(
|
|
77
|
+
:allowed_callers,
|
|
78
|
+
-> {
|
|
79
|
+
OpenAI::Internal::Type::ArrayOf[
|
|
80
|
+
enum: OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
nil?: true
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# @!attribute async
|
|
87
|
+
# Whether the tool response can be returned asynchronously versus immediately
|
|
88
|
+
# returned on next response creation.
|
|
89
|
+
#
|
|
90
|
+
# @return [Boolean, nil]
|
|
91
|
+
optional :async, OpenAI::Internal::Type::Boolean
|
|
92
|
+
|
|
93
|
+
# @!attribute defer_loading
|
|
94
|
+
# Whether this function should be deferred and discovered via tool search.
|
|
95
|
+
#
|
|
96
|
+
# @return [Boolean, nil]
|
|
97
|
+
optional :defer_loading, OpenAI::Internal::Type::Boolean
|
|
98
|
+
|
|
99
|
+
# @!attribute description
|
|
100
|
+
#
|
|
101
|
+
# @return [String, nil]
|
|
102
|
+
optional :description, String, nil?: true
|
|
103
|
+
|
|
104
|
+
# @!attribute output_schema
|
|
105
|
+
# A JSON Schema describing the JSON value encoded in string outputs for this
|
|
106
|
+
# function tool. This does not describe content-array outputs.
|
|
107
|
+
#
|
|
108
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
109
|
+
optional(
|
|
110
|
+
:output_schema,
|
|
111
|
+
OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown],
|
|
112
|
+
nil?: true
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# @!attribute parameters
|
|
116
|
+
#
|
|
117
|
+
# @return [Object, nil]
|
|
118
|
+
optional :parameters, OpenAI::Internal::Type::Unknown, nil?: true
|
|
119
|
+
|
|
120
|
+
# @!attribute strict
|
|
121
|
+
# Whether to enforce strict parameter validation. If omitted, Responses attempts
|
|
122
|
+
# to use strict validation when the schema is compatible, and falls back to
|
|
123
|
+
# non-strict validation otherwise.
|
|
124
|
+
#
|
|
125
|
+
# @return [Boolean, nil]
|
|
126
|
+
optional :strict, OpenAI::Internal::Type::Boolean, nil?: true
|
|
127
|
+
|
|
128
|
+
# @!method initialize(name:, allowed_callers: nil, async: nil, defer_loading: nil, description: nil, output_schema: nil, parameters: nil, strict: nil, type: :function)
|
|
129
|
+
# @param name [String]
|
|
130
|
+
# The name of the loaded function tool.
|
|
131
|
+
#
|
|
132
|
+
# @param allowed_callers [Array<Symbol, OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller>, nil]
|
|
133
|
+
# The tool invocation context(s).
|
|
134
|
+
#
|
|
135
|
+
# @param async [Boolean]
|
|
136
|
+
# Whether the tool response can be returned asynchronously versus immediately
|
|
137
|
+
# returned on next response creation.
|
|
138
|
+
#
|
|
139
|
+
# @param defer_loading [Boolean]
|
|
140
|
+
# Whether this function should be deferred and discovered via tool search.
|
|
141
|
+
#
|
|
142
|
+
# @param description [String, nil]
|
|
143
|
+
#
|
|
144
|
+
# @param output_schema [Hash{Symbol=>Object}, nil]
|
|
145
|
+
# A JSON Schema describing the JSON value encoded in string outputs for this
|
|
146
|
+
# function tool. This does not describe content-array outputs.
|
|
147
|
+
#
|
|
148
|
+
# @param parameters [Object, nil]
|
|
149
|
+
#
|
|
150
|
+
# @param strict [Boolean, nil]
|
|
151
|
+
# Whether to enforce strict parameter validation. If omitted, Responses attempts
|
|
152
|
+
# to use strict validation when the schema is compatible, and falls back to
|
|
153
|
+
# non-strict validation otherwise.
|
|
154
|
+
#
|
|
155
|
+
# @param type [Symbol, :function]
|
|
156
|
+
|
|
157
|
+
module AllowedCaller
|
|
158
|
+
extend OpenAI::Internal::Type::Enum
|
|
159
|
+
|
|
160
|
+
DIRECT = :direct
|
|
161
|
+
PROGRAMMATIC = :programmatic
|
|
162
|
+
|
|
163
|
+
# @!method self.values
|
|
164
|
+
# @return [Array<Symbol>]
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# @!method self.variants
|
|
169
|
+
# @return [Array(OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Responses::CustomTool)]
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
data/lib/openai/models.rb
CHANGED
|
@@ -113,6 +113,18 @@ module OpenAI
|
|
|
113
113
|
|
|
114
114
|
CustomToolInputFormat = OpenAI::Models::CustomToolInputFormat
|
|
115
115
|
|
|
116
|
+
Decision = OpenAI::Models::Decision
|
|
117
|
+
|
|
118
|
+
DecisionCreateParams = OpenAI::Models::DecisionCreateParams
|
|
119
|
+
|
|
120
|
+
DecisionInputImage = OpenAI::Models::DecisionInputImage
|
|
121
|
+
|
|
122
|
+
DecisionInputMessage = OpenAI::Models::DecisionInputMessage
|
|
123
|
+
|
|
124
|
+
DecisionInputPart = OpenAI::Models::DecisionInputPart
|
|
125
|
+
|
|
126
|
+
DecisionInputText = OpenAI::Models::DecisionInputText
|
|
127
|
+
|
|
116
128
|
DeletedSkill = OpenAI::Models::DeletedSkill
|
|
117
129
|
|
|
118
130
|
Embedding = OpenAI::Models::Embedding
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Resources
|
|
5
|
+
class Decisions
|
|
6
|
+
# Evaluate ordered classification and scoring questions against shared input.
|
|
7
|
+
# Answers are returned in question order.
|
|
8
|
+
#
|
|
9
|
+
# Supply input as a string or user messages containing text and inline images.
|
|
10
|
+
# Only user messages with `input_text` and `input_image` parts are supported;
|
|
11
|
+
# non-user roles, function calls, files, audio, and item references are not
|
|
12
|
+
# supported. Images require a data URL, not an external URL or file ID. At most
|
|
13
|
+
# 128 images are allowed across the request.
|
|
14
|
+
#
|
|
15
|
+
# Each question can return a refusal instead of a scored answer. A refusal has
|
|
16
|
+
# type `refusal` and the corresponding question name, or null if unnamed.
|
|
17
|
+
#
|
|
18
|
+
# @overload create(input:, model:, questions:, safety_identifier: nil, request_options: {})
|
|
19
|
+
#
|
|
20
|
+
# @param input [String, Array<OpenAI::Models::DecisionInputMessage>]
|
|
21
|
+
# Shared evidence, as a string or an array of user messages containing text and
|
|
22
|
+
# inline images. Non-user roles, function calls, function-call outputs, files,
|
|
23
|
+
# audio, and item references are not supported. At most 128 image parts are
|
|
24
|
+
# allowed across all messages in one request.
|
|
25
|
+
#
|
|
26
|
+
# @param model [String]
|
|
27
|
+
#
|
|
28
|
+
# @param questions [Array<OpenAI::Models::DecisionCreateParams::Question::Predicate, OpenAI::Models::DecisionCreateParams::Question::Choice, OpenAI::Models::DecisionCreateParams::Question::Score>]
|
|
29
|
+
#
|
|
30
|
+
# @param safety_identifier [String, nil]
|
|
31
|
+
# Opaque caller-provided end-user identifier, scoped by the verified org. Match
|
|
32
|
+
# Responses' limit; this is never the authenticated user identity.
|
|
33
|
+
#
|
|
34
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
35
|
+
#
|
|
36
|
+
# @return [OpenAI::Models::Decision]
|
|
37
|
+
#
|
|
38
|
+
# @see OpenAI::Models::DecisionCreateParams
|
|
39
|
+
def create(params)
|
|
40
|
+
parsed, options = OpenAI::DecisionCreateParams.dump_request(params)
|
|
41
|
+
@client.request(
|
|
42
|
+
method: :post,
|
|
43
|
+
path: "decisions",
|
|
44
|
+
body: parsed,
|
|
45
|
+
model: OpenAI::Decision,
|
|
46
|
+
security: {bearer_auth: true},
|
|
47
|
+
options: options
|
|
48
|
+
)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @api private
|
|
52
|
+
#
|
|
53
|
+
# @param client [OpenAI::Client]
|
|
54
|
+
def initialize(client:)
|
|
55
|
+
@client = client
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/openai/version.rb
CHANGED
data/lib/openai.rb
CHANGED
|
@@ -719,6 +719,7 @@ require_relative "openai/models/beta/beta_tool_choice_mcp"
|
|
|
719
719
|
require_relative "openai/models/beta/beta_tool_choice_options"
|
|
720
720
|
require_relative "openai/models/beta/beta_tool_choice_shell"
|
|
721
721
|
require_relative "openai/models/beta/beta_tool_choice_types"
|
|
722
|
+
require_relative "openai/models/beta/beta_tool_search_output_namespace_tool"
|
|
722
723
|
require_relative "openai/models/beta/beta_tool_search_tool"
|
|
723
724
|
require_relative "openai/models/beta/beta_web_search_preview_tool"
|
|
724
725
|
require_relative "openai/models/beta/beta_web_search_tool"
|
|
@@ -954,6 +955,12 @@ require_relative "openai/models/conversations/summary_text_content"
|
|
|
954
955
|
require_relative "openai/models/conversations/text_content"
|
|
955
956
|
require_relative "openai/models/create_embedding_response"
|
|
956
957
|
require_relative "openai/models/custom_tool_input_format"
|
|
958
|
+
require_relative "openai/models/decision"
|
|
959
|
+
require_relative "openai/models/decision_create_params"
|
|
960
|
+
require_relative "openai/models/decision_input_image"
|
|
961
|
+
require_relative "openai/models/decision_input_message"
|
|
962
|
+
require_relative "openai/models/decision_input_part"
|
|
963
|
+
require_relative "openai/models/decision_input_text"
|
|
957
964
|
require_relative "openai/models/deleted_skill"
|
|
958
965
|
require_relative "openai/models/embedding"
|
|
959
966
|
require_relative "openai/models/embedding_create_params"
|
|
@@ -1364,6 +1371,7 @@ require_relative "openai/models/responses/tool_choice_mcp"
|
|
|
1364
1371
|
require_relative "openai/models/responses/tool_choice_options"
|
|
1365
1372
|
require_relative "openai/models/responses/tool_choice_shell"
|
|
1366
1373
|
require_relative "openai/models/responses/tool_choice_types"
|
|
1374
|
+
require_relative "openai/models/responses/tool_search_output_namespace_tool"
|
|
1367
1375
|
require_relative "openai/models/responses/tool_search_tool"
|
|
1368
1376
|
require_relative "openai/models/responses/web_search_preview_tool"
|
|
1369
1377
|
require_relative "openai/models/responses/web_search_tool"
|
|
@@ -1559,6 +1567,7 @@ require_relative "openai/resources/containers/files/content"
|
|
|
1559
1567
|
require_relative "openai/resources/content_provenance_checks"
|
|
1560
1568
|
require_relative "openai/resources/conversations"
|
|
1561
1569
|
require_relative "openai/resources/conversations/items"
|
|
1570
|
+
require_relative "openai/resources/decisions"
|
|
1562
1571
|
require_relative "openai/resources/embeddings"
|
|
1563
1572
|
require_relative "openai/resources/evals"
|
|
1564
1573
|
require_relative "openai/resources/evals/runs"
|
data/rbi/openai/client.rbi
CHANGED
|
@@ -29,6 +29,9 @@ module OpenAI
|
|
|
29
29
|
sig { returns(T.nilable(String)) }
|
|
30
30
|
attr_reader :webhook_secret
|
|
31
31
|
|
|
32
|
+
sig { returns(OpenAI::Resources::Decisions) }
|
|
33
|
+
attr_reader :decisions
|
|
34
|
+
|
|
32
35
|
# Given a prompt, the model will return one or more predicted completions, and can
|
|
33
36
|
# also return the probabilities of alternative tokens at each position.
|
|
34
37
|
sig { returns(OpenAI::Resources::Completions) }
|