anthropic 1.8.0 → 1.10.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 +42 -0
- data/README.md +12 -12
- data/lib/anthropic/errors.rb +25 -11
- data/lib/anthropic/internal/page.rb +1 -1
- data/lib/anthropic/internal/stream.rb +1 -0
- data/lib/anthropic/internal/transport/base_client.rb +11 -7
- data/lib/anthropic/internal/type/base_page.rb +1 -1
- data/lib/anthropic/internal/type/base_stream.rb +9 -1
- data/lib/anthropic/internal/util.rb +3 -2
- data/lib/anthropic/models/beta/beta_citation_config.rb +19 -0
- data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rb +98 -0
- data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rb +38 -0
- data/lib/anthropic/models/beta/beta_content_block.rb +3 -1
- data/lib/anthropic/models/beta/beta_content_block_param.rb +3 -1
- data/lib/anthropic/models/beta/beta_context_management_config.rb +22 -0
- data/lib/anthropic/models/beta/beta_context_management_response.rb +23 -0
- data/lib/anthropic/models/beta/beta_count_tokens_context_management_response.rb +20 -0
- data/lib/anthropic/models/beta/beta_document_block.rb +56 -0
- data/lib/anthropic/models/beta/beta_input_tokens_clear_at_least.rb +25 -0
- data/lib/anthropic/models/beta/beta_input_tokens_trigger.rb +25 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +40 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_command.rb +30 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_create_command.rb +36 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rb +28 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rb +44 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rb +36 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rb +44 -0
- data/lib/anthropic/models/beta/beta_memory_tool_20250818_view_command.rb +36 -0
- data/lib/anthropic/models/beta/beta_message.rb +11 -3
- data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
- data/lib/anthropic/models/beta/beta_message_tokens_count.rb +13 -1
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +5 -3
- data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +9 -1
- data/lib/anthropic/models/beta/beta_request_document_block.rb +2 -2
- data/lib/anthropic/models/beta/beta_server_tool_usage.rb +9 -1
- data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +1 -0
- data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +1 -0
- data/lib/anthropic/models/beta/beta_stop_reason.rb +1 -0
- data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +6 -4
- data/lib/anthropic/models/beta/beta_tool_union.rb +5 -1
- data/lib/anthropic/models/beta/beta_tool_uses_keep.rb +25 -0
- data/lib/anthropic/models/beta/beta_tool_uses_trigger.rb +25 -0
- data/lib/anthropic/models/beta/beta_web_fetch_block.rb +42 -0
- data/lib/anthropic/models/beta/beta_web_fetch_block_param.rb +42 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +82 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block.rb +43 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rb +53 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rb +25 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rb +25 -0
- data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rb +25 -0
- data/lib/anthropic/models/beta/message_count_tokens_params.rb +16 -4
- data/lib/anthropic/models/beta/message_create_params.rb +11 -3
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +11 -3
- data/lib/anthropic/models/document_block_param.rb +2 -2
- data/lib/anthropic/models/model.rb +10 -0
- data/lib/anthropic/models/stop_reason.rb +1 -0
- data/lib/anthropic/models/tool_result_block_param.rb +6 -4
- data/lib/anthropic/resources/beta/messages.rb +12 -6
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +27 -0
- data/rbi/anthropic/errors.rbi +29 -2
- data/rbi/anthropic/internal/transport/base_client.rbi +4 -5
- data/rbi/anthropic/internal/type/base_page.rbi +1 -1
- data/rbi/anthropic/internal/type/base_stream.rbi +16 -1
- data/rbi/anthropic/internal/util.rbi +1 -1
- data/rbi/anthropic/models/beta/beta_citation_config.rbi +30 -0
- data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbi +183 -0
- data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbi +62 -0
- data/rbi/anthropic/models/beta/beta_content_block.rbi +1 -0
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +1 -0
- data/rbi/anthropic/models/beta/beta_context_management_config.rbi +56 -0
- data/rbi/anthropic/models/beta/beta_context_management_response.rbi +53 -0
- data/rbi/anthropic/models/beta/beta_count_tokens_context_management_response.rbi +35 -0
- data/rbi/anthropic/models/beta/beta_document_block.rbi +95 -0
- data/rbi/anthropic/models/beta/beta_input_tokens_clear_at_least.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_input_tokens_trigger.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +72 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_command.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbi +53 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbi +41 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbi +69 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbi +55 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbi +64 -0
- data/rbi/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbi +59 -0
- data/rbi/anthropic/models/beta/beta_message.rbi +21 -0
- data/rbi/anthropic/models/beta/beta_message_tokens_count.rbi +40 -2
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +2 -0
- data/rbi/anthropic/models/beta/beta_raw_message_delta_event.rbi +20 -0
- data/rbi/anthropic/models/beta/beta_request_document_block.rbi +5 -3
- data/rbi/anthropic/models/beta/beta_server_tool_usage.rbi +17 -2
- data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +5 -0
- data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +5 -0
- data/rbi/anthropic/models/beta/beta_stop_reason.rbi +5 -0
- data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_tool_union.rbi +3 -1
- data/rbi/anthropic/models/beta/beta_tool_uses_keep.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_tool_uses_trigger.rbi +33 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_block.rbi +67 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_block_param.rbi +71 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +125 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block.rbi +81 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbi +109 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbi +51 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbi +50 -0
- data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbi +70 -0
- data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +33 -5
- data/rbi/anthropic/models/beta/message_create_params.rbi +30 -4
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +36 -4
- data/rbi/anthropic/models/document_block_param.rbi +7 -3
- data/rbi/anthropic/models/model.rbi +8 -0
- data/rbi/anthropic/models/stop_reason.rbi +5 -0
- data/rbi/anthropic/models/tool_result_block_param.rbi +2 -1
- data/rbi/anthropic/resources/beta/messages.rbi +21 -3
- data/sig/anthropic/errors.rbs +7 -0
- data/sig/anthropic/internal/type/base_stream.rbs +5 -0
- data/sig/anthropic/models/beta/beta_citation_config.rbs +17 -0
- data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit.rbs +77 -0
- data/sig/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbs +34 -0
- data/sig/anthropic/models/beta/beta_content_block.rbs +1 -0
- data/sig/anthropic/models/beta/beta_content_block_param.rbs +1 -0
- data/sig/anthropic/models/beta/beta_context_management_config.rbs +26 -0
- data/sig/anthropic/models/beta/beta_context_management_response.rbs +24 -0
- data/sig/anthropic/models/beta/beta_count_tokens_context_management_response.rbs +18 -0
- data/sig/anthropic/models/beta/beta_document_block.rbs +49 -0
- data/sig/anthropic/models/beta/beta_input_tokens_clear_at_least.rbs +20 -0
- data/sig/anthropic/models/beta/beta_input_tokens_trigger.rbs +19 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +34 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_command.rbs +21 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_create_command.rbs +26 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_delete_command.rbs +20 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_insert_command.rbs +39 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_rename_command.rbs +26 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_str_replace_command.rbs +39 -0
- data/sig/anthropic/models/beta/beta_memory_tool_20250818_view_command.rbs +32 -0
- data/sig/anthropic/models/beta/beta_message.rbs +5 -0
- data/sig/anthropic/models/beta/beta_message_tokens_count.rbs +15 -3
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +1 -0
- data/sig/anthropic/models/beta/beta_raw_message_delta_event.rbs +5 -0
- data/sig/anthropic/models/beta/beta_request_document_block.rbs +4 -8
- data/sig/anthropic/models/beta/beta_server_tool_usage.rbs +12 -3
- data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +2 -0
- data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +2 -0
- data/sig/anthropic/models/beta/beta_stop_reason.rbs +2 -0
- data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
- data/sig/anthropic/models/beta/beta_tool_union.rbs +2 -0
- data/sig/anthropic/models/beta/beta_tool_uses_keep.rbs +19 -0
- data/sig/anthropic/models/beta/beta_tool_uses_trigger.rbs +19 -0
- data/sig/anthropic/models/beta/beta_web_fetch_block.rbs +39 -0
- data/sig/anthropic/models/beta/beta_web_fetch_block_param.rbs +39 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +59 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block.rbs +44 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbs +49 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbs +29 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbs +29 -0
- data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbs +32 -0
- data/sig/anthropic/models/beta/message_count_tokens_params.rbs +7 -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/document_block_param.rbs +4 -8
- data/sig/anthropic/models/model.rbs +8 -0
- data/sig/anthropic/models/stop_reason.rbs +2 -0
- data/sig/anthropic/models/tool_result_block_param.rbs +1 -0
- data/sig/anthropic/resources/beta/messages.rbs +3 -0
- metadata +83 -2
|
@@ -159,6 +159,12 @@ module Anthropic
|
|
|
159
159
|
# @return [String, nil]
|
|
160
160
|
optional :container, String, nil?: true
|
|
161
161
|
|
|
162
|
+
# @!attribute context_management
|
|
163
|
+
# Configuration for context management operations.
|
|
164
|
+
#
|
|
165
|
+
# @return [Anthropic::Models::Beta::BetaContextManagementConfig, nil]
|
|
166
|
+
optional :context_management, -> { Anthropic::Beta::BetaContextManagementConfig }, nil?: true
|
|
167
|
+
|
|
162
168
|
# @!attribute mcp_servers
|
|
163
169
|
# MCP servers to be utilized in this request
|
|
164
170
|
#
|
|
@@ -329,7 +335,7 @@ module Anthropic
|
|
|
329
335
|
#
|
|
330
336
|
# See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
|
331
337
|
#
|
|
332
|
-
# @return [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305>, nil]
|
|
338
|
+
# @return [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>, nil]
|
|
333
339
|
optional :tools, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaToolUnion] }
|
|
334
340
|
|
|
335
341
|
# @!attribute top_k
|
|
@@ -358,7 +364,7 @@ module Anthropic
|
|
|
358
364
|
# @return [Float, nil]
|
|
359
365
|
optional :top_p, Float
|
|
360
366
|
|
|
361
|
-
# @!method initialize(max_tokens:, messages:, model:, container: nil, mcp_servers: nil, metadata: 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)
|
|
367
|
+
# @!method initialize(max_tokens:, messages:, model:, container: nil, context_management: nil, mcp_servers: nil, metadata: 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
368
|
# Some parameter documentations has been truncated, see
|
|
363
369
|
# {Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params} for more
|
|
364
370
|
# details.
|
|
@@ -376,6 +382,8 @@ module Anthropic
|
|
|
376
382
|
#
|
|
377
383
|
# @param container [String, nil] Container identifier for reuse across requests.
|
|
378
384
|
#
|
|
385
|
+
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Configuration for context management operations.
|
|
386
|
+
#
|
|
379
387
|
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] MCP servers to be utilized in this request
|
|
380
388
|
#
|
|
381
389
|
# @param metadata [Anthropic::Models::Beta::BetaMetadata] An object describing metadata about the request.
|
|
@@ -394,7 +402,7 @@ module Anthropic
|
|
|
394
402
|
#
|
|
395
403
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] How the model should use the provided tools. The model can use a specific tool,
|
|
396
404
|
#
|
|
397
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305>] Definitions of tools that the model may use.
|
|
405
|
+
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Definitions of tools that the model may use.
|
|
398
406
|
#
|
|
399
407
|
# @param top_k [Integer] Only sample from the top K options for each subsequent token.
|
|
400
408
|
#
|
|
@@ -22,7 +22,7 @@ module Anthropic
|
|
|
22
22
|
# @!attribute citations
|
|
23
23
|
#
|
|
24
24
|
# @return [Anthropic::Models::CitationsConfigParam, nil]
|
|
25
|
-
optional :citations, -> { Anthropic::CitationsConfigParam }
|
|
25
|
+
optional :citations, -> { Anthropic::CitationsConfigParam }, nil?: true
|
|
26
26
|
|
|
27
27
|
# @!attribute context
|
|
28
28
|
#
|
|
@@ -39,7 +39,7 @@ module Anthropic
|
|
|
39
39
|
#
|
|
40
40
|
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
|
41
41
|
#
|
|
42
|
-
# @param citations [Anthropic::Models::CitationsConfigParam]
|
|
42
|
+
# @param citations [Anthropic::Models::CitationsConfigParam, nil]
|
|
43
43
|
#
|
|
44
44
|
# @param context [String, nil]
|
|
45
45
|
#
|
|
@@ -22,6 +22,10 @@ module Anthropic
|
|
|
22
22
|
|
|
23
23
|
variant const: -> { Anthropic::Models::Model::CLAUDE_4_SONNET_20250514 }
|
|
24
24
|
|
|
25
|
+
variant const: -> { Anthropic::Models::Model::CLAUDE_SONNET_4_5 }
|
|
26
|
+
|
|
27
|
+
variant const: -> { Anthropic::Models::Model::CLAUDE_SONNET_4_5_20250929 }
|
|
28
|
+
|
|
25
29
|
variant const: -> { Anthropic::Models::Model::CLAUDE_3_5_SONNET_LATEST }
|
|
26
30
|
|
|
27
31
|
variant const: -> { Anthropic::Models::Model::CLAUDE_3_5_SONNET_20241022 }
|
|
@@ -74,6 +78,12 @@ module Anthropic
|
|
|
74
78
|
# High-performance model with extended thinking
|
|
75
79
|
CLAUDE_4_SONNET_20250514 = :"claude-4-sonnet-20250514"
|
|
76
80
|
|
|
81
|
+
# Our best model for real-world agents and coding
|
|
82
|
+
CLAUDE_SONNET_4_5 = :"claude-sonnet-4-5"
|
|
83
|
+
|
|
84
|
+
# Our best model for real-world agents and coding
|
|
85
|
+
CLAUDE_SONNET_4_5_20250929 = :"claude-sonnet-4-5-20250929"
|
|
86
|
+
|
|
77
87
|
# Our previous most intelligent model
|
|
78
88
|
CLAUDE_3_5_SONNET_LATEST = :"claude-3-5-sonnet-latest"
|
|
79
89
|
|
|
@@ -21,7 +21,7 @@ module Anthropic
|
|
|
21
21
|
|
|
22
22
|
# @!attribute content
|
|
23
23
|
#
|
|
24
|
-
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam>, nil]
|
|
24
|
+
# @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam>, nil]
|
|
25
25
|
optional :content, union: -> { Anthropic::ToolResultBlockParam::Content }
|
|
26
26
|
|
|
27
27
|
# @!attribute is_error
|
|
@@ -34,7 +34,7 @@ module Anthropic
|
|
|
34
34
|
#
|
|
35
35
|
# @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
|
|
36
36
|
#
|
|
37
|
-
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam>]
|
|
37
|
+
# @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam>]
|
|
38
38
|
#
|
|
39
39
|
# @param is_error [Boolean]
|
|
40
40
|
#
|
|
@@ -59,12 +59,14 @@ module Anthropic
|
|
|
59
59
|
|
|
60
60
|
variant :search_result, -> { Anthropic::SearchResultBlockParam }
|
|
61
61
|
|
|
62
|
+
variant :document, -> { Anthropic::DocumentBlockParam }
|
|
63
|
+
|
|
62
64
|
# @!method self.variants
|
|
63
|
-
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam)]
|
|
65
|
+
# @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam)]
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
# @!method self.variants
|
|
67
|
-
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam>)]
|
|
69
|
+
# @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam>)]
|
|
68
70
|
|
|
69
71
|
# @type [Anthropic::Internal::Type::Converter]
|
|
70
72
|
ContentArray =
|
|
@@ -20,7 +20,7 @@ module Anthropic
|
|
|
20
20
|
#
|
|
21
21
|
# Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
|
22
22
|
#
|
|
23
|
-
# @overload create(max_tokens:, messages:, model:, container: nil, mcp_servers: nil, 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, betas: nil, request_options: {})
|
|
23
|
+
# @overload create(max_tokens:, messages:, model:, container: nil, context_management: nil, mcp_servers: nil, 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, betas: nil, request_options: {})
|
|
24
24
|
#
|
|
25
25
|
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
|
26
26
|
#
|
|
@@ -30,6 +30,8 @@ module Anthropic
|
|
|
30
30
|
#
|
|
31
31
|
# @param container [String, nil] Body param: Container identifier for reuse across requests.
|
|
32
32
|
#
|
|
33
|
+
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Configuration for context management operations.
|
|
34
|
+
#
|
|
33
35
|
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
|
|
34
36
|
#
|
|
35
37
|
# @param metadata [Anthropic::Models::Beta::BetaMetadata] Body param: An object describing metadata about the request.
|
|
@@ -46,7 +48,7 @@ module Anthropic
|
|
|
46
48
|
#
|
|
47
49
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
|
48
50
|
#
|
|
49
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305>] Body param: Definitions of tools that the model may use.
|
|
51
|
+
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Body param: Definitions of tools that the model may use.
|
|
50
52
|
#
|
|
51
53
|
# @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
|
|
52
54
|
#
|
|
@@ -102,7 +104,7 @@ module Anthropic
|
|
|
102
104
|
#
|
|
103
105
|
# Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
|
104
106
|
#
|
|
105
|
-
# @overload stream_raw(max_tokens:, messages:, model:, container: nil, mcp_servers: nil, 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, betas: nil, request_options: {})
|
|
107
|
+
# @overload stream_raw(max_tokens:, messages:, model:, container: nil, context_management: nil, mcp_servers: nil, 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, betas: nil, request_options: {})
|
|
106
108
|
#
|
|
107
109
|
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
|
108
110
|
#
|
|
@@ -112,6 +114,8 @@ module Anthropic
|
|
|
112
114
|
#
|
|
113
115
|
# @param container [String, nil] Body param: Container identifier for reuse across requests.
|
|
114
116
|
#
|
|
117
|
+
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Configuration for context management operations.
|
|
118
|
+
#
|
|
115
119
|
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
|
|
116
120
|
#
|
|
117
121
|
# @param metadata [Anthropic::Models::Beta::BetaMetadata] Body param: An object describing metadata about the request.
|
|
@@ -128,7 +132,7 @@ module Anthropic
|
|
|
128
132
|
#
|
|
129
133
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
|
130
134
|
#
|
|
131
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305>] Body param: Definitions of tools that the model may use.
|
|
135
|
+
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Body param: Definitions of tools that the model may use.
|
|
132
136
|
#
|
|
133
137
|
# @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
|
|
134
138
|
#
|
|
@@ -245,12 +249,14 @@ module Anthropic
|
|
|
245
249
|
# Learn more about token counting in our
|
|
246
250
|
# [user guide](/en/docs/build-with-claude/token-counting)
|
|
247
251
|
#
|
|
248
|
-
# @overload count_tokens(messages:, model:, mcp_servers: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
|
|
252
|
+
# @overload count_tokens(messages:, model:, context_management: nil, mcp_servers: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
|
|
249
253
|
#
|
|
250
254
|
# @param messages [Array<Anthropic::Models::Beta::BetaMessageParam>] Body param: Input messages.
|
|
251
255
|
#
|
|
252
256
|
# @param model [Symbol, String, Anthropic::Models::Model] Body param: The model that will complete your prompt.\n\nSee [models](https://do
|
|
253
257
|
#
|
|
258
|
+
# @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Configuration for context management operations.
|
|
259
|
+
#
|
|
254
260
|
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
|
|
255
261
|
#
|
|
256
262
|
# @param system_ [String, Array<Anthropic::Models::Beta::BetaTextBlockParam>] Body param: System prompt.
|
|
@@ -259,7 +265,7 @@ module Anthropic
|
|
|
259
265
|
#
|
|
260
266
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
|
261
267
|
#
|
|
262
|
-
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305>] Body param: Definitions of tools that the model may use.
|
|
268
|
+
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Body param: Definitions of tools that the model may use.
|
|
263
269
|
#
|
|
264
270
|
# @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
|
|
265
271
|
#
|
data/lib/anthropic/version.rb
CHANGED
data/lib/anthropic.rb
CHANGED
|
@@ -79,6 +79,7 @@ require_relative "anthropic/models/beta/beta_cache_control_ephemeral"
|
|
|
79
79
|
require_relative "anthropic/models/beta/beta_cache_creation"
|
|
80
80
|
require_relative "anthropic/models/beta/beta_citation_char_location"
|
|
81
81
|
require_relative "anthropic/models/beta/beta_citation_char_location_param"
|
|
82
|
+
require_relative "anthropic/models/beta/beta_citation_config"
|
|
82
83
|
require_relative "anthropic/models/beta/beta_citation_content_block_location"
|
|
83
84
|
require_relative "anthropic/models/beta/beta_citation_content_block_location_param"
|
|
84
85
|
require_relative "anthropic/models/beta/beta_citation_page_location"
|
|
@@ -89,6 +90,8 @@ require_relative "anthropic/models/beta/beta_citation_search_result_location"
|
|
|
89
90
|
require_relative "anthropic/models/beta/beta_citation_search_result_location_param"
|
|
90
91
|
require_relative "anthropic/models/beta/beta_citations_web_search_result_location"
|
|
91
92
|
require_relative "anthropic/models/beta/beta_citation_web_search_result_location_param"
|
|
93
|
+
require_relative "anthropic/models/beta/beta_clear_tool_uses_20250919_edit"
|
|
94
|
+
require_relative "anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response"
|
|
92
95
|
require_relative "anthropic/models/beta/beta_code_execution_output_block"
|
|
93
96
|
require_relative "anthropic/models/beta/beta_code_execution_output_block_param"
|
|
94
97
|
require_relative "anthropic/models/beta/beta_code_execution_result_block"
|
|
@@ -109,13 +112,27 @@ require_relative "anthropic/models/beta/beta_content_block"
|
|
|
109
112
|
require_relative "anthropic/models/beta/beta_content_block_param"
|
|
110
113
|
require_relative "anthropic/models/beta/beta_content_block_source"
|
|
111
114
|
require_relative "anthropic/models/beta/beta_content_block_source_content"
|
|
115
|
+
require_relative "anthropic/models/beta/beta_context_management_config"
|
|
116
|
+
require_relative "anthropic/models/beta/beta_context_management_response"
|
|
117
|
+
require_relative "anthropic/models/beta/beta_count_tokens_context_management_response"
|
|
118
|
+
require_relative "anthropic/models/beta/beta_document_block"
|
|
112
119
|
require_relative "anthropic/models/beta/beta_file_document_source"
|
|
113
120
|
require_relative "anthropic/models/beta/beta_file_image_source"
|
|
114
121
|
require_relative "anthropic/models/beta/beta_image_block_param"
|
|
115
122
|
require_relative "anthropic/models/beta/beta_input_json_delta"
|
|
123
|
+
require_relative "anthropic/models/beta/beta_input_tokens_clear_at_least"
|
|
124
|
+
require_relative "anthropic/models/beta/beta_input_tokens_trigger"
|
|
116
125
|
require_relative "anthropic/models/beta/beta_mcp_tool_result_block"
|
|
117
126
|
require_relative "anthropic/models/beta/beta_mcp_tool_use_block"
|
|
118
127
|
require_relative "anthropic/models/beta/beta_mcp_tool_use_block_param"
|
|
128
|
+
require_relative "anthropic/models/beta/beta_memory_tool_20250818"
|
|
129
|
+
require_relative "anthropic/models/beta/beta_memory_tool_20250818_command"
|
|
130
|
+
require_relative "anthropic/models/beta/beta_memory_tool_20250818_create_command"
|
|
131
|
+
require_relative "anthropic/models/beta/beta_memory_tool_20250818_delete_command"
|
|
132
|
+
require_relative "anthropic/models/beta/beta_memory_tool_20250818_insert_command"
|
|
133
|
+
require_relative "anthropic/models/beta/beta_memory_tool_20250818_rename_command"
|
|
134
|
+
require_relative "anthropic/models/beta/beta_memory_tool_20250818_str_replace_command"
|
|
135
|
+
require_relative "anthropic/models/beta/beta_memory_tool_20250818_view_command"
|
|
119
136
|
require_relative "anthropic/models/beta/beta_message"
|
|
120
137
|
require_relative "anthropic/models/beta/beta_message_delta_usage"
|
|
121
138
|
require_relative "anthropic/models/beta/beta_message_param"
|
|
@@ -181,9 +198,19 @@ require_relative "anthropic/models/beta/beta_tool_text_editor_20250728"
|
|
|
181
198
|
require_relative "anthropic/models/beta/beta_tool_union"
|
|
182
199
|
require_relative "anthropic/models/beta/beta_tool_use_block"
|
|
183
200
|
require_relative "anthropic/models/beta/beta_tool_use_block_param"
|
|
201
|
+
require_relative "anthropic/models/beta/beta_tool_uses_keep"
|
|
202
|
+
require_relative "anthropic/models/beta/beta_tool_uses_trigger"
|
|
184
203
|
require_relative "anthropic/models/beta/beta_url_image_source"
|
|
185
204
|
require_relative "anthropic/models/beta/beta_url_pdf_source"
|
|
186
205
|
require_relative "anthropic/models/beta/beta_usage"
|
|
206
|
+
require_relative "anthropic/models/beta/beta_web_fetch_block"
|
|
207
|
+
require_relative "anthropic/models/beta/beta_web_fetch_block_param"
|
|
208
|
+
require_relative "anthropic/models/beta/beta_web_fetch_tool_20250910"
|
|
209
|
+
require_relative "anthropic/models/beta/beta_web_fetch_tool_result_block"
|
|
210
|
+
require_relative "anthropic/models/beta/beta_web_fetch_tool_result_block_param"
|
|
211
|
+
require_relative "anthropic/models/beta/beta_web_fetch_tool_result_error_block"
|
|
212
|
+
require_relative "anthropic/models/beta/beta_web_fetch_tool_result_error_block_param"
|
|
213
|
+
require_relative "anthropic/models/beta/beta_web_fetch_tool_result_error_code"
|
|
187
214
|
require_relative "anthropic/models/beta/beta_web_search_result_block"
|
|
188
215
|
require_relative "anthropic/models/beta/beta_web_search_result_block_param"
|
|
189
216
|
require_relative "anthropic/models/beta/beta_web_search_tool_20250305"
|
data/rbi/anthropic/errors.rbi
CHANGED
|
@@ -33,6 +33,9 @@ module Anthropic
|
|
|
33
33
|
sig { returns(T.nilable(Integer)) }
|
|
34
34
|
attr_accessor :status
|
|
35
35
|
|
|
36
|
+
sig { returns(T.nilable(T::Hash[String, String])) }
|
|
37
|
+
attr_accessor :headers
|
|
38
|
+
|
|
36
39
|
sig { returns(T.nilable(T.anything)) }
|
|
37
40
|
attr_accessor :body
|
|
38
41
|
|
|
@@ -41,6 +44,7 @@ module Anthropic
|
|
|
41
44
|
params(
|
|
42
45
|
url: URI::Generic,
|
|
43
46
|
status: T.nilable(Integer),
|
|
47
|
+
headers: T.nilable(T::Hash[String, String]),
|
|
44
48
|
body: T.nilable(Object),
|
|
45
49
|
request: NilClass,
|
|
46
50
|
response: NilClass,
|
|
@@ -50,6 +54,7 @@ module Anthropic
|
|
|
50
54
|
def self.new(
|
|
51
55
|
url:,
|
|
52
56
|
status: nil,
|
|
57
|
+
headers: nil,
|
|
53
58
|
body: nil,
|
|
54
59
|
request: nil,
|
|
55
60
|
response: nil,
|
|
@@ -70,6 +75,7 @@ module Anthropic
|
|
|
70
75
|
params(
|
|
71
76
|
url: URI::Generic,
|
|
72
77
|
status: NilClass,
|
|
78
|
+
headers: T.nilable(T::Hash[String, String]),
|
|
73
79
|
body: NilClass,
|
|
74
80
|
request: NilClass,
|
|
75
81
|
response: NilClass,
|
|
@@ -79,6 +85,7 @@ module Anthropic
|
|
|
79
85
|
def self.new(
|
|
80
86
|
url:,
|
|
81
87
|
status: nil,
|
|
88
|
+
headers: nil,
|
|
82
89
|
body: nil,
|
|
83
90
|
request: nil,
|
|
84
91
|
response: nil,
|
|
@@ -93,6 +100,7 @@ module Anthropic
|
|
|
93
100
|
params(
|
|
94
101
|
url: URI::Generic,
|
|
95
102
|
status: NilClass,
|
|
103
|
+
headers: T.nilable(T::Hash[String, String]),
|
|
96
104
|
body: NilClass,
|
|
97
105
|
request: NilClass,
|
|
98
106
|
response: NilClass,
|
|
@@ -102,6 +110,7 @@ module Anthropic
|
|
|
102
110
|
def self.new(
|
|
103
111
|
url:,
|
|
104
112
|
status: nil,
|
|
113
|
+
headers: nil,
|
|
105
114
|
body: nil,
|
|
106
115
|
request: nil,
|
|
107
116
|
response: nil,
|
|
@@ -116,13 +125,22 @@ module Anthropic
|
|
|
116
125
|
params(
|
|
117
126
|
url: URI::Generic,
|
|
118
127
|
status: Integer,
|
|
128
|
+
headers: T.nilable(T::Hash[String, String]),
|
|
119
129
|
body: T.nilable(Object),
|
|
120
130
|
request: NilClass,
|
|
121
131
|
response: NilClass,
|
|
122
132
|
message: T.nilable(String)
|
|
123
133
|
).returns(T.attached_class)
|
|
124
134
|
end
|
|
125
|
-
def self.for(
|
|
135
|
+
def self.for(
|
|
136
|
+
url:,
|
|
137
|
+
status:,
|
|
138
|
+
headers:,
|
|
139
|
+
body:,
|
|
140
|
+
request:,
|
|
141
|
+
response:,
|
|
142
|
+
message: nil
|
|
143
|
+
)
|
|
126
144
|
end
|
|
127
145
|
|
|
128
146
|
sig { returns(Integer) }
|
|
@@ -133,13 +151,22 @@ module Anthropic
|
|
|
133
151
|
params(
|
|
134
152
|
url: URI::Generic,
|
|
135
153
|
status: Integer,
|
|
154
|
+
headers: T.nilable(T::Hash[String, String]),
|
|
136
155
|
body: T.nilable(Object),
|
|
137
156
|
request: NilClass,
|
|
138
157
|
response: NilClass,
|
|
139
158
|
message: T.nilable(String)
|
|
140
159
|
).returns(T.attached_class)
|
|
141
160
|
end
|
|
142
|
-
def self.new(
|
|
161
|
+
def self.new(
|
|
162
|
+
url:,
|
|
163
|
+
status:,
|
|
164
|
+
headers:,
|
|
165
|
+
body:,
|
|
166
|
+
request:,
|
|
167
|
+
response:,
|
|
168
|
+
message: nil
|
|
169
|
+
)
|
|
143
170
|
end
|
|
144
171
|
end
|
|
145
172
|
|
|
@@ -92,10 +92,9 @@ module Anthropic
|
|
|
92
92
|
|
|
93
93
|
# @api private
|
|
94
94
|
sig do
|
|
95
|
-
params(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
).returns(T::Boolean)
|
|
95
|
+
params(status: Integer, headers: T::Hash[String, String]).returns(
|
|
96
|
+
T::Boolean
|
|
97
|
+
)
|
|
99
98
|
end
|
|
100
99
|
def should_retry?(status, headers:)
|
|
101
100
|
end
|
|
@@ -105,7 +104,7 @@ module Anthropic
|
|
|
105
104
|
params(
|
|
106
105
|
request: Anthropic::Internal::Transport::BaseClient::RequestInput,
|
|
107
106
|
status: Integer,
|
|
108
|
-
response_headers: T
|
|
107
|
+
response_headers: T::Hash[String, String]
|
|
109
108
|
).returns(Anthropic::Internal::Transport::BaseClient::RequestInput)
|
|
110
109
|
end
|
|
111
110
|
def follow_redirect(request, status:, response_headers:)
|
|
@@ -30,7 +30,7 @@ module Anthropic
|
|
|
30
30
|
params(
|
|
31
31
|
client: Anthropic::Internal::Transport::BaseClient,
|
|
32
32
|
req: Anthropic::Internal::Transport::BaseClient::RequestComponents,
|
|
33
|
-
headers: T
|
|
33
|
+
headers: T::Hash[String, String],
|
|
34
34
|
page_data: T.anything
|
|
35
35
|
).void
|
|
36
36
|
end
|
|
@@ -27,6 +27,12 @@ module Anthropic
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
sig { returns(Integer) }
|
|
31
|
+
attr_reader :status
|
|
32
|
+
|
|
33
|
+
sig { returns(T::Hash[String, String]) }
|
|
34
|
+
attr_reader :headers
|
|
35
|
+
|
|
30
36
|
sig { void }
|
|
31
37
|
def close
|
|
32
38
|
end
|
|
@@ -51,6 +57,7 @@ module Anthropic
|
|
|
51
57
|
T.any(T::Class[T.anything], Anthropic::Internal::Type::Converter),
|
|
52
58
|
url: URI::Generic,
|
|
53
59
|
status: Integer,
|
|
60
|
+
headers: T::Hash[String, String],
|
|
54
61
|
response: Net::HTTPResponse,
|
|
55
62
|
unwrap:
|
|
56
63
|
T.any(
|
|
@@ -62,7 +69,15 @@ module Anthropic
|
|
|
62
69
|
stream: T::Enumerable[Message]
|
|
63
70
|
).void
|
|
64
71
|
end
|
|
65
|
-
def initialize(
|
|
72
|
+
def initialize(
|
|
73
|
+
model:,
|
|
74
|
+
url:,
|
|
75
|
+
status:,
|
|
76
|
+
headers:,
|
|
77
|
+
response:,
|
|
78
|
+
unwrap:,
|
|
79
|
+
stream:
|
|
80
|
+
)
|
|
66
81
|
end
|
|
67
82
|
|
|
68
83
|
# @api private
|
|
@@ -361,7 +361,7 @@ module Anthropic
|
|
|
361
361
|
# Assumes each chunk in stream has `Encoding::BINARY`.
|
|
362
362
|
sig do
|
|
363
363
|
params(
|
|
364
|
-
headers: T
|
|
364
|
+
headers: T::Hash[String, String],
|
|
365
365
|
stream: T::Enumerable[String],
|
|
366
366
|
suppress_error: T::Boolean
|
|
367
367
|
).returns(T.anything)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaCitationConfig = Beta::BetaCitationConfig
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaCitationConfig < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaCitationConfig,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig { returns(T::Boolean) }
|
|
18
|
+
attr_accessor :enabled
|
|
19
|
+
|
|
20
|
+
sig { params(enabled: T::Boolean).returns(T.attached_class) }
|
|
21
|
+
def self.new(enabled:)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
sig { override.returns({ enabled: T::Boolean }) }
|
|
25
|
+
def to_hash
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|