anthropic 1.21.0 → 1.23.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 +22 -0
- data/README.md +1 -1
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +10 -1
- data/lib/anthropic/models/beta/message_create_params.rb +10 -1
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +10 -1
- data/lib/anthropic/models/message_count_tokens_params.rb +10 -1
- data/lib/anthropic/models/message_create_params.rb +10 -1
- data/lib/anthropic/models/messages/batch_create_params.rb +10 -1
- data/lib/anthropic/models/user_location.rb +52 -0
- data/lib/anthropic/models/web_search_tool_20250305.rb +5 -53
- data/lib/anthropic/models/web_search_tool_20260209.rb +5 -53
- data/lib/anthropic/models/web_search_tool_request_error.rb +3 -18
- data/lib/anthropic/models/web_search_tool_result_error.rb +3 -18
- data/lib/anthropic/models/web_search_tool_result_error_code.rb +25 -0
- data/lib/anthropic/models.rb +4 -0
- data/lib/anthropic/resources/beta/messages.rb +9 -3
- data/lib/anthropic/resources/messages.rb +9 -3
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +2 -0
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +20 -0
- data/rbi/anthropic/models/beta/message_create_params.rbi +20 -0
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +26 -0
- data/rbi/anthropic/models/message_count_tokens_params.rbi +17 -0
- data/rbi/anthropic/models/message_create_params.rbi +17 -0
- data/rbi/anthropic/models/messages/batch_create_params.rbi +19 -0
- data/rbi/anthropic/models/user_location.rbi +71 -0
- data/rbi/anthropic/models/web_search_tool_20250305.rbi +4 -80
- data/rbi/anthropic/models/web_search_tool_20260209.rbi +4 -80
- data/rbi/anthropic/models/web_search_tool_request_error.rbi +3 -55
- data/rbi/anthropic/models/web_search_tool_result_error.rbi +3 -57
- data/rbi/anthropic/models/web_search_tool_result_error_code.rbi +52 -0
- data/rbi/anthropic/models.rbi +4 -0
- data/rbi/anthropic/resources/beta/messages.rbi +15 -0
- data/rbi/anthropic/resources/messages.rbi +12 -0
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +5 -0
- data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
- data/sig/anthropic/models/beta/messages/batch_create_params.rbs +5 -0
- data/sig/anthropic/models/message_count_tokens_params.rbs +5 -0
- data/sig/anthropic/models/message_create_params.rbs +5 -0
- data/sig/anthropic/models/messages/batch_create_params.rbs +5 -0
- data/sig/anthropic/models/user_location.rbs +40 -0
- data/sig/anthropic/models/web_search_tool_20250305.rbs +4 -41
- data/sig/anthropic/models/web_search_tool_20260209.rbs +4 -41
- data/sig/anthropic/models/web_search_tool_request_error.rbs +4 -25
- data/sig/anthropic/models/web_search_tool_result_error.rbs +4 -25
- data/sig/anthropic/models/web_search_tool_result_error_code.rbs +24 -0
- data/sig/anthropic/models.rbs +4 -0
- data/sig/anthropic/resources/beta/messages.rbs +3 -0
- data/sig/anthropic/resources/messages.rbs +3 -0
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e7f34d5d181c452996ffe49befe4bea248cd67a952eb8853cabf5d0ced185ef
|
|
4
|
+
data.tar.gz: 6945acf587c974e918efdbac79a408b1e3dfc787925037ca938f90cb4b601743
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f1f562c0d5bfa17193f8d4952cdf91b2ed68777f87d7a72ed4ce993a457acbdcee4bb9256329a97b4a49513216c077e404b93b06f58241344174a52d956dd84f
|
|
7
|
+
data.tar.gz: 8e28e293264fa8cf7cd2611211a98f99e524df4485f9d16455b0a6a53e7a6cab3423859c3168b6ab1ea6b18ee071f1761880592c37d4944aa99feb9ea22ec012
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.23.0 (2026-02-19)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.22.0...v1.23.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.22.0...v1.23.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** Add top-level cache control (automatic caching) ([612806b](https://github.com/anthropics/anthropic-sdk-ruby/commit/612806bddee36afc3976fa6a4723b0c6df7e6012))
|
|
10
|
+
* **api:** Deprecate haiku-3 ([66ac4a8](https://github.com/anthropics/anthropic-sdk-ruby/commit/66ac4a8ceca44fc2b4d3a68c1ce87c0c05bea5f5))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Chores
|
|
14
|
+
|
|
15
|
+
* update mock server docs ([56f16bd](https://github.com/anthropics/anthropic-sdk-ruby/commit/56f16bd36802f804fb6a62735c330ebc22a11fe0))
|
|
16
|
+
|
|
17
|
+
## 1.22.0 (2026-02-18)
|
|
18
|
+
|
|
19
|
+
Full Changelog: [v1.21.0...v1.22.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.21.0...v1.22.0)
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **api:** fix shared UserLocation and error code types ([b1e9684](https://github.com/anthropics/anthropic-sdk-ruby/commit/b1e9684d4eb5e9af91798d8e22e28f003312ffe6))
|
|
24
|
+
|
|
3
25
|
## 1.21.0 (2026-02-18)
|
|
4
26
|
|
|
5
27
|
Full Changelog: [v1.20.0...v1.21.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.20.0...v1.21.0)
|
data/README.md
CHANGED
|
@@ -86,6 +86,13 @@ module Anthropic
|
|
|
86
86
|
# @return [Symbol, String, Anthropic::Models::Model]
|
|
87
87
|
required :model, union: -> { Anthropic::Model }
|
|
88
88
|
|
|
89
|
+
# @!attribute cache_control
|
|
90
|
+
# Top-level cache control automatically applies a cache_control marker to the last
|
|
91
|
+
# cacheable block in the request.
|
|
92
|
+
#
|
|
93
|
+
# @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
|
|
94
|
+
optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
|
|
95
|
+
|
|
89
96
|
# @!attribute context_management
|
|
90
97
|
# Context management configuration.
|
|
91
98
|
#
|
|
@@ -245,7 +252,7 @@ module Anthropic
|
|
|
245
252
|
# @return [Array<String, Symbol, Anthropic::Models::AnthropicBeta>, nil]
|
|
246
253
|
optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }
|
|
247
254
|
|
|
248
|
-
# @!method initialize(messages:, model:, context_management: nil, mcp_servers: nil, output_config: nil, output_format: nil, speed: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
|
|
255
|
+
# @!method initialize(messages:, model:, cache_control: nil, context_management: nil, mcp_servers: nil, output_config: nil, output_format: nil, speed: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
|
|
249
256
|
# Some parameter documentations has been truncated, see
|
|
250
257
|
# {Anthropic::Models::Beta::MessageCountTokensParams} for more details.
|
|
251
258
|
#
|
|
@@ -253,6 +260,8 @@ module Anthropic
|
|
|
253
260
|
#
|
|
254
261
|
# @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
|
|
255
262
|
#
|
|
263
|
+
# @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Top-level cache control automatically applies a cache_control marker to the last
|
|
264
|
+
#
|
|
256
265
|
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Context management configuration.
|
|
257
266
|
#
|
|
258
267
|
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] MCP servers to be utilized in this request
|
|
@@ -100,6 +100,13 @@ module Anthropic
|
|
|
100
100
|
# @return [Symbol, String, Anthropic::Models::Model]
|
|
101
101
|
required :model, union: -> { Anthropic::Model }
|
|
102
102
|
|
|
103
|
+
# @!attribute cache_control
|
|
104
|
+
# Top-level cache control automatically applies a cache_control marker to the last
|
|
105
|
+
# cacheable block in the request.
|
|
106
|
+
#
|
|
107
|
+
# @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
|
|
108
|
+
optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
|
|
109
|
+
|
|
103
110
|
# @!attribute container
|
|
104
111
|
# Container identifier for reuse across requests.
|
|
105
112
|
#
|
|
@@ -340,7 +347,7 @@ module Anthropic
|
|
|
340
347
|
# @return [Array<String, Symbol, Anthropic::Models::AnthropicBeta>, nil]
|
|
341
348
|
optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }
|
|
342
349
|
|
|
343
|
-
# @!method initialize(max_tokens:, messages:, model:, container: nil, context_management: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
|
|
350
|
+
# @!method initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
|
|
344
351
|
# Some parameter documentations has been truncated, see
|
|
345
352
|
# {Anthropic::Models::Beta::MessageCreateParams} for more details.
|
|
346
353
|
#
|
|
@@ -350,6 +357,8 @@ module Anthropic
|
|
|
350
357
|
#
|
|
351
358
|
# @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
|
|
352
359
|
#
|
|
360
|
+
# @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Top-level cache control automatically applies a cache_control marker to the last
|
|
361
|
+
#
|
|
353
362
|
# @param container [Anthropic::Models::Beta::BetaContainerParams, String, nil] Container identifier for reuse across requests.
|
|
354
363
|
#
|
|
355
364
|
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Context management configuration.
|
|
@@ -153,6 +153,13 @@ module Anthropic
|
|
|
153
153
|
# @return [Symbol, String, Anthropic::Models::Model]
|
|
154
154
|
required :model, union: -> { Anthropic::Model }
|
|
155
155
|
|
|
156
|
+
# @!attribute cache_control
|
|
157
|
+
# Top-level cache control automatically applies a cache_control marker to the last
|
|
158
|
+
# cacheable block in the request.
|
|
159
|
+
#
|
|
160
|
+
# @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
|
|
161
|
+
optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
|
|
162
|
+
|
|
156
163
|
# @!attribute container
|
|
157
164
|
# Container identifier for reuse across requests.
|
|
158
165
|
#
|
|
@@ -402,7 +409,7 @@ module Anthropic
|
|
|
402
409
|
# @return [Float, nil]
|
|
403
410
|
optional :top_p, Float
|
|
404
411
|
|
|
405
|
-
# @!method initialize(max_tokens:, messages:, model:, container: nil, context_management: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, stream: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil)
|
|
412
|
+
# @!method initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, stream: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil)
|
|
406
413
|
# Some parameter documentations has been truncated, see
|
|
407
414
|
# {Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params} for more
|
|
408
415
|
# details.
|
|
@@ -418,6 +425,8 @@ module Anthropic
|
|
|
418
425
|
#
|
|
419
426
|
# @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
|
|
420
427
|
#
|
|
428
|
+
# @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Top-level cache control automatically applies a cache_control marker to the last
|
|
429
|
+
#
|
|
421
430
|
# @param container [Anthropic::Models::Beta::BetaContainerParams, String, nil] Container identifier for reuse across requests.
|
|
422
431
|
#
|
|
423
432
|
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Context management configuration.
|
|
@@ -85,6 +85,13 @@ module Anthropic
|
|
|
85
85
|
# @return [Symbol, String, Anthropic::Models::Model]
|
|
86
86
|
required :model, union: -> { Anthropic::Model }
|
|
87
87
|
|
|
88
|
+
# @!attribute cache_control
|
|
89
|
+
# Top-level cache control automatically applies a cache_control marker to the last
|
|
90
|
+
# cacheable block in the request.
|
|
91
|
+
#
|
|
92
|
+
# @return [Anthropic::Models::CacheControlEphemeral, nil]
|
|
93
|
+
optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
|
|
94
|
+
|
|
88
95
|
# @!attribute output_config
|
|
89
96
|
# Configuration options for the model's output, such as the output format.
|
|
90
97
|
#
|
|
@@ -202,7 +209,7 @@ module Anthropic
|
|
|
202
209
|
# @return [Array<Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::CodeExecutionTool20250522, Anthropic::Models::CodeExecutionTool20250825, Anthropic::Models::CodeExecutionTool20260120, Anthropic::Models::MemoryTool20250818, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305, Anthropic::Models::WebFetchTool20250910, Anthropic::Models::WebSearchTool20260209, Anthropic::Models::WebFetchTool20260209, Anthropic::Models::ToolSearchToolBm25_20251119, Anthropic::Models::ToolSearchToolRegex20251119>, nil]
|
|
203
210
|
optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::MessageCountTokensTool] }
|
|
204
211
|
|
|
205
|
-
# @!method initialize(messages:, model:, output_config: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, request_options: {})
|
|
212
|
+
# @!method initialize(messages:, model:, cache_control: nil, output_config: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, request_options: {})
|
|
206
213
|
# Some parameter documentations has been truncated, see
|
|
207
214
|
# {Anthropic::Models::MessageCountTokensParams} for more details.
|
|
208
215
|
#
|
|
@@ -210,6 +217,8 @@ module Anthropic
|
|
|
210
217
|
#
|
|
211
218
|
# @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
|
|
212
219
|
#
|
|
220
|
+
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Top-level cache control automatically applies a cache_control marker to the last
|
|
221
|
+
#
|
|
213
222
|
# @param output_config [Anthropic::Models::OutputConfig] Configuration options for the model's output, such as the output format.
|
|
214
223
|
#
|
|
215
224
|
# @param system_ [String, Array<Anthropic::Models::TextBlockParam>] System prompt.
|
|
@@ -99,6 +99,13 @@ module Anthropic
|
|
|
99
99
|
# @return [Symbol, String, Anthropic::Models::Model]
|
|
100
100
|
required :model, union: -> { Anthropic::Model }
|
|
101
101
|
|
|
102
|
+
# @!attribute cache_control
|
|
103
|
+
# Top-level cache control automatically applies a cache_control marker to the last
|
|
104
|
+
# cacheable block in the request.
|
|
105
|
+
#
|
|
106
|
+
# @return [Anthropic::Models::CacheControlEphemeral, nil]
|
|
107
|
+
optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
|
|
108
|
+
|
|
102
109
|
# @!attribute container
|
|
103
110
|
# Container identifier for reuse across requests.
|
|
104
111
|
#
|
|
@@ -298,7 +305,7 @@ module Anthropic
|
|
|
298
305
|
# @return [Float, nil]
|
|
299
306
|
optional :top_p, Float
|
|
300
307
|
|
|
301
|
-
# @!method initialize(max_tokens:, messages:, model:, container: nil, inference_geo: nil, 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: {})
|
|
308
|
+
# @!method initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, inference_geo: nil, 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: {})
|
|
302
309
|
# Some parameter documentations has been truncated, see
|
|
303
310
|
# {Anthropic::Models::MessageCreateParams} for more details.
|
|
304
311
|
#
|
|
@@ -308,6 +315,8 @@ module Anthropic
|
|
|
308
315
|
#
|
|
309
316
|
# @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
|
|
310
317
|
#
|
|
318
|
+
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Top-level cache control automatically applies a cache_control marker to the last
|
|
319
|
+
#
|
|
311
320
|
# @param container [String, nil] Container identifier for reuse across requests.
|
|
312
321
|
#
|
|
313
322
|
# @param inference_geo [String, nil] Specifies the geographic region for inference processing. If not specified, the
|
|
@@ -143,6 +143,13 @@ module Anthropic
|
|
|
143
143
|
# @return [Symbol, String, Anthropic::Models::Model]
|
|
144
144
|
required :model, union: -> { Anthropic::Model }
|
|
145
145
|
|
|
146
|
+
# @!attribute cache_control
|
|
147
|
+
# Top-level cache control automatically applies a cache_control marker to the last
|
|
148
|
+
# cacheable block in the request.
|
|
149
|
+
#
|
|
150
|
+
# @return [Anthropic::Models::CacheControlEphemeral, nil]
|
|
151
|
+
optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
|
|
152
|
+
|
|
146
153
|
# @!attribute container
|
|
147
154
|
# Container identifier for reuse across requests.
|
|
148
155
|
#
|
|
@@ -352,7 +359,7 @@ module Anthropic
|
|
|
352
359
|
# @return [Float, nil]
|
|
353
360
|
optional :top_p, Float
|
|
354
361
|
|
|
355
|
-
# @!method initialize(max_tokens:, messages:, model:, container: nil, inference_geo: nil, metadata: nil, output_config: nil, service_tier: nil, stop_sequences: nil, stream: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil)
|
|
362
|
+
# @!method initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, inference_geo: nil, metadata: nil, output_config: nil, service_tier: nil, stop_sequences: nil, stream: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil)
|
|
356
363
|
# Some parameter documentations has been truncated, see
|
|
357
364
|
# {Anthropic::Models::Messages::BatchCreateParams::Request::Params} for more
|
|
358
365
|
# details.
|
|
@@ -368,6 +375,8 @@ module Anthropic
|
|
|
368
375
|
#
|
|
369
376
|
# @param model [Symbol, String, Anthropic::Models::Model] The model that will complete your prompt.\n\nSee [models](https://docs.anthropic
|
|
370
377
|
#
|
|
378
|
+
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Top-level cache control automatically applies a cache_control marker to the last
|
|
379
|
+
#
|
|
371
380
|
# @param container [String, nil] Container identifier for reuse across requests.
|
|
372
381
|
#
|
|
373
382
|
# @param inference_geo [String, nil] Specifies the geographic region for inference processing. If not specified, the
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
class UserLocation < Anthropic::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute type
|
|
7
|
+
#
|
|
8
|
+
# @return [Symbol, :approximate]
|
|
9
|
+
required :type, const: :approximate
|
|
10
|
+
|
|
11
|
+
# @!attribute city
|
|
12
|
+
# The city of the user.
|
|
13
|
+
#
|
|
14
|
+
# @return [String, nil]
|
|
15
|
+
optional :city, String, nil?: true
|
|
16
|
+
|
|
17
|
+
# @!attribute country
|
|
18
|
+
# The two letter
|
|
19
|
+
# [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
|
|
20
|
+
# user.
|
|
21
|
+
#
|
|
22
|
+
# @return [String, nil]
|
|
23
|
+
optional :country, String, nil?: true
|
|
24
|
+
|
|
25
|
+
# @!attribute region
|
|
26
|
+
# The region of the user.
|
|
27
|
+
#
|
|
28
|
+
# @return [String, nil]
|
|
29
|
+
optional :region, String, nil?: true
|
|
30
|
+
|
|
31
|
+
# @!attribute timezone
|
|
32
|
+
# The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
|
33
|
+
#
|
|
34
|
+
# @return [String, nil]
|
|
35
|
+
optional :timezone, String, nil?: true
|
|
36
|
+
|
|
37
|
+
# @!method initialize(city: nil, country: nil, region: nil, timezone: nil, type: :approximate)
|
|
38
|
+
# Some parameter documentations has been truncated, see
|
|
39
|
+
# {Anthropic::Models::UserLocation} for more details.
|
|
40
|
+
#
|
|
41
|
+
# @param city [String, nil] The city of the user.
|
|
42
|
+
#
|
|
43
|
+
# @param country [String, nil] The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha
|
|
44
|
+
#
|
|
45
|
+
# @param region [String, nil] The region of the user.
|
|
46
|
+
#
|
|
47
|
+
# @param timezone [String, nil] The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
|
48
|
+
#
|
|
49
|
+
# @param type [Symbol, :approximate]
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -65,8 +65,8 @@ module Anthropic
|
|
|
65
65
|
# Parameters for the user's location. Used to provide more relevant search
|
|
66
66
|
# results.
|
|
67
67
|
#
|
|
68
|
-
# @return [Anthropic::Models::
|
|
69
|
-
optional :user_location, -> { Anthropic::
|
|
68
|
+
# @return [Anthropic::Models::UserLocation, nil]
|
|
69
|
+
optional :user_location, -> { Anthropic::UserLocation }, nil?: true
|
|
70
70
|
|
|
71
71
|
# @!method initialize(allowed_callers: nil, allowed_domains: nil, blocked_domains: nil, cache_control: nil, defer_loading: nil, max_uses: nil, strict: nil, user_location: nil, name: :web_search, type: :web_search_20250305)
|
|
72
72
|
# Some parameter documentations has been truncated, see
|
|
@@ -86,7 +86,7 @@ module Anthropic
|
|
|
86
86
|
#
|
|
87
87
|
# @param strict [Boolean] When true, guarantees schema validation on tool names and inputs
|
|
88
88
|
#
|
|
89
|
-
# @param user_location [Anthropic::Models::
|
|
89
|
+
# @param user_location [Anthropic::Models::UserLocation, nil] Parameters for the user's location. Used to provide more relevant search results
|
|
90
90
|
#
|
|
91
91
|
# @param name [Symbol, :web_search] Name of the tool.
|
|
92
92
|
#
|
|
@@ -103,56 +103,8 @@ module Anthropic
|
|
|
103
103
|
# @return [Array<Symbol>]
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
# @
|
|
107
|
-
|
|
108
|
-
# @!attribute type
|
|
109
|
-
#
|
|
110
|
-
# @return [Symbol, :approximate]
|
|
111
|
-
required :type, const: :approximate
|
|
112
|
-
|
|
113
|
-
# @!attribute city
|
|
114
|
-
# The city of the user.
|
|
115
|
-
#
|
|
116
|
-
# @return [String, nil]
|
|
117
|
-
optional :city, String, nil?: true
|
|
118
|
-
|
|
119
|
-
# @!attribute country
|
|
120
|
-
# The two letter
|
|
121
|
-
# [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
|
|
122
|
-
# user.
|
|
123
|
-
#
|
|
124
|
-
# @return [String, nil]
|
|
125
|
-
optional :country, String, nil?: true
|
|
126
|
-
|
|
127
|
-
# @!attribute region
|
|
128
|
-
# The region of the user.
|
|
129
|
-
#
|
|
130
|
-
# @return [String, nil]
|
|
131
|
-
optional :region, String, nil?: true
|
|
132
|
-
|
|
133
|
-
# @!attribute timezone
|
|
134
|
-
# The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
|
135
|
-
#
|
|
136
|
-
# @return [String, nil]
|
|
137
|
-
optional :timezone, String, nil?: true
|
|
138
|
-
|
|
139
|
-
# @!method initialize(city: nil, country: nil, region: nil, timezone: nil, type: :approximate)
|
|
140
|
-
# Some parameter documentations has been truncated, see
|
|
141
|
-
# {Anthropic::Models::WebSearchTool20250305::UserLocation} for more details.
|
|
142
|
-
#
|
|
143
|
-
# Parameters for the user's location. Used to provide more relevant search
|
|
144
|
-
# results.
|
|
145
|
-
#
|
|
146
|
-
# @param city [String, nil] The city of the user.
|
|
147
|
-
#
|
|
148
|
-
# @param country [String, nil] The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha
|
|
149
|
-
#
|
|
150
|
-
# @param region [String, nil] The region of the user.
|
|
151
|
-
#
|
|
152
|
-
# @param timezone [String, nil] The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
|
153
|
-
#
|
|
154
|
-
# @param type [Symbol, :approximate]
|
|
155
|
-
end
|
|
106
|
+
# @deprecated Use {Anthropic::Models::UserLocation} instead.
|
|
107
|
+
UserLocation = Anthropic::Models::UserLocation
|
|
156
108
|
end
|
|
157
109
|
end
|
|
158
110
|
end
|
|
@@ -65,8 +65,8 @@ module Anthropic
|
|
|
65
65
|
# Parameters for the user's location. Used to provide more relevant search
|
|
66
66
|
# results.
|
|
67
67
|
#
|
|
68
|
-
# @return [Anthropic::Models::
|
|
69
|
-
optional :user_location, -> { Anthropic::
|
|
68
|
+
# @return [Anthropic::Models::UserLocation, nil]
|
|
69
|
+
optional :user_location, -> { Anthropic::UserLocation }, nil?: true
|
|
70
70
|
|
|
71
71
|
# @!method initialize(allowed_callers: nil, allowed_domains: nil, blocked_domains: nil, cache_control: nil, defer_loading: nil, max_uses: nil, strict: nil, user_location: nil, name: :web_search, type: :web_search_20260209)
|
|
72
72
|
# Some parameter documentations has been truncated, see
|
|
@@ -86,7 +86,7 @@ module Anthropic
|
|
|
86
86
|
#
|
|
87
87
|
# @param strict [Boolean] When true, guarantees schema validation on tool names and inputs
|
|
88
88
|
#
|
|
89
|
-
# @param user_location [Anthropic::Models::
|
|
89
|
+
# @param user_location [Anthropic::Models::UserLocation, nil] Parameters for the user's location. Used to provide more relevant search results
|
|
90
90
|
#
|
|
91
91
|
# @param name [Symbol, :web_search] Name of the tool.
|
|
92
92
|
#
|
|
@@ -103,56 +103,8 @@ module Anthropic
|
|
|
103
103
|
# @return [Array<Symbol>]
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
# @
|
|
107
|
-
|
|
108
|
-
# @!attribute type
|
|
109
|
-
#
|
|
110
|
-
# @return [Symbol, :approximate]
|
|
111
|
-
required :type, const: :approximate
|
|
112
|
-
|
|
113
|
-
# @!attribute city
|
|
114
|
-
# The city of the user.
|
|
115
|
-
#
|
|
116
|
-
# @return [String, nil]
|
|
117
|
-
optional :city, String, nil?: true
|
|
118
|
-
|
|
119
|
-
# @!attribute country
|
|
120
|
-
# The two letter
|
|
121
|
-
# [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
|
|
122
|
-
# user.
|
|
123
|
-
#
|
|
124
|
-
# @return [String, nil]
|
|
125
|
-
optional :country, String, nil?: true
|
|
126
|
-
|
|
127
|
-
# @!attribute region
|
|
128
|
-
# The region of the user.
|
|
129
|
-
#
|
|
130
|
-
# @return [String, nil]
|
|
131
|
-
optional :region, String, nil?: true
|
|
132
|
-
|
|
133
|
-
# @!attribute timezone
|
|
134
|
-
# The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
|
135
|
-
#
|
|
136
|
-
# @return [String, nil]
|
|
137
|
-
optional :timezone, String, nil?: true
|
|
138
|
-
|
|
139
|
-
# @!method initialize(city: nil, country: nil, region: nil, timezone: nil, type: :approximate)
|
|
140
|
-
# Some parameter documentations has been truncated, see
|
|
141
|
-
# {Anthropic::Models::WebSearchTool20260209::UserLocation} for more details.
|
|
142
|
-
#
|
|
143
|
-
# Parameters for the user's location. Used to provide more relevant search
|
|
144
|
-
# results.
|
|
145
|
-
#
|
|
146
|
-
# @param city [String, nil] The city of the user.
|
|
147
|
-
#
|
|
148
|
-
# @param country [String, nil] The two letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha
|
|
149
|
-
#
|
|
150
|
-
# @param region [String, nil] The region of the user.
|
|
151
|
-
#
|
|
152
|
-
# @param timezone [String, nil] The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
|
153
|
-
#
|
|
154
|
-
# @param type [Symbol, :approximate]
|
|
155
|
-
end
|
|
106
|
+
# @deprecated Use {Anthropic::Models::UserLocation} instead.
|
|
107
|
+
UserLocation = Anthropic::Models::UserLocation
|
|
156
108
|
end
|
|
157
109
|
end
|
|
158
110
|
end
|
|
@@ -5,8 +5,8 @@ module Anthropic
|
|
|
5
5
|
class WebSearchToolRequestError < Anthropic::Internal::Type::BaseModel
|
|
6
6
|
# @!attribute error_code
|
|
7
7
|
#
|
|
8
|
-
# @return [Symbol, Anthropic::Models::
|
|
9
|
-
required :error_code, enum: -> { Anthropic::
|
|
8
|
+
# @return [Symbol, Anthropic::Models::WebSearchToolResultErrorCode]
|
|
9
|
+
required :error_code, enum: -> { Anthropic::WebSearchToolResultErrorCode }
|
|
10
10
|
|
|
11
11
|
# @!attribute type
|
|
12
12
|
#
|
|
@@ -14,23 +14,8 @@ module Anthropic
|
|
|
14
14
|
required :type, const: :web_search_tool_result_error
|
|
15
15
|
|
|
16
16
|
# @!method initialize(error_code:, type: :web_search_tool_result_error)
|
|
17
|
-
# @param error_code [Symbol, Anthropic::Models::
|
|
17
|
+
# @param error_code [Symbol, Anthropic::Models::WebSearchToolResultErrorCode]
|
|
18
18
|
# @param type [Symbol, :web_search_tool_result_error]
|
|
19
|
-
|
|
20
|
-
# @see Anthropic::Models::WebSearchToolRequestError#error_code
|
|
21
|
-
module ErrorCode
|
|
22
|
-
extend Anthropic::Internal::Type::Enum
|
|
23
|
-
|
|
24
|
-
INVALID_TOOL_INPUT = :invalid_tool_input
|
|
25
|
-
UNAVAILABLE = :unavailable
|
|
26
|
-
MAX_USES_EXCEEDED = :max_uses_exceeded
|
|
27
|
-
TOO_MANY_REQUESTS = :too_many_requests
|
|
28
|
-
QUERY_TOO_LONG = :query_too_long
|
|
29
|
-
REQUEST_TOO_LARGE = :request_too_large
|
|
30
|
-
|
|
31
|
-
# @!method self.values
|
|
32
|
-
# @return [Array<Symbol>]
|
|
33
|
-
end
|
|
34
19
|
end
|
|
35
20
|
end
|
|
36
21
|
end
|
|
@@ -5,8 +5,8 @@ module Anthropic
|
|
|
5
5
|
class WebSearchToolResultError < Anthropic::Internal::Type::BaseModel
|
|
6
6
|
# @!attribute error_code
|
|
7
7
|
#
|
|
8
|
-
# @return [Symbol, Anthropic::Models::
|
|
9
|
-
required :error_code, enum: -> { Anthropic::
|
|
8
|
+
# @return [Symbol, Anthropic::Models::WebSearchToolResultErrorCode]
|
|
9
|
+
required :error_code, enum: -> { Anthropic::WebSearchToolResultErrorCode }
|
|
10
10
|
|
|
11
11
|
# @!attribute type
|
|
12
12
|
#
|
|
@@ -14,23 +14,8 @@ module Anthropic
|
|
|
14
14
|
required :type, const: :web_search_tool_result_error
|
|
15
15
|
|
|
16
16
|
# @!method initialize(error_code:, type: :web_search_tool_result_error)
|
|
17
|
-
# @param error_code [Symbol, Anthropic::Models::
|
|
17
|
+
# @param error_code [Symbol, Anthropic::Models::WebSearchToolResultErrorCode]
|
|
18
18
|
# @param type [Symbol, :web_search_tool_result_error]
|
|
19
|
-
|
|
20
|
-
# @see Anthropic::Models::WebSearchToolResultError#error_code
|
|
21
|
-
module ErrorCode
|
|
22
|
-
extend Anthropic::Internal::Type::Enum
|
|
23
|
-
|
|
24
|
-
INVALID_TOOL_INPUT = :invalid_tool_input
|
|
25
|
-
UNAVAILABLE = :unavailable
|
|
26
|
-
MAX_USES_EXCEEDED = :max_uses_exceeded
|
|
27
|
-
TOO_MANY_REQUESTS = :too_many_requests
|
|
28
|
-
QUERY_TOO_LONG = :query_too_long
|
|
29
|
-
REQUEST_TOO_LARGE = :request_too_large
|
|
30
|
-
|
|
31
|
-
# @!method self.values
|
|
32
|
-
# @return [Array<Symbol>]
|
|
33
|
-
end
|
|
34
19
|
end
|
|
35
20
|
end
|
|
36
21
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
module WebSearchToolResultErrorCode
|
|
6
|
+
extend Anthropic::Internal::Type::Enum
|
|
7
|
+
|
|
8
|
+
INVALID_TOOL_INPUT = :invalid_tool_input
|
|
9
|
+
UNAVAILABLE = :unavailable
|
|
10
|
+
MAX_USES_EXCEEDED = :max_uses_exceeded
|
|
11
|
+
TOO_MANY_REQUESTS = :too_many_requests
|
|
12
|
+
QUERY_TOO_LONG = :query_too_long
|
|
13
|
+
REQUEST_TOO_LARGE = :request_too_large
|
|
14
|
+
|
|
15
|
+
# @!method self.values
|
|
16
|
+
# @return [Array<Symbol>]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# @deprecated Use {Anthropic::Models::WebSearchToolResultErrorCode} instead.
|
|
20
|
+
WebSearchToolRequestError::ErrorCode = Anthropic::Models::WebSearchToolResultErrorCode
|
|
21
|
+
|
|
22
|
+
# @deprecated Use {Anthropic::Models::WebSearchToolResultErrorCode} instead.
|
|
23
|
+
WebSearchToolResultError::ErrorCode = Anthropic::Models::WebSearchToolResultErrorCode
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/anthropic/models.rb
CHANGED
|
@@ -378,6 +378,8 @@ module Anthropic
|
|
|
378
378
|
|
|
379
379
|
Usage = Anthropic::Models::Usage
|
|
380
380
|
|
|
381
|
+
UserLocation = Anthropic::Models::UserLocation
|
|
382
|
+
|
|
381
383
|
WebFetchBlock = Anthropic::Models::WebFetchBlock
|
|
382
384
|
|
|
383
385
|
WebFetchBlockParam = Anthropic::Models::WebFetchBlockParam
|
|
@@ -415,4 +417,6 @@ module Anthropic
|
|
|
415
417
|
WebSearchToolResultBlockParamContent = Anthropic::Models::WebSearchToolResultBlockParamContent
|
|
416
418
|
|
|
417
419
|
WebSearchToolResultError = Anthropic::Models::WebSearchToolResultError
|
|
420
|
+
|
|
421
|
+
WebSearchToolResultErrorCode = Anthropic::Models::WebSearchToolResultErrorCode
|
|
418
422
|
end
|
|
@@ -32,7 +32,7 @@ module Anthropic
|
|
|
32
32
|
# Learn more about the Messages API in our
|
|
33
33
|
# [user guide](https://docs.claude.com/en/docs/initial-setup)
|
|
34
34
|
#
|
|
35
|
-
# @overload create(max_tokens:, messages:, model:, container: nil, context_management: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
|
|
35
|
+
# @overload create(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
|
|
36
36
|
#
|
|
37
37
|
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
|
38
38
|
#
|
|
@@ -40,6 +40,8 @@ module Anthropic
|
|
|
40
40
|
#
|
|
41
41
|
# @param model [Symbol, String, Anthropic::Models::Model] Body param: The model that will complete your prompt.\n\nSee [models](https://do
|
|
42
42
|
#
|
|
43
|
+
# @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Body param: Top-level cache control automatically applies a cache_control marker
|
|
44
|
+
#
|
|
43
45
|
# @param container [Anthropic::Models::Beta::BetaContainerParams, String, nil] Body param: Container identifier for reuse across requests.
|
|
44
46
|
#
|
|
45
47
|
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Context management configuration.
|
|
@@ -136,7 +138,7 @@ module Anthropic
|
|
|
136
138
|
# Learn more about the Messages API in our
|
|
137
139
|
# [user guide](https://docs.claude.com/en/docs/initial-setup)
|
|
138
140
|
#
|
|
139
|
-
# @overload stream_raw(max_tokens:, messages:, model:, container: nil, context_management: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
|
|
141
|
+
# @overload stream_raw(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
|
|
140
142
|
#
|
|
141
143
|
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
|
142
144
|
#
|
|
@@ -144,6 +146,8 @@ module Anthropic
|
|
|
144
146
|
#
|
|
145
147
|
# @param model [Symbol, String, Anthropic::Models::Model] Body param: The model that will complete your prompt.\n\nSee [models](https://do
|
|
146
148
|
#
|
|
149
|
+
# @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Body param: Top-level cache control automatically applies a cache_control marker
|
|
150
|
+
#
|
|
147
151
|
# @param container [Anthropic::Models::Beta::BetaContainerParams, String, nil] Body param: Container identifier for reuse across requests.
|
|
148
152
|
#
|
|
149
153
|
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Context management configuration.
|
|
@@ -307,12 +311,14 @@ module Anthropic
|
|
|
307
311
|
# Learn more about token counting in our
|
|
308
312
|
# [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
|
|
309
313
|
#
|
|
310
|
-
# @overload count_tokens(messages:, model:, context_management: nil, mcp_servers: nil, output_config: nil, output_format: nil, speed: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
|
|
314
|
+
# @overload count_tokens(messages:, model:, cache_control: nil, context_management: nil, mcp_servers: nil, output_config: nil, output_format: nil, speed: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
|
|
311
315
|
#
|
|
312
316
|
# @param messages [Array<Anthropic::Models::Beta::BetaMessageParam>] Body param: Input messages.
|
|
313
317
|
#
|
|
314
318
|
# @param model [Symbol, String, Anthropic::Models::Model] Body param: The model that will complete your prompt.\n\nSee [models](https://do
|
|
315
319
|
#
|
|
320
|
+
# @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Body param: Top-level cache control automatically applies a cache_control marker
|
|
321
|
+
#
|
|
316
322
|
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Context management configuration.
|
|
317
323
|
#
|
|
318
324
|
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
|