anthropic 1.45.0 → 1.47.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 +16 -0
- data/README.md +1 -1
- data/lib/anthropic/helpers/streaming/message_stream.rb +4 -0
- data/lib/anthropic/models/anthropic_beta.rb +6 -0
- data/lib/anthropic/models/beta/agent_create_params.rb +8 -8
- data/lib/anthropic/models/beta/agent_update_params.rb +7 -10
- data/lib/anthropic/models/beta/beta_advisor_tool_20260301.rb +15 -1
- data/lib/anthropic/models/beta/beta_advisor_tool_result_error.rb +1 -0
- data/lib/anthropic/models/beta/beta_advisor_tool_result_error_param.rb +1 -0
- data/lib/anthropic/models/beta/beta_content_block.rb +14 -1
- data/lib/anthropic/models/beta/beta_content_block_param.rb +18 -1
- data/lib/anthropic/models/beta/beta_fallback_block.rb +54 -0
- data/lib/anthropic/models/beta/beta_fallback_block_param.rb +51 -0
- data/lib/anthropic/models/beta/beta_fallback_info.rb +28 -0
- data/lib/anthropic/models/beta/beta_fallback_info_param.rb +28 -0
- data/lib/anthropic/models/beta/beta_fallback_message_iteration_usage.rb +81 -0
- data/lib/anthropic/models/beta/beta_fallback_param.rb +88 -0
- data/lib/anthropic/models/beta/beta_iterations_usage.rb +9 -1
- data/lib/anthropic/models/beta/beta_managed_agents_custom_tool_input_schema.rb +10 -27
- data/lib/anthropic/models/beta/beta_managed_agents_model.rb +5 -0
- data/lib/anthropic/models/beta/beta_message.rb +2 -2
- data/lib/anthropic/models/beta/beta_message_delta_usage.rb +2 -2
- data/lib/anthropic/models/beta/beta_message_iteration_usage.rb +15 -1
- data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
- data/lib/anthropic/models/beta/beta_model_info.rb +11 -1
- data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +16 -3
- data/lib/anthropic/models/beta/beta_refusal_stop_details.rb +64 -1
- data/lib/anthropic/models/beta/beta_tool_search_tool_result_error_param.rb +7 -1
- data/lib/anthropic/models/beta/beta_usage.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_archived_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_created_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_deleted_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_idled_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_outcome_evaluation_ended_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_pending_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_requires_action_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_running_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_status_idled_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_status_rescheduled_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_status_run_started_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_status_terminated_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_thread_created_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_thread_idled_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_session_thread_terminated_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_vault_archived_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_vault_created_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_vault_credential_archived_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_vault_credential_created_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_vault_credential_deleted_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_vault_credential_refresh_failed_event_data.rb +2 -2
- data/lib/anthropic/models/beta/beta_webhook_vault_deleted_event_data.rb +2 -2
- data/lib/anthropic/models/beta/message_create_params.rb +39 -1
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +39 -1
- data/lib/anthropic/models/beta/session_list_params.rb +2 -2
- data/lib/anthropic/models/model.rb +13 -0
- data/lib/anthropic/models/refusal_stop_details.rb +1 -0
- data/lib/anthropic/models/tool_search_tool_result_error_param.rb +7 -1
- data/lib/anthropic/resources/beta/agents.rb +7 -7
- data/lib/anthropic/resources/beta/messages.rb +10 -2
- data/lib/anthropic/resources/beta/sessions.rb +1 -1
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +6 -0
- data/rbi/anthropic/models/anthropic_beta.rbi +10 -0
- data/rbi/anthropic/models/beta/agent_create_params.rbi +8 -8
- data/rbi/anthropic/models/beta/agent_update_params.rbi +6 -12
- data/rbi/anthropic/models/beta/beta_advisor_tool_20260301.rbi +20 -0
- data/rbi/anthropic/models/beta/beta_advisor_tool_result_error.rbi +5 -0
- data/rbi/anthropic/models/beta/beta_advisor_tool_result_error_param.rbi +5 -0
- data/rbi/anthropic/models/beta/beta_content_block.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_content_block_param.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_fallback_block.rbi +83 -0
- data/rbi/anthropic/models/beta/beta_fallback_block_param.rbi +81 -0
- data/rbi/anthropic/models/beta/beta_fallback_info.rbi +45 -0
- data/rbi/anthropic/models/beta/beta_fallback_info_param.rbi +47 -0
- data/rbi/anthropic/models/beta/beta_fallback_message_iteration_usage.rbi +113 -0
- data/rbi/anthropic/models/beta/beta_fallback_param.rbi +167 -0
- data/rbi/anthropic/models/beta/beta_iterations_usage.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_managed_agents_custom_tool_input_schema.rbi +9 -68
- data/rbi/anthropic/models/beta/beta_managed_agents_model.rbi +7 -0
- data/rbi/anthropic/models/beta/beta_message.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_message_delta_usage.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_message_iteration_usage.rbi +14 -0
- data/rbi/anthropic/models/beta/beta_model_info.rbi +12 -0
- data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +4 -2
- data/rbi/anthropic/models/beta/beta_refusal_stop_details.rbi +105 -0
- data/rbi/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbi +11 -2
- data/rbi/anthropic/models/beta/beta_usage.rbi +2 -1
- data/rbi/anthropic/models/beta/beta_webhook_session_archived_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_created_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_deleted_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_idled_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_outcome_evaluation_ended_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_pending_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_requires_action_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_running_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_status_idled_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_status_rescheduled_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_status_run_started_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_status_terminated_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_thread_created_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_thread_idled_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_session_thread_terminated_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_vault_archived_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_vault_created_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_vault_credential_archived_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_vault_credential_created_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_vault_credential_deleted_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_vault_credential_refresh_failed_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/beta_webhook_vault_deleted_event_data.rbi +2 -2
- data/rbi/anthropic/models/beta/message_create_params.rbi +58 -0
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +62 -0
- data/rbi/anthropic/models/beta/session_list_params.rbi +2 -2
- data/rbi/anthropic/models/model.rbi +7 -0
- data/rbi/anthropic/models/refusal_stop_details.rbi +5 -0
- data/rbi/anthropic/models/tool_search_tool_result_error_param.rbi +11 -2
- data/rbi/anthropic/resources/beta/agents.rbi +8 -10
- data/rbi/anthropic/resources/beta/messages.rbi +54 -0
- data/rbi/anthropic/resources/beta/sessions.rbi +1 -1
- data/sig/anthropic/models/anthropic_beta.rbs +4 -0
- data/sig/anthropic/models/beta/beta_advisor_tool_20260301.rbs +5 -0
- data/sig/anthropic/models/beta/beta_advisor_tool_result_error.rbs +2 -0
- data/sig/anthropic/models/beta/beta_advisor_tool_result_error_param.rbs +2 -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_fallback_block.rbs +34 -0
- data/sig/anthropic/models/beta/beta_fallback_block_param.rbs +34 -0
- data/sig/anthropic/models/beta/beta_fallback_info.rbs +17 -0
- data/sig/anthropic/models/beta/beta_fallback_info_param.rbs +17 -0
- data/sig/anthropic/models/beta/beta_fallback_message_iteration_usage.rbs +54 -0
- data/sig/anthropic/models/beta/beta_fallback_param.rbs +66 -0
- data/sig/anthropic/models/beta/beta_iterations_usage.rbs +1 -0
- data/sig/anthropic/models/beta/beta_managed_agents_custom_tool_input_schema.rbs +9 -25
- data/sig/anthropic/models/beta/beta_managed_agents_model.rbs +5 -1
- data/sig/anthropic/models/beta/beta_message_iteration_usage.rbs +5 -0
- data/sig/anthropic/models/beta/beta_model_info.rbs +5 -0
- data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +1 -0
- data/sig/anthropic/models/beta/beta_refusal_stop_details.rbs +17 -1
- data/sig/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbs +7 -2
- data/sig/anthropic/models/beta/message_create_params.rbs +10 -0
- data/sig/anthropic/models/beta/messages/batch_create_params.rbs +10 -0
- data/sig/anthropic/models/model.rbs +9 -1
- data/sig/anthropic/models/refusal_stop_details.rbs +2 -1
- data/sig/anthropic/models/tool_search_tool_result_error_param.rbs +7 -2
- data/sig/anthropic/resources/beta/messages.rbs +4 -0
- metadata +20 -2
|
@@ -24,8 +24,7 @@ module Anthropic
|
|
|
24
24
|
sig { returns(Integer) }
|
|
25
25
|
attr_accessor :version
|
|
26
26
|
|
|
27
|
-
# Description.
|
|
28
|
-
# to clear.
|
|
27
|
+
# Description. Omit to preserve; send empty string or null to clear.
|
|
29
28
|
sig { returns(T.nilable(String)) }
|
|
30
29
|
attr_accessor :description
|
|
31
30
|
|
|
@@ -92,7 +91,7 @@ module Anthropic
|
|
|
92
91
|
end
|
|
93
92
|
attr_writer :multiagent
|
|
94
93
|
|
|
95
|
-
# Human-readable name.
|
|
94
|
+
# Human-readable name. Must be non-empty. Omit to preserve. Cannot be cleared.
|
|
96
95
|
sig { returns(T.nilable(String)) }
|
|
97
96
|
attr_reader :name
|
|
98
97
|
|
|
@@ -100,7 +99,6 @@ module Anthropic
|
|
|
100
99
|
attr_writer :name
|
|
101
100
|
|
|
102
101
|
# Skills. Full replacement. Omit to preserve; send empty array or null to clear.
|
|
103
|
-
# Maximum 20.
|
|
104
102
|
sig do
|
|
105
103
|
returns(
|
|
106
104
|
T.nilable(
|
|
@@ -115,8 +113,7 @@ module Anthropic
|
|
|
115
113
|
end
|
|
116
114
|
attr_accessor :skills
|
|
117
115
|
|
|
118
|
-
# System prompt.
|
|
119
|
-
# null to clear.
|
|
116
|
+
# System prompt. Omit to preserve; send empty string or null to clear.
|
|
120
117
|
sig { returns(T.nilable(String)) }
|
|
121
118
|
attr_accessor :system_
|
|
122
119
|
|
|
@@ -208,8 +205,7 @@ module Anthropic
|
|
|
208
205
|
# value from a create or retrieve response. The request fails if this does not
|
|
209
206
|
# match the server's current version.
|
|
210
207
|
version:,
|
|
211
|
-
# Description.
|
|
212
|
-
# to clear.
|
|
208
|
+
# Description. Omit to preserve; send empty string or null to clear.
|
|
213
209
|
description: nil,
|
|
214
210
|
# MCP servers. Full replacement. Omit to preserve; send empty array or null to
|
|
215
211
|
# clear. Names must be unique. Maximum 20.
|
|
@@ -226,13 +222,11 @@ module Anthropic
|
|
|
226
222
|
# A coordinator topology: the session's primary thread orchestrates work by
|
|
227
223
|
# spawning session threads, each running an agent drawn from the `agents` roster.
|
|
228
224
|
multiagent: nil,
|
|
229
|
-
# Human-readable name.
|
|
225
|
+
# Human-readable name. Must be non-empty. Omit to preserve. Cannot be cleared.
|
|
230
226
|
name: nil,
|
|
231
227
|
# Skills. Full replacement. Omit to preserve; send empty array or null to clear.
|
|
232
|
-
# Maximum 20.
|
|
233
228
|
skills: nil,
|
|
234
|
-
# System prompt.
|
|
235
|
-
# null to clear.
|
|
229
|
+
# System prompt. Omit to preserve; send empty string or null to clear.
|
|
236
230
|
system_: nil,
|
|
237
231
|
# Tool configurations available to the agent. Full replacement. Omit to preserve;
|
|
238
232
|
# send empty array or null to clear. Maximum of 128 tools across all toolsets
|
|
@@ -85,6 +85,16 @@ module Anthropic
|
|
|
85
85
|
sig { params(defer_loading: T::Boolean).void }
|
|
86
86
|
attr_writer :defer_loading
|
|
87
87
|
|
|
88
|
+
# Bounds the advisor's total output (thinking + text) per call. When the advisor
|
|
89
|
+
# hits this cap, the returned advisor_result or advisor_redacted_result block
|
|
90
|
+
# carries stop_reason='max_tokens', and a truncation note is appended to the
|
|
91
|
+
# advice text the worker model sees (inside the encrypted blob in redacted mode).
|
|
92
|
+
# When set, the server also emits a remaining-tokens budget block in the advisor's
|
|
93
|
+
# prompt so the advisor self-shapes toward the cap. When omitted, the advisor
|
|
94
|
+
# model's default output cap applies and no budget block is emitted.
|
|
95
|
+
sig { returns(T.nilable(Integer)) }
|
|
96
|
+
attr_accessor :max_tokens
|
|
97
|
+
|
|
88
98
|
# Maximum number of times the tool can be used in the API request.
|
|
89
99
|
sig { returns(T.nilable(Integer)) }
|
|
90
100
|
attr_accessor :max_uses
|
|
@@ -108,6 +118,7 @@ module Anthropic
|
|
|
108
118
|
caching:
|
|
109
119
|
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
|
|
110
120
|
defer_loading: T::Boolean,
|
|
121
|
+
max_tokens: T.nilable(Integer),
|
|
111
122
|
max_uses: T.nilable(Integer),
|
|
112
123
|
strict: T::Boolean,
|
|
113
124
|
name: Symbol,
|
|
@@ -130,6 +141,14 @@ module Anthropic
|
|
|
130
141
|
# If true, tool will not be included in initial system prompt. Only loaded when
|
|
131
142
|
# returned via tool_reference from tool search.
|
|
132
143
|
defer_loading: nil,
|
|
144
|
+
# Bounds the advisor's total output (thinking + text) per call. When the advisor
|
|
145
|
+
# hits this cap, the returned advisor_result or advisor_redacted_result block
|
|
146
|
+
# carries stop_reason='max_tokens', and a truncation note is appended to the
|
|
147
|
+
# advice text the worker model sees (inside the encrypted blob in redacted mode).
|
|
148
|
+
# When set, the server also emits a remaining-tokens budget block in the advisor's
|
|
149
|
+
# prompt so the advisor self-shapes toward the cap. When omitted, the advisor
|
|
150
|
+
# model's default output cap applies and no budget block is emitted.
|
|
151
|
+
max_tokens: nil,
|
|
133
152
|
# Maximum number of times the tool can be used in the API request.
|
|
134
153
|
max_uses: nil,
|
|
135
154
|
# When true, guarantees schema validation on tool names and inputs
|
|
@@ -156,6 +175,7 @@ module Anthropic
|
|
|
156
175
|
T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
|
|
157
176
|
caching: T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
|
|
158
177
|
defer_loading: T::Boolean,
|
|
178
|
+
max_tokens: T.nilable(Integer),
|
|
159
179
|
max_uses: T.nilable(Integer),
|
|
160
180
|
strict: T::Boolean
|
|
161
181
|
}
|
|
@@ -88,6 +88,11 @@ module Anthropic
|
|
|
88
88
|
:execution_time_exceeded,
|
|
89
89
|
Anthropic::Beta::BetaAdvisorToolResultError::ErrorCode::TaggedSymbol
|
|
90
90
|
)
|
|
91
|
+
MODEL_NOT_FOUND =
|
|
92
|
+
T.let(
|
|
93
|
+
:model_not_found,
|
|
94
|
+
Anthropic::Beta::BetaAdvisorToolResultError::ErrorCode::TaggedSymbol
|
|
95
|
+
)
|
|
91
96
|
|
|
92
97
|
sig do
|
|
93
98
|
override.returns(
|
|
@@ -88,6 +88,11 @@ module Anthropic
|
|
|
88
88
|
:execution_time_exceeded,
|
|
89
89
|
Anthropic::Beta::BetaAdvisorToolResultErrorParam::ErrorCode::TaggedSymbol
|
|
90
90
|
)
|
|
91
|
+
MODEL_NOT_FOUND =
|
|
92
|
+
T.let(
|
|
93
|
+
:model_not_found,
|
|
94
|
+
Anthropic::Beta::BetaAdvisorToolResultErrorParam::ErrorCode::TaggedSymbol
|
|
95
|
+
)
|
|
91
96
|
|
|
92
97
|
sig do
|
|
93
98
|
override.returns(
|
|
@@ -27,7 +27,8 @@ module Anthropic
|
|
|
27
27
|
Anthropic::Beta::BetaMCPToolUseBlock,
|
|
28
28
|
Anthropic::Beta::BetaMCPToolResultBlock,
|
|
29
29
|
Anthropic::Beta::BetaContainerUploadBlock,
|
|
30
|
-
Anthropic::Beta::BetaCompactionBlock
|
|
30
|
+
Anthropic::Beta::BetaCompactionBlock,
|
|
31
|
+
Anthropic::Beta::BetaFallbackBlock
|
|
31
32
|
)
|
|
32
33
|
end
|
|
33
34
|
|
|
@@ -32,7 +32,8 @@ module Anthropic
|
|
|
32
32
|
Anthropic::Beta::BetaRequestMCPToolResultBlockParam,
|
|
33
33
|
Anthropic::Beta::BetaContainerUploadBlockParam,
|
|
34
34
|
Anthropic::Beta::BetaCompactionBlockParam,
|
|
35
|
-
Anthropic::Beta::BetaMidConversationSystemBlockParam
|
|
35
|
+
Anthropic::Beta::BetaMidConversationSystemBlockParam,
|
|
36
|
+
Anthropic::Beta::BetaFallbackBlockParam
|
|
36
37
|
)
|
|
37
38
|
end
|
|
38
39
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaFallbackBlock = Beta::BetaFallbackBlock
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaFallbackBlock < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaFallbackBlock,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The model whose output ends at this point — the model that declined at this hop.
|
|
18
|
+
# When the declining hop is the requested model, its `model` echoes the top-level
|
|
19
|
+
# `model` string the caller sent (alias or canonical); when the declining hop is a
|
|
20
|
+
# fallback model, its `model` is that model's canonical id.
|
|
21
|
+
sig { returns(Anthropic::Beta::BetaFallbackInfo) }
|
|
22
|
+
attr_reader :from
|
|
23
|
+
|
|
24
|
+
sig { params(from: Anthropic::Beta::BetaFallbackInfo::OrHash).void }
|
|
25
|
+
attr_writer :from
|
|
26
|
+
|
|
27
|
+
# The fallback model producing the content that follows this block. Its `model` is
|
|
28
|
+
# always the canonical id.
|
|
29
|
+
sig { returns(Anthropic::Beta::BetaFallbackInfo) }
|
|
30
|
+
attr_reader :to
|
|
31
|
+
|
|
32
|
+
sig { params(to: Anthropic::Beta::BetaFallbackInfo::OrHash).void }
|
|
33
|
+
attr_writer :to
|
|
34
|
+
|
|
35
|
+
sig { returns(Symbol) }
|
|
36
|
+
attr_accessor :type
|
|
37
|
+
|
|
38
|
+
# Marks the point in `content` where one model's output gives way to the next.
|
|
39
|
+
#
|
|
40
|
+
# One block appears per hop where a preceding model actually ran this turn and
|
|
41
|
+
# declined. A turn routed directly by the sticky decision has no such boundary and
|
|
42
|
+
# carries no block — the signal for whether a fallback model served the response
|
|
43
|
+
# is the presence of a `fallback_message` entry in `usage.iterations`, not this
|
|
44
|
+
# block.
|
|
45
|
+
#
|
|
46
|
+
# The block is treated like a server-tool content block for streaming: it arrives
|
|
47
|
+
# via the standard `content_block_start` / `content_block_stop` pair and carries
|
|
48
|
+
# no deltas.
|
|
49
|
+
sig do
|
|
50
|
+
params(
|
|
51
|
+
from: Anthropic::Beta::BetaFallbackInfo::OrHash,
|
|
52
|
+
to: Anthropic::Beta::BetaFallbackInfo::OrHash,
|
|
53
|
+
type: Symbol
|
|
54
|
+
).returns(T.attached_class)
|
|
55
|
+
end
|
|
56
|
+
def self.new(
|
|
57
|
+
# The model whose output ends at this point — the model that declined at this hop.
|
|
58
|
+
# When the declining hop is the requested model, its `model` echoes the top-level
|
|
59
|
+
# `model` string the caller sent (alias or canonical); when the declining hop is a
|
|
60
|
+
# fallback model, its `model` is that model's canonical id.
|
|
61
|
+
from:,
|
|
62
|
+
# The fallback model producing the content that follows this block. Its `model` is
|
|
63
|
+
# always the canonical id.
|
|
64
|
+
to:,
|
|
65
|
+
type: :fallback
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
sig do
|
|
70
|
+
override.returns(
|
|
71
|
+
{
|
|
72
|
+
from: Anthropic::Beta::BetaFallbackInfo,
|
|
73
|
+
to: Anthropic::Beta::BetaFallbackInfo,
|
|
74
|
+
type: Symbol
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
end
|
|
78
|
+
def to_hash
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaFallbackBlockParam = Beta::BetaFallbackBlockParam
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaFallbackBlockParam < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaFallbackBlockParam,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Identifies one hop of a fallback transition.
|
|
18
|
+
sig { returns(Anthropic::Beta::BetaFallbackInfoParam) }
|
|
19
|
+
attr_reader :from
|
|
20
|
+
|
|
21
|
+
sig do
|
|
22
|
+
params(from: Anthropic::Beta::BetaFallbackInfoParam::OrHash).void
|
|
23
|
+
end
|
|
24
|
+
attr_writer :from
|
|
25
|
+
|
|
26
|
+
# Identifies one hop of a fallback transition.
|
|
27
|
+
sig { returns(Anthropic::Beta::BetaFallbackInfoParam) }
|
|
28
|
+
attr_reader :to
|
|
29
|
+
|
|
30
|
+
sig { params(to: Anthropic::Beta::BetaFallbackInfoParam::OrHash).void }
|
|
31
|
+
attr_writer :to
|
|
32
|
+
|
|
33
|
+
sig { returns(Symbol) }
|
|
34
|
+
attr_accessor :type
|
|
35
|
+
|
|
36
|
+
# A `fallback` block echoed back from a prior response.
|
|
37
|
+
#
|
|
38
|
+
# Accepted in `messages[].content` and never rendered into the prompt, not
|
|
39
|
+
# validated against the request's `fallbacks` chain or top-level `model`, and
|
|
40
|
+
# stripped before the sticky-routing cache key is computed.
|
|
41
|
+
#
|
|
42
|
+
# Callers should echo the assistant turn verbatim — block included. The block's
|
|
43
|
+
# position is load-bearing for thinking verification: the thinking runs on either
|
|
44
|
+
# side of a fallback hop carry independently-rooted verification hash chains, and
|
|
45
|
+
# this block is the only record of where one chain ends and the next begins. When
|
|
46
|
+
# thinking runs flank the boundary, omitting the block merges the runs into one
|
|
47
|
+
# contiguous span whose hashes cannot verify (the request is rejected), and moving
|
|
48
|
+
# it into the middle of a single run splits that run's chain and is likewise
|
|
49
|
+
# rejected; between non-thinking blocks the block's placement has no verification
|
|
50
|
+
# effect.
|
|
51
|
+
sig do
|
|
52
|
+
params(
|
|
53
|
+
from: Anthropic::Beta::BetaFallbackInfoParam::OrHash,
|
|
54
|
+
to: Anthropic::Beta::BetaFallbackInfoParam::OrHash,
|
|
55
|
+
type: Symbol
|
|
56
|
+
).returns(T.attached_class)
|
|
57
|
+
end
|
|
58
|
+
def self.new(
|
|
59
|
+
# Identifies one hop of a fallback transition.
|
|
60
|
+
from:,
|
|
61
|
+
# Identifies one hop of a fallback transition.
|
|
62
|
+
to:,
|
|
63
|
+
type: :fallback
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
sig do
|
|
68
|
+
override.returns(
|
|
69
|
+
{
|
|
70
|
+
from: Anthropic::Beta::BetaFallbackInfoParam,
|
|
71
|
+
to: Anthropic::Beta::BetaFallbackInfoParam,
|
|
72
|
+
type: Symbol
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
def to_hash
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaFallbackInfo = Beta::BetaFallbackInfo
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaFallbackInfo < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaFallbackInfo,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The model that will complete your prompt.
|
|
18
|
+
#
|
|
19
|
+
# See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
20
|
+
# details and options.
|
|
21
|
+
sig { returns(Anthropic::Model::Variants) }
|
|
22
|
+
attr_accessor :model
|
|
23
|
+
|
|
24
|
+
# Identifies one hop of a fallback transition.
|
|
25
|
+
sig do
|
|
26
|
+
params(model: T.any(Anthropic::Model::OrSymbol, String)).returns(
|
|
27
|
+
T.attached_class
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
def self.new(
|
|
31
|
+
# The model that will complete your prompt.
|
|
32
|
+
#
|
|
33
|
+
# See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
34
|
+
# details and options.
|
|
35
|
+
model:
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
sig { override.returns({ model: Anthropic::Model::Variants }) }
|
|
40
|
+
def to_hash
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaFallbackInfoParam = Beta::BetaFallbackInfoParam
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaFallbackInfoParam < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaFallbackInfoParam,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The model that will complete your prompt.
|
|
18
|
+
#
|
|
19
|
+
# See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
20
|
+
# details and options.
|
|
21
|
+
sig { returns(T.any(Anthropic::Model::OrSymbol, String)) }
|
|
22
|
+
attr_accessor :model
|
|
23
|
+
|
|
24
|
+
# Identifies one hop of a fallback transition.
|
|
25
|
+
sig do
|
|
26
|
+
params(model: T.any(Anthropic::Model::OrSymbol, String)).returns(
|
|
27
|
+
T.attached_class
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
def self.new(
|
|
31
|
+
# The model that will complete your prompt.
|
|
32
|
+
#
|
|
33
|
+
# See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
34
|
+
# details and options.
|
|
35
|
+
model:
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
sig do
|
|
40
|
+
override.returns({ model: T.any(Anthropic::Model::OrSymbol, String) })
|
|
41
|
+
end
|
|
42
|
+
def to_hash
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaFallbackMessageIterationUsage = Beta::BetaFallbackMessageIterationUsage
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaFallbackMessageIterationUsage < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaFallbackMessageIterationUsage,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Breakdown of cached tokens by TTL
|
|
18
|
+
sig { returns(T.nilable(Anthropic::Beta::BetaCacheCreation)) }
|
|
19
|
+
attr_reader :cache_creation
|
|
20
|
+
|
|
21
|
+
sig do
|
|
22
|
+
params(
|
|
23
|
+
cache_creation:
|
|
24
|
+
T.nilable(Anthropic::Beta::BetaCacheCreation::OrHash)
|
|
25
|
+
).void
|
|
26
|
+
end
|
|
27
|
+
attr_writer :cache_creation
|
|
28
|
+
|
|
29
|
+
# The number of input tokens used to create the cache entry.
|
|
30
|
+
sig { returns(Integer) }
|
|
31
|
+
attr_accessor :cache_creation_input_tokens
|
|
32
|
+
|
|
33
|
+
# The number of input tokens read from the cache.
|
|
34
|
+
sig { returns(Integer) }
|
|
35
|
+
attr_accessor :cache_read_input_tokens
|
|
36
|
+
|
|
37
|
+
# The number of input tokens which were used.
|
|
38
|
+
sig { returns(Integer) }
|
|
39
|
+
attr_accessor :input_tokens
|
|
40
|
+
|
|
41
|
+
# The model that will complete your prompt.
|
|
42
|
+
#
|
|
43
|
+
# See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
44
|
+
# details and options.
|
|
45
|
+
sig { returns(Anthropic::Model::Variants) }
|
|
46
|
+
attr_accessor :model
|
|
47
|
+
|
|
48
|
+
# The number of output tokens which were used.
|
|
49
|
+
sig { returns(Integer) }
|
|
50
|
+
attr_accessor :output_tokens
|
|
51
|
+
|
|
52
|
+
# Usage for the fallback-model attempt that served the response
|
|
53
|
+
sig { returns(Symbol) }
|
|
54
|
+
attr_accessor :type
|
|
55
|
+
|
|
56
|
+
# Token usage for the fallback-model attempt of a server-side fallback request.
|
|
57
|
+
#
|
|
58
|
+
# Produced in place of a `message` entry for whichever hop served the response. A
|
|
59
|
+
# declined hop produces the existing `message` entry. Whether a fallback model
|
|
60
|
+
# served the response is signalled by the presence of this entry in
|
|
61
|
+
# `usage.iterations`.
|
|
62
|
+
sig do
|
|
63
|
+
params(
|
|
64
|
+
cache_creation:
|
|
65
|
+
T.nilable(Anthropic::Beta::BetaCacheCreation::OrHash),
|
|
66
|
+
cache_creation_input_tokens: Integer,
|
|
67
|
+
cache_read_input_tokens: Integer,
|
|
68
|
+
input_tokens: Integer,
|
|
69
|
+
model: T.any(Anthropic::Model::OrSymbol, String),
|
|
70
|
+
output_tokens: Integer,
|
|
71
|
+
type: Symbol
|
|
72
|
+
).returns(T.attached_class)
|
|
73
|
+
end
|
|
74
|
+
def self.new(
|
|
75
|
+
# Breakdown of cached tokens by TTL
|
|
76
|
+
cache_creation:,
|
|
77
|
+
# The number of input tokens used to create the cache entry.
|
|
78
|
+
cache_creation_input_tokens:,
|
|
79
|
+
# The number of input tokens read from the cache.
|
|
80
|
+
cache_read_input_tokens:,
|
|
81
|
+
# The number of input tokens which were used.
|
|
82
|
+
input_tokens:,
|
|
83
|
+
# The model that will complete your prompt.
|
|
84
|
+
#
|
|
85
|
+
# See [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
86
|
+
# details and options.
|
|
87
|
+
model:,
|
|
88
|
+
# The number of output tokens which were used.
|
|
89
|
+
output_tokens:,
|
|
90
|
+
# Usage for the fallback-model attempt that served the response
|
|
91
|
+
type: :fallback_message
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
sig do
|
|
96
|
+
override.returns(
|
|
97
|
+
{
|
|
98
|
+
cache_creation: T.nilable(Anthropic::Beta::BetaCacheCreation),
|
|
99
|
+
cache_creation_input_tokens: Integer,
|
|
100
|
+
cache_read_input_tokens: Integer,
|
|
101
|
+
input_tokens: Integer,
|
|
102
|
+
model: Anthropic::Model::Variants,
|
|
103
|
+
output_tokens: Integer,
|
|
104
|
+
type: Symbol
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
end
|
|
108
|
+
def to_hash
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|