anthropic 1.16.3 → 1.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 +18 -0
- data/README.md +38 -10
- data/lib/anthropic/helpers/messages.rb +86 -1
- data/lib/anthropic/helpers/streaming/message_stream.rb +54 -29
- data/lib/anthropic/models/beta/beta_code_execution_tool_20250522.rb +2 -1
- data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +2 -1
- data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +2 -1
- data/lib/anthropic/models/beta/beta_output_config.rb +22 -4
- data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +25 -25
- data/lib/anthropic/models/beta/beta_tool.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_computer_use_20251124.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_text_editor_20250429.rb +2 -1
- data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +2 -1
- data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +2 -1
- data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +2 -1
- data/lib/anthropic/models/beta/beta_web_search_tool_result_error_code.rb +1 -0
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +10 -5
- data/lib/anthropic/models/beta/message_create_params.rb +10 -5
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +10 -5
- data/lib/anthropic/models/json_output_format.rb +23 -0
- data/lib/anthropic/models/message.rb +12 -0
- data/lib/anthropic/models/message_count_tokens_params.rb +9 -1
- data/lib/anthropic/models/message_create_params.rb +9 -1
- data/lib/anthropic/models/messages/batch_create_params.rb +9 -1
- data/lib/anthropic/models/model.rb +6 -0
- data/lib/anthropic/models/output_config.rb +20 -0
- data/lib/anthropic/models/text_block.rb +8 -0
- data/lib/anthropic/models/tool.rb +9 -1
- data/lib/anthropic/models/tool_bash_20250124.rb +9 -1
- data/lib/anthropic/models/tool_text_editor_20250124.rb +9 -1
- data/lib/anthropic/models/tool_text_editor_20250429.rb +9 -1
- data/lib/anthropic/models/tool_text_editor_20250728.rb +9 -1
- data/lib/anthropic/models/web_search_tool_20250305.rb +9 -1
- data/lib/anthropic/models/web_search_tool_request_error.rb +1 -0
- data/lib/anthropic/models/web_search_tool_result_error.rb +1 -0
- data/lib/anthropic/models.rb +4 -0
- data/lib/anthropic/resources/beta/messages.rb +26 -14
- data/lib/anthropic/resources/messages.rb +15 -4
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +2 -0
- data/rbi/anthropic/models/beta/beta_code_execution_tool_20250522.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_output_config.rbi +32 -6
- data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +48 -36
- data/rbi/anthropic/models/beta/beta_tool.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_bash_20241022.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_bash_20250124.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_computer_use_20241022.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_computer_use_20250124.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_computer_use_20251124.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20250429.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_20250305.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_web_search_tool_result_error_code.rbi +5 -0
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +12 -6
- data/rbi/anthropic/models/beta/message_create_params.rbi +12 -6
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +12 -6
- data/rbi/anthropic/models/json_output_format.rbi +37 -0
- data/rbi/anthropic/models/message.rbi +5 -0
- data/rbi/anthropic/models/message_count_tokens_params.rbi +11 -0
- data/rbi/anthropic/models/message_create_params.rbi +11 -0
- data/rbi/anthropic/models/messages/batch_create_params.rbi +11 -0
- data/rbi/anthropic/models/output_config.rbi +40 -0
- data/rbi/anthropic/models/tool.rbi +11 -0
- data/rbi/anthropic/models/tool_bash_20250124.rbi +12 -1
- data/rbi/anthropic/models/tool_text_editor_20250124.rbi +12 -1
- data/rbi/anthropic/models/tool_text_editor_20250429.rbi +12 -1
- data/rbi/anthropic/models/tool_text_editor_20250728.rbi +12 -1
- data/rbi/anthropic/models/web_search_tool_20250305.rbi +11 -0
- data/rbi/anthropic/models/web_search_tool_request_error.rbi +5 -0
- data/rbi/anthropic/models/web_search_tool_result_error.rbi +5 -0
- data/rbi/anthropic/models.rbi +4 -0
- data/rbi/anthropic/resources/beta/messages.rbi +21 -9
- data/rbi/anthropic/resources/messages.rbi +9 -0
- data/sig/anthropic/models/beta/beta_output_config.rbs +10 -3
- data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +21 -17
- data/sig/anthropic/models/beta/beta_web_search_tool_result_error_code.rbs +2 -0
- data/sig/anthropic/models/json_output_format.rbs +16 -0
- data/sig/anthropic/models/message_count_tokens_params.rbs +7 -0
- data/sig/anthropic/models/message_create_params.rbs +7 -0
- data/sig/anthropic/models/messages/batch_create_params.rbs +9 -0
- data/sig/anthropic/models/output_config.rbs +13 -0
- data/sig/anthropic/models/tool.rbs +7 -0
- data/sig/anthropic/models/tool_bash_20250124.rbs +9 -2
- data/sig/anthropic/models/tool_text_editor_20250124.rbs +9 -2
- data/sig/anthropic/models/tool_text_editor_20250429.rbs +9 -2
- data/sig/anthropic/models/tool_text_editor_20250728.rbs +9 -2
- data/sig/anthropic/models/web_search_tool_20250305.rbs +7 -0
- data/sig/anthropic/models/web_search_tool_request_error.rbs +2 -0
- data/sig/anthropic/models/web_search_tool_result_error.rbs +2 -0
- data/sig/anthropic/models.rbs +4 -0
- data/sig/anthropic/resources/messages.rbs +3 -0
- metadata +22 -2
|
@@ -47,9 +47,9 @@ module Anthropic
|
|
|
47
47
|
#
|
|
48
48
|
# @param metadata [Anthropic::Models::Beta::BetaMetadata] Body param: An object describing metadata about the request.
|
|
49
49
|
#
|
|
50
|
-
# @param output_config [Anthropic::Models::Beta::BetaOutputConfig] Body param: Configuration options for the model's output
|
|
50
|
+
# @param output_config [Anthropic::Models::Beta::BetaOutputConfig] Body param: Configuration options for the model's output, such as the output for
|
|
51
51
|
#
|
|
52
|
-
# @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Body param:
|
|
52
|
+
# @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Body param: Deprecated: Use `output_config.format` instead. See [structured outp
|
|
53
53
|
#
|
|
54
54
|
# @param service_tier [Symbol, Anthropic::Models::Beta::MessageCreateParams::ServiceTier] Body param: Determines whether to use priority capacity (if available) or standa
|
|
55
55
|
#
|
|
@@ -83,7 +83,11 @@ module Anthropic
|
|
|
83
83
|
raise ArgumentError.new(message)
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
-
tools, models = Anthropic::Helpers::Messages.distill_input_schema_models!(
|
|
86
|
+
tools, models = Anthropic::Helpers::Messages.distill_input_schema_models!(
|
|
87
|
+
parsed,
|
|
88
|
+
strict: nil,
|
|
89
|
+
is_beta: true
|
|
90
|
+
)
|
|
87
91
|
|
|
88
92
|
unwrap = ->(raw) { Anthropic::Helpers::Messages.parse_input_schemas!(raw, tools:, models:) }
|
|
89
93
|
|
|
@@ -141,9 +145,9 @@ module Anthropic
|
|
|
141
145
|
#
|
|
142
146
|
# @param metadata [Anthropic::Models::Beta::BetaMetadata] Body param: An object describing metadata about the request.
|
|
143
147
|
#
|
|
144
|
-
# @param output_config [Anthropic::Models::Beta::BetaOutputConfig] Body param: Configuration options for the model's output
|
|
148
|
+
# @param output_config [Anthropic::Models::Beta::BetaOutputConfig] Body param: Configuration options for the model's output, such as the output for
|
|
145
149
|
#
|
|
146
|
-
# @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Body param:
|
|
150
|
+
# @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Body param: Deprecated: Use `output_config.format` instead. See [structured outp
|
|
147
151
|
#
|
|
148
152
|
# @param service_tier [Symbol, Anthropic::Models::Beta::MessageCreateParams::ServiceTier] Body param: Determines whether to use priority capacity (if available) or standa
|
|
149
153
|
#
|
|
@@ -177,7 +181,11 @@ module Anthropic
|
|
|
177
181
|
raise ArgumentError.new(message)
|
|
178
182
|
end
|
|
179
183
|
parsed.store(:stream, true)
|
|
180
|
-
tools, models = Anthropic::Helpers::Messages.distill_input_schema_models!(
|
|
184
|
+
tools, models = Anthropic::Helpers::Messages.distill_input_schema_models!(
|
|
185
|
+
parsed,
|
|
186
|
+
strict: nil,
|
|
187
|
+
is_beta: true
|
|
188
|
+
)
|
|
181
189
|
|
|
182
190
|
header_params = {betas: "anthropic-beta"}
|
|
183
191
|
raw_stream = @client.request(
|
|
@@ -254,6 +262,8 @@ module Anthropic
|
|
|
254
262
|
raise ArgumentError.new(message)
|
|
255
263
|
end
|
|
256
264
|
parsed.store(:stream, true)
|
|
265
|
+
Anthropic::Helpers::Messages.distill_input_schema_models!(parsed, strict: nil, is_beta: true)
|
|
266
|
+
|
|
257
267
|
header_params = {betas: "anthropic-beta"}
|
|
258
268
|
@client.request(
|
|
259
269
|
method: :post,
|
|
@@ -269,12 +279,6 @@ module Anthropic
|
|
|
269
279
|
)
|
|
270
280
|
end
|
|
271
281
|
|
|
272
|
-
private
|
|
273
|
-
|
|
274
|
-
def stream_headers(headers = {})
|
|
275
|
-
headers.merge("x-stainless-helper-method" => "stream")
|
|
276
|
-
end
|
|
277
|
-
|
|
278
282
|
# Some parameter documentations has been truncated, see
|
|
279
283
|
# {Anthropic::Models::Beta::MessageCountTokensParams} for more details.
|
|
280
284
|
#
|
|
@@ -296,9 +300,9 @@ module Anthropic
|
|
|
296
300
|
#
|
|
297
301
|
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
|
|
298
302
|
#
|
|
299
|
-
# @param output_config [Anthropic::Models::Beta::BetaOutputConfig] Body param: Configuration options for the model's output
|
|
303
|
+
# @param output_config [Anthropic::Models::Beta::BetaOutputConfig] Body param: Configuration options for the model's output, such as the output for
|
|
300
304
|
#
|
|
301
|
-
# @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Body param:
|
|
305
|
+
# @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Body param: Deprecated: Use `output_config.format` instead. See [structured outp
|
|
302
306
|
#
|
|
303
307
|
# @param system_ [String, Array<Anthropic::Models::Beta::BetaTextBlockParam>] Body param: System prompt.
|
|
304
308
|
#
|
|
@@ -317,6 +321,8 @@ module Anthropic
|
|
|
317
321
|
# @see Anthropic::Models::Beta::MessageCountTokensParams
|
|
318
322
|
def count_tokens(params)
|
|
319
323
|
parsed, options = Anthropic::Beta::MessageCountTokensParams.dump_request(params)
|
|
324
|
+
Anthropic::Helpers::Messages.distill_input_schema_models!(parsed, strict: nil, is_beta: true)
|
|
325
|
+
|
|
320
326
|
header_params = {betas: "anthropic-beta"}
|
|
321
327
|
@client.request(
|
|
322
328
|
method: :post,
|
|
@@ -328,6 +334,12 @@ module Anthropic
|
|
|
328
334
|
)
|
|
329
335
|
end
|
|
330
336
|
|
|
337
|
+
private
|
|
338
|
+
|
|
339
|
+
def stream_headers(headers = {})
|
|
340
|
+
headers.merge("x-stainless-helper-method" => "stream")
|
|
341
|
+
end
|
|
342
|
+
|
|
331
343
|
# @api private
|
|
332
344
|
#
|
|
333
345
|
# @param client [Anthropic::Client]
|
|
@@ -20,7 +20,7 @@ module Anthropic
|
|
|
20
20
|
# Learn more about the Messages API in our
|
|
21
21
|
# [user guide](https://docs.claude.com/en/docs/initial-setup)
|
|
22
22
|
#
|
|
23
|
-
# @overload create(max_tokens:, messages:, model:, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {})
|
|
23
|
+
# @overload create(max_tokens:, messages:, model:, metadata: nil, output_config: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {})
|
|
24
24
|
#
|
|
25
25
|
# @param max_tokens [Integer] The maximum number of tokens to generate before stopping.
|
|
26
26
|
#
|
|
@@ -30,6 +30,8 @@ module Anthropic
|
|
|
30
30
|
#
|
|
31
31
|
# @param metadata [Anthropic::Models::Metadata] An object describing metadata about the request.
|
|
32
32
|
#
|
|
33
|
+
# @param output_config [Anthropic::Models::OutputConfig] Configuration options for the model's output, such as the output format.
|
|
34
|
+
#
|
|
33
35
|
# @param service_tier [Symbol, Anthropic::Models::MessageCreateParams::ServiceTier] Determines whether to use priority capacity (if available) or standard capacity
|
|
34
36
|
#
|
|
35
37
|
# @param stop_sequences [Array<String>] Custom text sequences that will cause the model to stop generating.
|
|
@@ -101,7 +103,7 @@ module Anthropic
|
|
|
101
103
|
#
|
|
102
104
|
# Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
|
103
105
|
#
|
|
104
|
-
# @overload stream(max_tokens:, messages:, model:, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {})
|
|
106
|
+
# @overload stream(max_tokens:, messages:, model:, metadata: nil, output_config: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {})
|
|
105
107
|
#
|
|
106
108
|
# @param max_tokens [Integer] The maximum number of tokens to generate before stopping.
|
|
107
109
|
#
|
|
@@ -111,6 +113,8 @@ module Anthropic
|
|
|
111
113
|
#
|
|
112
114
|
# @param metadata [Anthropic::Models::Metadata] An object describing metadata about the request.
|
|
113
115
|
#
|
|
116
|
+
# @param output_config [Anthropic::Models::OutputConfig] Configuration options for the model's output. Controls aspects like output format
|
|
117
|
+
#
|
|
114
118
|
# @param service_tier [Symbol, Anthropic::Models::MessageCreateParams::ServiceTier] Determines whether to use priority capacity (if available) or standard capacity
|
|
115
119
|
#
|
|
116
120
|
# @param stop_sequences [Array<String>] Custom text sequences that will cause the model to stop generating.
|
|
@@ -170,7 +174,7 @@ module Anthropic
|
|
|
170
174
|
# Learn more about the Messages API in our
|
|
171
175
|
# [user guide](https://docs.claude.com/en/docs/initial-setup)
|
|
172
176
|
#
|
|
173
|
-
# @overload stream_raw(max_tokens:, messages:, model:, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {})
|
|
177
|
+
# @overload stream_raw(max_tokens:, messages:, model:, metadata: nil, output_config: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {})
|
|
174
178
|
#
|
|
175
179
|
# @param max_tokens [Integer] The maximum number of tokens to generate before stopping.
|
|
176
180
|
#
|
|
@@ -180,6 +184,8 @@ module Anthropic
|
|
|
180
184
|
#
|
|
181
185
|
# @param metadata [Anthropic::Models::Metadata] An object describing metadata about the request.
|
|
182
186
|
#
|
|
187
|
+
# @param output_config [Anthropic::Models::OutputConfig] Configuration options for the model's output, such as the output format.
|
|
188
|
+
#
|
|
183
189
|
# @param service_tier [Symbol, Anthropic::Models::MessageCreateParams::ServiceTier] Determines whether to use priority capacity (if available) or standard capacity
|
|
184
190
|
#
|
|
185
191
|
# @param stop_sequences [Array<String>] Custom text sequences that will cause the model to stop generating.
|
|
@@ -210,6 +216,8 @@ module Anthropic
|
|
|
210
216
|
raise ArgumentError.new(message)
|
|
211
217
|
end
|
|
212
218
|
parsed.store(:stream, true)
|
|
219
|
+
Anthropic::Helpers::Messages.distill_input_schema_models!(parsed, strict: nil)
|
|
220
|
+
|
|
213
221
|
@client.request(
|
|
214
222
|
method: :post,
|
|
215
223
|
path: "v1/messages",
|
|
@@ -232,12 +240,14 @@ module Anthropic
|
|
|
232
240
|
# Learn more about token counting in our
|
|
233
241
|
# [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
|
|
234
242
|
#
|
|
235
|
-
# @overload count_tokens(messages:, model:, system_: nil, thinking: nil, tool_choice: nil, tools: nil, request_options: {})
|
|
243
|
+
# @overload count_tokens(messages:, model:, output_config: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, request_options: {})
|
|
236
244
|
#
|
|
237
245
|
# @param messages [Array<Anthropic::Models::MessageParam>] Input messages.
|
|
238
246
|
#
|
|
239
247
|
# @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
|
|
240
248
|
#
|
|
249
|
+
# @param output_config [Anthropic::Models::OutputConfig] Configuration options for the model's output, such as the output format.
|
|
250
|
+
#
|
|
241
251
|
# @param system_ [String, Array<Anthropic::Models::TextBlockParam>] System prompt.
|
|
242
252
|
#
|
|
243
253
|
# @param thinking [Anthropic::Models::ThinkingConfigEnabled, Anthropic::Models::ThinkingConfigDisabled] Configuration for enabling Claude's extended thinking.
|
|
@@ -253,6 +263,7 @@ module Anthropic
|
|
|
253
263
|
# @see Anthropic::Models::MessageCountTokensParams
|
|
254
264
|
def count_tokens(params)
|
|
255
265
|
parsed, options = Anthropic::MessageCountTokensParams.dump_request(params)
|
|
266
|
+
Anthropic::Helpers::Messages.distill_input_schema_models!(parsed, strict: nil)
|
|
256
267
|
@client.request(
|
|
257
268
|
method: :post,
|
|
258
269
|
path: "v1/messages/count_tokens",
|
data/lib/anthropic/version.rb
CHANGED
data/lib/anthropic.rb
CHANGED
|
@@ -342,6 +342,7 @@ require_relative "anthropic/models/gateway_timeout_error"
|
|
|
342
342
|
require_relative "anthropic/models/image_block_param"
|
|
343
343
|
require_relative "anthropic/models/input_json_delta"
|
|
344
344
|
require_relative "anthropic/models/invalid_request_error"
|
|
345
|
+
require_relative "anthropic/models/json_output_format"
|
|
345
346
|
require_relative "anthropic/models/message"
|
|
346
347
|
require_relative "anthropic/models/message_count_tokens_params"
|
|
347
348
|
require_relative "anthropic/models/message_count_tokens_tool"
|
|
@@ -370,6 +371,7 @@ require_relative "anthropic/models/model_info"
|
|
|
370
371
|
require_relative "anthropic/models/model_list_params"
|
|
371
372
|
require_relative "anthropic/models/model_retrieve_params"
|
|
372
373
|
require_relative "anthropic/models/not_found_error"
|
|
374
|
+
require_relative "anthropic/models/output_config"
|
|
373
375
|
require_relative "anthropic/models/overloaded_error"
|
|
374
376
|
require_relative "anthropic/models/permission_error"
|
|
375
377
|
require_relative "anthropic/models/plain_text_source"
|
|
@@ -64,6 +64,7 @@ module Anthropic
|
|
|
64
64
|
sig { params(defer_loading: T::Boolean).void }
|
|
65
65
|
attr_writer :defer_loading
|
|
66
66
|
|
|
67
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
67
68
|
sig { returns(T.nilable(T::Boolean)) }
|
|
68
69
|
attr_reader :strict
|
|
69
70
|
|
|
@@ -91,6 +92,7 @@ module Anthropic
|
|
|
91
92
|
# If true, tool will not be included in initial system prompt. Only loaded when
|
|
92
93
|
# returned via tool_reference from tool search.
|
|
93
94
|
defer_loading: nil,
|
|
95
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
94
96
|
strict: nil,
|
|
95
97
|
# Name of the tool.
|
|
96
98
|
#
|
|
@@ -64,6 +64,7 @@ module Anthropic
|
|
|
64
64
|
sig { params(defer_loading: T::Boolean).void }
|
|
65
65
|
attr_writer :defer_loading
|
|
66
66
|
|
|
67
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
67
68
|
sig { returns(T.nilable(T::Boolean)) }
|
|
68
69
|
attr_reader :strict
|
|
69
70
|
|
|
@@ -91,6 +92,7 @@ module Anthropic
|
|
|
91
92
|
# If true, tool will not be included in initial system prompt. Only loaded when
|
|
92
93
|
# returned via tool_reference from tool search.
|
|
93
94
|
defer_loading: nil,
|
|
95
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
94
96
|
strict: nil,
|
|
95
97
|
# Name of the tool.
|
|
96
98
|
#
|
|
@@ -72,6 +72,7 @@ module Anthropic
|
|
|
72
72
|
end
|
|
73
73
|
attr_writer :input_examples
|
|
74
74
|
|
|
75
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
75
76
|
sig { returns(T.nilable(T::Boolean)) }
|
|
76
77
|
attr_reader :strict
|
|
77
78
|
|
|
@@ -101,6 +102,7 @@ module Anthropic
|
|
|
101
102
|
# returned via tool_reference from tool search.
|
|
102
103
|
defer_loading: nil,
|
|
103
104
|
input_examples: nil,
|
|
105
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
104
106
|
strict: nil,
|
|
105
107
|
# Name of the tool.
|
|
106
108
|
#
|
|
@@ -14,7 +14,10 @@ module Anthropic
|
|
|
14
14
|
)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# How much effort the model should put into its response. Higher effort levels may
|
|
18
|
+
# result in more thorough analysis but take longer.
|
|
19
|
+
#
|
|
20
|
+
# Valid values are `low`, `medium`, or `high`.
|
|
18
21
|
sig do
|
|
19
22
|
returns(
|
|
20
23
|
T.nilable(Anthropic::Beta::BetaOutputConfig::Effort::OrSymbol)
|
|
@@ -22,15 +25,34 @@ module Anthropic
|
|
|
22
25
|
end
|
|
23
26
|
attr_accessor :effort
|
|
24
27
|
|
|
28
|
+
# A schema to specify Claude's output format in responses. See
|
|
29
|
+
# [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
|
|
30
|
+
sig { returns(T.nilable(Anthropic::Beta::BetaJSONOutputFormat)) }
|
|
31
|
+
attr_reader :format_
|
|
32
|
+
|
|
33
|
+
sig do
|
|
34
|
+
params(
|
|
35
|
+
format_: T.nilable(Anthropic::Beta::BetaJSONOutputFormat::OrHash)
|
|
36
|
+
).void
|
|
37
|
+
end
|
|
38
|
+
attr_writer :format_
|
|
39
|
+
|
|
25
40
|
sig do
|
|
26
41
|
params(
|
|
27
42
|
effort:
|
|
28
|
-
T.nilable(Anthropic::Beta::BetaOutputConfig::Effort::OrSymbol)
|
|
43
|
+
T.nilable(Anthropic::Beta::BetaOutputConfig::Effort::OrSymbol),
|
|
44
|
+
format_: T.nilable(Anthropic::Beta::BetaJSONOutputFormat::OrHash)
|
|
29
45
|
).returns(T.attached_class)
|
|
30
46
|
end
|
|
31
47
|
def self.new(
|
|
32
|
-
#
|
|
33
|
-
|
|
48
|
+
# How much effort the model should put into its response. Higher effort levels may
|
|
49
|
+
# result in more thorough analysis but take longer.
|
|
50
|
+
#
|
|
51
|
+
# Valid values are `low`, `medium`, or `high`.
|
|
52
|
+
effort: nil,
|
|
53
|
+
# A schema to specify Claude's output format in responses. See
|
|
54
|
+
# [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
|
|
55
|
+
format_: nil
|
|
34
56
|
)
|
|
35
57
|
end
|
|
36
58
|
|
|
@@ -38,14 +60,18 @@ module Anthropic
|
|
|
38
60
|
override.returns(
|
|
39
61
|
{
|
|
40
62
|
effort:
|
|
41
|
-
T.nilable(Anthropic::Beta::BetaOutputConfig::Effort::OrSymbol)
|
|
63
|
+
T.nilable(Anthropic::Beta::BetaOutputConfig::Effort::OrSymbol),
|
|
64
|
+
format_: T.nilable(Anthropic::Beta::BetaJSONOutputFormat)
|
|
42
65
|
}
|
|
43
66
|
)
|
|
44
67
|
end
|
|
45
68
|
def to_hash
|
|
46
69
|
end
|
|
47
70
|
|
|
48
|
-
#
|
|
71
|
+
# How much effort the model should put into its response. Higher effort levels may
|
|
72
|
+
# result in more thorough analysis but take longer.
|
|
73
|
+
#
|
|
74
|
+
# Valid values are `low`, `medium`, or `high`.
|
|
49
75
|
module Effort
|
|
50
76
|
extend Anthropic::Internal::Type::Enum
|
|
51
77
|
|
|
@@ -17,12 +17,6 @@ module Anthropic
|
|
|
17
17
|
sig { returns(String) }
|
|
18
18
|
attr_accessor :id
|
|
19
19
|
|
|
20
|
-
# Tool invocation directly from the model.
|
|
21
|
-
sig do
|
|
22
|
-
returns(Anthropic::Beta::BetaServerToolUseBlock::Caller::Variants)
|
|
23
|
-
end
|
|
24
|
-
attr_accessor :caller_
|
|
25
|
-
|
|
26
20
|
sig { returns(T::Hash[Symbol, T.anything]) }
|
|
27
21
|
attr_accessor :input
|
|
28
22
|
|
|
@@ -34,25 +28,44 @@ module Anthropic
|
|
|
34
28
|
sig { returns(Symbol) }
|
|
35
29
|
attr_accessor :type
|
|
36
30
|
|
|
31
|
+
# Tool invocation directly from the model.
|
|
32
|
+
sig do
|
|
33
|
+
returns(
|
|
34
|
+
T.nilable(Anthropic::Beta::BetaServerToolUseBlock::Caller::Variants)
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
attr_reader :caller_
|
|
38
|
+
|
|
37
39
|
sig do
|
|
38
40
|
params(
|
|
39
|
-
id: String,
|
|
40
41
|
caller_:
|
|
41
42
|
T.any(
|
|
42
43
|
Anthropic::Beta::BetaDirectCaller::OrHash,
|
|
43
44
|
Anthropic::Beta::BetaServerToolCaller::OrHash
|
|
44
|
-
)
|
|
45
|
+
)
|
|
46
|
+
).void
|
|
47
|
+
end
|
|
48
|
+
attr_writer :caller_
|
|
49
|
+
|
|
50
|
+
sig do
|
|
51
|
+
params(
|
|
52
|
+
id: String,
|
|
45
53
|
input: T::Hash[Symbol, T.anything],
|
|
46
54
|
name: Anthropic::Beta::BetaServerToolUseBlock::Name::OrSymbol,
|
|
55
|
+
caller_:
|
|
56
|
+
T.any(
|
|
57
|
+
Anthropic::Beta::BetaDirectCaller::OrHash,
|
|
58
|
+
Anthropic::Beta::BetaServerToolCaller::OrHash
|
|
59
|
+
),
|
|
47
60
|
type: Symbol
|
|
48
61
|
).returns(T.attached_class)
|
|
49
62
|
end
|
|
50
63
|
def self.new(
|
|
51
64
|
id:,
|
|
52
|
-
# Tool invocation directly from the model.
|
|
53
|
-
caller_:,
|
|
54
65
|
input:,
|
|
55
66
|
name:,
|
|
67
|
+
# Tool invocation directly from the model.
|
|
68
|
+
caller_: nil,
|
|
56
69
|
type: :server_tool_use
|
|
57
70
|
)
|
|
58
71
|
end
|
|
@@ -61,40 +74,16 @@ module Anthropic
|
|
|
61
74
|
override.returns(
|
|
62
75
|
{
|
|
63
76
|
id: String,
|
|
64
|
-
caller_:
|
|
65
|
-
Anthropic::Beta::BetaServerToolUseBlock::Caller::Variants,
|
|
66
77
|
input: T::Hash[Symbol, T.anything],
|
|
67
78
|
name: Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol,
|
|
68
|
-
type: Symbol
|
|
79
|
+
type: Symbol,
|
|
80
|
+
caller_: Anthropic::Beta::BetaServerToolUseBlock::Caller::Variants
|
|
69
81
|
}
|
|
70
82
|
)
|
|
71
83
|
end
|
|
72
84
|
def to_hash
|
|
73
85
|
end
|
|
74
86
|
|
|
75
|
-
# Tool invocation directly from the model.
|
|
76
|
-
module Caller
|
|
77
|
-
extend Anthropic::Internal::Type::Union
|
|
78
|
-
|
|
79
|
-
Variants =
|
|
80
|
-
T.type_alias do
|
|
81
|
-
T.any(
|
|
82
|
-
Anthropic::Beta::BetaDirectCaller,
|
|
83
|
-
Anthropic::Beta::BetaServerToolCaller
|
|
84
|
-
)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
sig do
|
|
88
|
-
override.returns(
|
|
89
|
-
T::Array[
|
|
90
|
-
Anthropic::Beta::BetaServerToolUseBlock::Caller::Variants
|
|
91
|
-
]
|
|
92
|
-
)
|
|
93
|
-
end
|
|
94
|
-
def self.variants
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
87
|
module Name
|
|
99
88
|
extend Anthropic::Internal::Type::Enum
|
|
100
89
|
|
|
@@ -150,6 +139,29 @@ module Anthropic
|
|
|
150
139
|
def self.values
|
|
151
140
|
end
|
|
152
141
|
end
|
|
142
|
+
|
|
143
|
+
# Tool invocation directly from the model.
|
|
144
|
+
module Caller
|
|
145
|
+
extend Anthropic::Internal::Type::Union
|
|
146
|
+
|
|
147
|
+
Variants =
|
|
148
|
+
T.type_alias do
|
|
149
|
+
T.any(
|
|
150
|
+
Anthropic::Beta::BetaDirectCaller,
|
|
151
|
+
Anthropic::Beta::BetaServerToolCaller
|
|
152
|
+
)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
sig do
|
|
156
|
+
override.returns(
|
|
157
|
+
T::Array[
|
|
158
|
+
Anthropic::Beta::BetaServerToolUseBlock::Caller::Variants
|
|
159
|
+
]
|
|
160
|
+
)
|
|
161
|
+
end
|
|
162
|
+
def self.variants
|
|
163
|
+
end
|
|
164
|
+
end
|
|
153
165
|
end
|
|
154
166
|
end
|
|
155
167
|
end
|
|
@@ -88,6 +88,7 @@ module Anthropic
|
|
|
88
88
|
end
|
|
89
89
|
attr_writer :input_examples
|
|
90
90
|
|
|
91
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
91
92
|
sig { returns(T.nilable(T::Boolean)) }
|
|
92
93
|
attr_reader :strict
|
|
93
94
|
|
|
@@ -136,6 +137,7 @@ module Anthropic
|
|
|
136
137
|
# aspects of the tool input JSON schema.
|
|
137
138
|
description: nil,
|
|
138
139
|
input_examples: nil,
|
|
140
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
139
141
|
strict: nil,
|
|
140
142
|
type: nil
|
|
141
143
|
)
|
|
@@ -72,6 +72,7 @@ module Anthropic
|
|
|
72
72
|
end
|
|
73
73
|
attr_writer :input_examples
|
|
74
74
|
|
|
75
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
75
76
|
sig { returns(T.nilable(T::Boolean)) }
|
|
76
77
|
attr_reader :strict
|
|
77
78
|
|
|
@@ -101,6 +102,7 @@ module Anthropic
|
|
|
101
102
|
# returned via tool_reference from tool search.
|
|
102
103
|
defer_loading: nil,
|
|
103
104
|
input_examples: nil,
|
|
105
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
104
106
|
strict: nil,
|
|
105
107
|
# Name of the tool.
|
|
106
108
|
#
|
|
@@ -72,6 +72,7 @@ module Anthropic
|
|
|
72
72
|
end
|
|
73
73
|
attr_writer :input_examples
|
|
74
74
|
|
|
75
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
75
76
|
sig { returns(T.nilable(T::Boolean)) }
|
|
76
77
|
attr_reader :strict
|
|
77
78
|
|
|
@@ -101,6 +102,7 @@ module Anthropic
|
|
|
101
102
|
# returned via tool_reference from tool search.
|
|
102
103
|
defer_loading: nil,
|
|
103
104
|
input_examples: nil,
|
|
105
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
104
106
|
strict: nil,
|
|
105
107
|
# Name of the tool.
|
|
106
108
|
#
|
|
@@ -84,6 +84,7 @@ module Anthropic
|
|
|
84
84
|
end
|
|
85
85
|
attr_writer :input_examples
|
|
86
86
|
|
|
87
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
87
88
|
sig { returns(T.nilable(T::Boolean)) }
|
|
88
89
|
attr_reader :strict
|
|
89
90
|
|
|
@@ -122,6 +123,7 @@ module Anthropic
|
|
|
122
123
|
# The X11 display number (e.g. 0, 1) for the display.
|
|
123
124
|
display_number: nil,
|
|
124
125
|
input_examples: nil,
|
|
126
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
125
127
|
strict: nil,
|
|
126
128
|
# Name of the tool.
|
|
127
129
|
#
|
|
@@ -84,6 +84,7 @@ module Anthropic
|
|
|
84
84
|
end
|
|
85
85
|
attr_writer :input_examples
|
|
86
86
|
|
|
87
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
87
88
|
sig { returns(T.nilable(T::Boolean)) }
|
|
88
89
|
attr_reader :strict
|
|
89
90
|
|
|
@@ -122,6 +123,7 @@ module Anthropic
|
|
|
122
123
|
# The X11 display number (e.g. 0, 1) for the display.
|
|
123
124
|
display_number: nil,
|
|
124
125
|
input_examples: nil,
|
|
126
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
125
127
|
strict: nil,
|
|
126
128
|
# Name of the tool.
|
|
127
129
|
#
|
|
@@ -91,6 +91,7 @@ module Anthropic
|
|
|
91
91
|
end
|
|
92
92
|
attr_writer :input_examples
|
|
93
93
|
|
|
94
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
94
95
|
sig { returns(T.nilable(T::Boolean)) }
|
|
95
96
|
attr_reader :strict
|
|
96
97
|
|
|
@@ -132,6 +133,7 @@ module Anthropic
|
|
|
132
133
|
# Whether to enable an action to take a zoomed-in screenshot of the screen.
|
|
133
134
|
enable_zoom: nil,
|
|
134
135
|
input_examples: nil,
|
|
136
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
135
137
|
strict: nil,
|
|
136
138
|
# Name of the tool.
|
|
137
139
|
#
|
|
@@ -68,6 +68,7 @@ module Anthropic
|
|
|
68
68
|
sig { params(defer_loading: T::Boolean).void }
|
|
69
69
|
attr_writer :defer_loading
|
|
70
70
|
|
|
71
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
71
72
|
sig { returns(T.nilable(T::Boolean)) }
|
|
72
73
|
attr_reader :strict
|
|
73
74
|
|
|
@@ -97,6 +98,7 @@ module Anthropic
|
|
|
97
98
|
# If true, tool will not be included in initial system prompt. Only loaded when
|
|
98
99
|
# returned via tool_reference from tool search.
|
|
99
100
|
defer_loading: nil,
|
|
101
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
100
102
|
strict: nil,
|
|
101
103
|
# Name of the tool.
|
|
102
104
|
#
|
|
@@ -68,6 +68,7 @@ module Anthropic
|
|
|
68
68
|
sig { params(defer_loading: T::Boolean).void }
|
|
69
69
|
attr_writer :defer_loading
|
|
70
70
|
|
|
71
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
71
72
|
sig { returns(T.nilable(T::Boolean)) }
|
|
72
73
|
attr_reader :strict
|
|
73
74
|
|
|
@@ -97,6 +98,7 @@ module Anthropic
|
|
|
97
98
|
# If true, tool will not be included in initial system prompt. Only loaded when
|
|
98
99
|
# returned via tool_reference from tool search.
|
|
99
100
|
defer_loading: nil,
|
|
101
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
100
102
|
strict: nil,
|
|
101
103
|
# Name of the tool.
|
|
102
104
|
#
|
|
@@ -72,6 +72,7 @@ module Anthropic
|
|
|
72
72
|
end
|
|
73
73
|
attr_writer :input_examples
|
|
74
74
|
|
|
75
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
75
76
|
sig { returns(T.nilable(T::Boolean)) }
|
|
76
77
|
attr_reader :strict
|
|
77
78
|
|
|
@@ -101,6 +102,7 @@ module Anthropic
|
|
|
101
102
|
# returned via tool_reference from tool search.
|
|
102
103
|
defer_loading: nil,
|
|
103
104
|
input_examples: nil,
|
|
105
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
104
106
|
strict: nil,
|
|
105
107
|
# Name of the tool.
|
|
106
108
|
#
|
|
@@ -72,6 +72,7 @@ module Anthropic
|
|
|
72
72
|
end
|
|
73
73
|
attr_writer :input_examples
|
|
74
74
|
|
|
75
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
75
76
|
sig { returns(T.nilable(T::Boolean)) }
|
|
76
77
|
attr_reader :strict
|
|
77
78
|
|
|
@@ -101,6 +102,7 @@ module Anthropic
|
|
|
101
102
|
# returned via tool_reference from tool search.
|
|
102
103
|
defer_loading: nil,
|
|
103
104
|
input_examples: nil,
|
|
105
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
104
106
|
strict: nil,
|
|
105
107
|
# Name of the tool.
|
|
106
108
|
#
|
|
@@ -72,6 +72,7 @@ module Anthropic
|
|
|
72
72
|
end
|
|
73
73
|
attr_writer :input_examples
|
|
74
74
|
|
|
75
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
75
76
|
sig { returns(T.nilable(T::Boolean)) }
|
|
76
77
|
attr_reader :strict
|
|
77
78
|
|
|
@@ -101,6 +102,7 @@ module Anthropic
|
|
|
101
102
|
# returned via tool_reference from tool search.
|
|
102
103
|
defer_loading: nil,
|
|
103
104
|
input_examples: nil,
|
|
105
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
104
106
|
strict: nil,
|
|
105
107
|
# Name of the tool.
|
|
106
108
|
#
|
|
@@ -77,6 +77,7 @@ module Anthropic
|
|
|
77
77
|
sig { returns(T.nilable(Integer)) }
|
|
78
78
|
attr_accessor :max_characters
|
|
79
79
|
|
|
80
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
80
81
|
sig { returns(T.nilable(T::Boolean)) }
|
|
81
82
|
attr_reader :strict
|
|
82
83
|
|
|
@@ -110,6 +111,7 @@ module Anthropic
|
|
|
110
111
|
# Maximum number of characters to display when viewing a file. If not specified,
|
|
111
112
|
# defaults to displaying the full file.
|
|
112
113
|
max_characters: nil,
|
|
114
|
+
# When true, guarantees schema validation on tool names and inputs
|
|
113
115
|
strict: nil,
|
|
114
116
|
# Name of the tool.
|
|
115
117
|
#
|