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.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/helpers/streaming/message_stream.rb +4 -0
  5. data/lib/anthropic/models/anthropic_beta.rb +6 -0
  6. data/lib/anthropic/models/beta/agent_create_params.rb +8 -8
  7. data/lib/anthropic/models/beta/agent_update_params.rb +7 -10
  8. data/lib/anthropic/models/beta/beta_advisor_tool_20260301.rb +15 -1
  9. data/lib/anthropic/models/beta/beta_advisor_tool_result_error.rb +1 -0
  10. data/lib/anthropic/models/beta/beta_advisor_tool_result_error_param.rb +1 -0
  11. data/lib/anthropic/models/beta/beta_content_block.rb +14 -1
  12. data/lib/anthropic/models/beta/beta_content_block_param.rb +18 -1
  13. data/lib/anthropic/models/beta/beta_fallback_block.rb +54 -0
  14. data/lib/anthropic/models/beta/beta_fallback_block_param.rb +51 -0
  15. data/lib/anthropic/models/beta/beta_fallback_info.rb +28 -0
  16. data/lib/anthropic/models/beta/beta_fallback_info_param.rb +28 -0
  17. data/lib/anthropic/models/beta/beta_fallback_message_iteration_usage.rb +81 -0
  18. data/lib/anthropic/models/beta/beta_fallback_param.rb +88 -0
  19. data/lib/anthropic/models/beta/beta_iterations_usage.rb +9 -1
  20. data/lib/anthropic/models/beta/beta_managed_agents_custom_tool_input_schema.rb +10 -27
  21. data/lib/anthropic/models/beta/beta_managed_agents_model.rb +5 -0
  22. data/lib/anthropic/models/beta/beta_message.rb +2 -2
  23. data/lib/anthropic/models/beta/beta_message_delta_usage.rb +2 -2
  24. data/lib/anthropic/models/beta/beta_message_iteration_usage.rb +15 -1
  25. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  26. data/lib/anthropic/models/beta/beta_model_info.rb +11 -1
  27. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +16 -3
  28. data/lib/anthropic/models/beta/beta_refusal_stop_details.rb +64 -1
  29. data/lib/anthropic/models/beta/beta_tool_search_tool_result_error_param.rb +7 -1
  30. data/lib/anthropic/models/beta/beta_usage.rb +2 -2
  31. data/lib/anthropic/models/beta/beta_webhook_session_archived_event_data.rb +2 -2
  32. data/lib/anthropic/models/beta/beta_webhook_session_created_event_data.rb +2 -2
  33. data/lib/anthropic/models/beta/beta_webhook_session_deleted_event_data.rb +2 -2
  34. data/lib/anthropic/models/beta/beta_webhook_session_idled_event_data.rb +2 -2
  35. data/lib/anthropic/models/beta/beta_webhook_session_outcome_evaluation_ended_event_data.rb +2 -2
  36. data/lib/anthropic/models/beta/beta_webhook_session_pending_event_data.rb +2 -2
  37. data/lib/anthropic/models/beta/beta_webhook_session_requires_action_event_data.rb +2 -2
  38. data/lib/anthropic/models/beta/beta_webhook_session_running_event_data.rb +2 -2
  39. data/lib/anthropic/models/beta/beta_webhook_session_status_idled_event_data.rb +2 -2
  40. data/lib/anthropic/models/beta/beta_webhook_session_status_rescheduled_event_data.rb +2 -2
  41. data/lib/anthropic/models/beta/beta_webhook_session_status_run_started_event_data.rb +2 -2
  42. data/lib/anthropic/models/beta/beta_webhook_session_status_terminated_event_data.rb +2 -2
  43. data/lib/anthropic/models/beta/beta_webhook_session_thread_created_event_data.rb +2 -2
  44. data/lib/anthropic/models/beta/beta_webhook_session_thread_idled_event_data.rb +2 -2
  45. data/lib/anthropic/models/beta/beta_webhook_session_thread_terminated_event_data.rb +2 -2
  46. data/lib/anthropic/models/beta/beta_webhook_vault_archived_event_data.rb +2 -2
  47. data/lib/anthropic/models/beta/beta_webhook_vault_created_event_data.rb +2 -2
  48. data/lib/anthropic/models/beta/beta_webhook_vault_credential_archived_event_data.rb +2 -2
  49. data/lib/anthropic/models/beta/beta_webhook_vault_credential_created_event_data.rb +2 -2
  50. data/lib/anthropic/models/beta/beta_webhook_vault_credential_deleted_event_data.rb +2 -2
  51. data/lib/anthropic/models/beta/beta_webhook_vault_credential_refresh_failed_event_data.rb +2 -2
  52. data/lib/anthropic/models/beta/beta_webhook_vault_deleted_event_data.rb +2 -2
  53. data/lib/anthropic/models/beta/message_create_params.rb +39 -1
  54. data/lib/anthropic/models/beta/messages/batch_create_params.rb +39 -1
  55. data/lib/anthropic/models/beta/session_list_params.rb +2 -2
  56. data/lib/anthropic/models/model.rb +13 -0
  57. data/lib/anthropic/models/refusal_stop_details.rb +1 -0
  58. data/lib/anthropic/models/tool_search_tool_result_error_param.rb +7 -1
  59. data/lib/anthropic/resources/beta/agents.rb +7 -7
  60. data/lib/anthropic/resources/beta/messages.rb +10 -2
  61. data/lib/anthropic/resources/beta/sessions.rb +1 -1
  62. data/lib/anthropic/version.rb +1 -1
  63. data/lib/anthropic.rb +6 -0
  64. data/rbi/anthropic/models/anthropic_beta.rbi +10 -0
  65. data/rbi/anthropic/models/beta/agent_create_params.rbi +8 -8
  66. data/rbi/anthropic/models/beta/agent_update_params.rbi +6 -12
  67. data/rbi/anthropic/models/beta/beta_advisor_tool_20260301.rbi +20 -0
  68. data/rbi/anthropic/models/beta/beta_advisor_tool_result_error.rbi +5 -0
  69. data/rbi/anthropic/models/beta/beta_advisor_tool_result_error_param.rbi +5 -0
  70. data/rbi/anthropic/models/beta/beta_content_block.rbi +2 -1
  71. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +2 -1
  72. data/rbi/anthropic/models/beta/beta_fallback_block.rbi +83 -0
  73. data/rbi/anthropic/models/beta/beta_fallback_block_param.rbi +81 -0
  74. data/rbi/anthropic/models/beta/beta_fallback_info.rbi +45 -0
  75. data/rbi/anthropic/models/beta/beta_fallback_info_param.rbi +47 -0
  76. data/rbi/anthropic/models/beta/beta_fallback_message_iteration_usage.rbi +113 -0
  77. data/rbi/anthropic/models/beta/beta_fallback_param.rbi +167 -0
  78. data/rbi/anthropic/models/beta/beta_iterations_usage.rbi +2 -1
  79. data/rbi/anthropic/models/beta/beta_managed_agents_custom_tool_input_schema.rbi +9 -68
  80. data/rbi/anthropic/models/beta/beta_managed_agents_model.rbi +7 -0
  81. data/rbi/anthropic/models/beta/beta_message.rbi +2 -1
  82. data/rbi/anthropic/models/beta/beta_message_delta_usage.rbi +2 -1
  83. data/rbi/anthropic/models/beta/beta_message_iteration_usage.rbi +14 -0
  84. data/rbi/anthropic/models/beta/beta_model_info.rbi +12 -0
  85. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +4 -2
  86. data/rbi/anthropic/models/beta/beta_refusal_stop_details.rbi +105 -0
  87. data/rbi/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbi +11 -2
  88. data/rbi/anthropic/models/beta/beta_usage.rbi +2 -1
  89. data/rbi/anthropic/models/beta/beta_webhook_session_archived_event_data.rbi +2 -2
  90. data/rbi/anthropic/models/beta/beta_webhook_session_created_event_data.rbi +2 -2
  91. data/rbi/anthropic/models/beta/beta_webhook_session_deleted_event_data.rbi +2 -2
  92. data/rbi/anthropic/models/beta/beta_webhook_session_idled_event_data.rbi +2 -2
  93. data/rbi/anthropic/models/beta/beta_webhook_session_outcome_evaluation_ended_event_data.rbi +2 -2
  94. data/rbi/anthropic/models/beta/beta_webhook_session_pending_event_data.rbi +2 -2
  95. data/rbi/anthropic/models/beta/beta_webhook_session_requires_action_event_data.rbi +2 -2
  96. data/rbi/anthropic/models/beta/beta_webhook_session_running_event_data.rbi +2 -2
  97. data/rbi/anthropic/models/beta/beta_webhook_session_status_idled_event_data.rbi +2 -2
  98. data/rbi/anthropic/models/beta/beta_webhook_session_status_rescheduled_event_data.rbi +2 -2
  99. data/rbi/anthropic/models/beta/beta_webhook_session_status_run_started_event_data.rbi +2 -2
  100. data/rbi/anthropic/models/beta/beta_webhook_session_status_terminated_event_data.rbi +2 -2
  101. data/rbi/anthropic/models/beta/beta_webhook_session_thread_created_event_data.rbi +2 -2
  102. data/rbi/anthropic/models/beta/beta_webhook_session_thread_idled_event_data.rbi +2 -2
  103. data/rbi/anthropic/models/beta/beta_webhook_session_thread_terminated_event_data.rbi +2 -2
  104. data/rbi/anthropic/models/beta/beta_webhook_vault_archived_event_data.rbi +2 -2
  105. data/rbi/anthropic/models/beta/beta_webhook_vault_created_event_data.rbi +2 -2
  106. data/rbi/anthropic/models/beta/beta_webhook_vault_credential_archived_event_data.rbi +2 -2
  107. data/rbi/anthropic/models/beta/beta_webhook_vault_credential_created_event_data.rbi +2 -2
  108. data/rbi/anthropic/models/beta/beta_webhook_vault_credential_deleted_event_data.rbi +2 -2
  109. data/rbi/anthropic/models/beta/beta_webhook_vault_credential_refresh_failed_event_data.rbi +2 -2
  110. data/rbi/anthropic/models/beta/beta_webhook_vault_deleted_event_data.rbi +2 -2
  111. data/rbi/anthropic/models/beta/message_create_params.rbi +58 -0
  112. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +62 -0
  113. data/rbi/anthropic/models/beta/session_list_params.rbi +2 -2
  114. data/rbi/anthropic/models/model.rbi +7 -0
  115. data/rbi/anthropic/models/refusal_stop_details.rbi +5 -0
  116. data/rbi/anthropic/models/tool_search_tool_result_error_param.rbi +11 -2
  117. data/rbi/anthropic/resources/beta/agents.rbi +8 -10
  118. data/rbi/anthropic/resources/beta/messages.rbi +54 -0
  119. data/rbi/anthropic/resources/beta/sessions.rbi +1 -1
  120. data/sig/anthropic/models/anthropic_beta.rbs +4 -0
  121. data/sig/anthropic/models/beta/beta_advisor_tool_20260301.rbs +5 -0
  122. data/sig/anthropic/models/beta/beta_advisor_tool_result_error.rbs +2 -0
  123. data/sig/anthropic/models/beta/beta_advisor_tool_result_error_param.rbs +2 -0
  124. data/sig/anthropic/models/beta/beta_content_block.rbs +1 -0
  125. data/sig/anthropic/models/beta/beta_content_block_param.rbs +1 -0
  126. data/sig/anthropic/models/beta/beta_fallback_block.rbs +34 -0
  127. data/sig/anthropic/models/beta/beta_fallback_block_param.rbs +34 -0
  128. data/sig/anthropic/models/beta/beta_fallback_info.rbs +17 -0
  129. data/sig/anthropic/models/beta/beta_fallback_info_param.rbs +17 -0
  130. data/sig/anthropic/models/beta/beta_fallback_message_iteration_usage.rbs +54 -0
  131. data/sig/anthropic/models/beta/beta_fallback_param.rbs +66 -0
  132. data/sig/anthropic/models/beta/beta_iterations_usage.rbs +1 -0
  133. data/sig/anthropic/models/beta/beta_managed_agents_custom_tool_input_schema.rbs +9 -25
  134. data/sig/anthropic/models/beta/beta_managed_agents_model.rbs +5 -1
  135. data/sig/anthropic/models/beta/beta_message_iteration_usage.rbs +5 -0
  136. data/sig/anthropic/models/beta/beta_model_info.rbs +5 -0
  137. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +1 -0
  138. data/sig/anthropic/models/beta/beta_refusal_stop_details.rbs +17 -1
  139. data/sig/anthropic/models/beta/beta_tool_search_tool_result_error_param.rbs +7 -2
  140. data/sig/anthropic/models/beta/message_create_params.rbs +10 -0
  141. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +10 -0
  142. data/sig/anthropic/models/model.rbs +9 -1
  143. data/sig/anthropic/models/refusal_stop_details.rbs +2 -1
  144. data/sig/anthropic/models/tool_search_tool_result_error_param.rbs +7 -2
  145. data/sig/anthropic/resources/beta/messages.rbs +4 -0
  146. metadata +20 -2
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookSessionStatusTerminatedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the session that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -26,7 +26,7 @@ module Anthropic
26
26
  required :workspace_id, String
27
27
 
28
28
  # @!method initialize(id:, organization_id:, workspace_id:, type: :"session.status_terminated")
29
- # @param id [String] ID of the resource that triggered the event.
29
+ # @param id [String] ID of the session that triggered the event.
30
30
  #
31
31
  # @param organization_id [String]
32
32
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookSessionThreadCreatedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the session that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -26,7 +26,7 @@ module Anthropic
26
26
  required :workspace_id, String
27
27
 
28
28
  # @!method initialize(id:, organization_id:, workspace_id:, type: :"session.thread_created")
29
- # @param id [String] ID of the resource that triggered the event.
29
+ # @param id [String] ID of the session that triggered the event.
30
30
  #
31
31
  # @param organization_id [String]
32
32
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookSessionThreadIdledEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the session that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -26,7 +26,7 @@ module Anthropic
26
26
  required :workspace_id, String
27
27
 
28
28
  # @!method initialize(id:, organization_id:, workspace_id:, type: :"session.thread_idled")
29
- # @param id [String] ID of the resource that triggered the event.
29
+ # @param id [String] ID of the session that triggered the event.
30
30
  #
31
31
  # @param organization_id [String]
32
32
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookSessionThreadTerminatedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the session that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -26,7 +26,7 @@ module Anthropic
26
26
  required :workspace_id, String
27
27
 
28
28
  # @!method initialize(id:, organization_id:, workspace_id:, type: :"session.thread_terminated")
29
- # @param id [String] ID of the resource that triggered the event.
29
+ # @param id [String] ID of the session that triggered the event.
30
30
  #
31
31
  # @param organization_id [String]
32
32
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookVaultArchivedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the vault that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -26,7 +26,7 @@ module Anthropic
26
26
  required :workspace_id, String
27
27
 
28
28
  # @!method initialize(id:, organization_id:, workspace_id:, type: :"vault.archived")
29
- # @param id [String] ID of the resource that triggered the event.
29
+ # @param id [String] ID of the vault that triggered the event.
30
30
  #
31
31
  # @param organization_id [String]
32
32
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookVaultCreatedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the vault that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -26,7 +26,7 @@ module Anthropic
26
26
  required :workspace_id, String
27
27
 
28
28
  # @!method initialize(id:, organization_id:, workspace_id:, type: :"vault.created")
29
- # @param id [String] ID of the resource that triggered the event.
29
+ # @param id [String] ID of the vault that triggered the event.
30
30
  #
31
31
  # @param organization_id [String]
32
32
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookVaultCredentialArchivedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the vault credential that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -32,7 +32,7 @@ module Anthropic
32
32
  required :workspace_id, String
33
33
 
34
34
  # @!method initialize(id:, organization_id:, vault_id:, workspace_id:, type: :"vault_credential.archived")
35
- # @param id [String] ID of the resource that triggered the event.
35
+ # @param id [String] ID of the vault credential that triggered the event.
36
36
  #
37
37
  # @param organization_id [String]
38
38
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookVaultCredentialCreatedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the vault credential that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -32,7 +32,7 @@ module Anthropic
32
32
  required :workspace_id, String
33
33
 
34
34
  # @!method initialize(id:, organization_id:, vault_id:, workspace_id:, type: :"vault_credential.created")
35
- # @param id [String] ID of the resource that triggered the event.
35
+ # @param id [String] ID of the vault credential that triggered the event.
36
36
  #
37
37
  # @param organization_id [String]
38
38
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookVaultCredentialDeletedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the vault credential that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -32,7 +32,7 @@ module Anthropic
32
32
  required :workspace_id, String
33
33
 
34
34
  # @!method initialize(id:, organization_id:, vault_id:, workspace_id:, type: :"vault_credential.deleted")
35
- # @param id [String] ID of the resource that triggered the event.
35
+ # @param id [String] ID of the vault credential that triggered the event.
36
36
  #
37
37
  # @param organization_id [String]
38
38
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookVaultCredentialRefreshFailedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the vault credential that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -32,7 +32,7 @@ module Anthropic
32
32
  required :workspace_id, String
33
33
 
34
34
  # @!method initialize(id:, organization_id:, vault_id:, workspace_id:, type: :"vault_credential.refresh_failed")
35
- # @param id [String] ID of the resource that triggered the event.
35
+ # @param id [String] ID of the vault credential that triggered the event.
36
36
  #
37
37
  # @param organization_id [String]
38
38
  #
@@ -5,7 +5,7 @@ module Anthropic
5
5
  module Beta
6
6
  class BetaWebhookVaultDeletedEventData < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute id
8
- # ID of the resource that triggered the event.
8
+ # ID of the vault that triggered the event.
9
9
  #
10
10
  # @return [String]
11
11
  required :id, String
@@ -26,7 +26,7 @@ module Anthropic
26
26
  required :workspace_id, String
27
27
 
28
28
  # @!method initialize(id:, organization_id:, workspace_id:, type: :"vault.deleted")
29
- # @param id [String] ID of the resource that triggered the event.
29
+ # @param id [String] ID of the vault that triggered the event.
30
30
  #
31
31
  # @param organization_id [String]
32
32
  #
@@ -134,6 +134,40 @@ module Anthropic
134
134
  # @return [Anthropic::Models::Beta::BetaDiagnosticsParam, nil]
135
135
  optional :diagnostics, -> { Anthropic::Beta::BetaDiagnosticsParam }, nil?: true
136
136
 
137
+ # @!attribute fallback_credit_token
138
+ # The `fallback_credit_token` from a prior refusal's `stop_details`.
139
+ #
140
+ # When a preceding request was refused and returned a `fallback_credit_token`,
141
+ # pass that code here on the retry to have the retry's cache-creation tokens for
142
+ # the prefix that was warm on the refused model billed at the cache-read rate.
143
+ # Must be redeemed by the same organization and workspace, with the same request
144
+ # body (optionally extended by one appended `assistant` message whose content is
145
+ # the partial text — with any trailing whitespace stripped from the final text
146
+ # block — and paired server-tool blocks streamed before the refusal; the
147
+ # appended-assistant form is not available for requests with `output_format` set
148
+ # or forced `tool_choice`), on an eligible fallback model, on the same platform,
149
+ # and within 5 minutes of the refusal; a mismatch is a 400. A token minted
150
+ # mid-server-tool-loop whose partial content was continuable may only be redeemed
151
+ # with the appended-assistant form — if an exact-body retry is rejected with a 400
152
+ # saying the token must be redeemed by continuing the partial response, retry with
153
+ # the appended-assistant form instead.
154
+ #
155
+ # When the appended-assistant form is used on a model that otherwise disallows
156
+ # assistant-turn prefill, this token also authorizes that one prefill.
157
+ #
158
+ # @return [String, nil]
159
+ optional :fallback_credit_token, String, nil?: true
160
+
161
+ # @!attribute fallbacks
162
+ # Opt-in server-side retry on one or more substitute models when the requested
163
+ # model declines for policy reasons. Tried in order: if the first entry also
164
+ # declines, the second is tried, and so on.
165
+ #
166
+ # @return [Array<Anthropic::Models::Beta::BetaFallbackParam>, nil]
167
+ optional :fallbacks,
168
+ -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaFallbackParam] },
169
+ nil?: true
170
+
137
171
  # @!attribute inference_geo
138
172
  # Specifies the geographic region for inference processing. If not specified, the
139
173
  # workspace's `default_inference_geo` is used.
@@ -374,7 +408,7 @@ module Anthropic
374
408
  # @return [Array<String, Symbol, Anthropic::Models::AnthropicBeta>, nil]
375
409
  optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }
376
410
 
377
- # @!method initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, diagnostics: 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, user_profile_id: nil, betas: nil, request_options: {})
411
+ # @!method initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: 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, user_profile_id: nil, betas: nil, request_options: {})
378
412
  # Some parameter documentations has been truncated, see
379
413
  # {Anthropic::Models::Beta::MessageCreateParams} for more details.
380
414
  #
@@ -392,6 +426,10 @@ module Anthropic
392
426
  #
393
427
  # @param diagnostics [Anthropic::Models::Beta::BetaDiagnosticsParam, nil] Request-level diagnostics. Currently carries the previous response
394
428
  #
429
+ # @param fallback_credit_token [String, nil] The `fallback_credit_token` from a prior refusal's `stop_details`.
430
+ #
431
+ # @param fallbacks [Array<Anthropic::Models::Beta::BetaFallbackParam>, nil] Opt-in server-side retry on one or more substitute models when the requested mod
432
+ #
395
433
  # @param inference_geo [String, nil] Specifies the geographic region for inference processing. If not specified, the
396
434
  #
397
435
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] MCP servers to be utilized in this request
@@ -189,6 +189,40 @@ module Anthropic
189
189
  # @return [Anthropic::Models::Beta::BetaDiagnosticsParam, nil]
190
190
  optional :diagnostics, -> { Anthropic::Beta::BetaDiagnosticsParam }, nil?: true
191
191
 
192
+ # @!attribute fallback_credit_token
193
+ # The `fallback_credit_token` from a prior refusal's `stop_details`.
194
+ #
195
+ # When a preceding request was refused and returned a `fallback_credit_token`,
196
+ # pass that code here on the retry to have the retry's cache-creation tokens for
197
+ # the prefix that was warm on the refused model billed at the cache-read rate.
198
+ # Must be redeemed by the same organization and workspace, with the same request
199
+ # body (optionally extended by one appended `assistant` message whose content is
200
+ # the partial text — with any trailing whitespace stripped from the final text
201
+ # block — and paired server-tool blocks streamed before the refusal; the
202
+ # appended-assistant form is not available for requests with `output_format` set
203
+ # or forced `tool_choice`), on an eligible fallback model, on the same platform,
204
+ # and within 5 minutes of the refusal; a mismatch is a 400. A token minted
205
+ # mid-server-tool-loop whose partial content was continuable may only be redeemed
206
+ # with the appended-assistant form — if an exact-body retry is rejected with a 400
207
+ # saying the token must be redeemed by continuing the partial response, retry with
208
+ # the appended-assistant form instead.
209
+ #
210
+ # When the appended-assistant form is used on a model that otherwise disallows
211
+ # assistant-turn prefill, this token also authorizes that one prefill.
212
+ #
213
+ # @return [String, nil]
214
+ optional :fallback_credit_token, String, nil?: true
215
+
216
+ # @!attribute fallbacks
217
+ # Opt-in server-side retry on one or more substitute models when the requested
218
+ # model declines for policy reasons. Tried in order: if the first entry also
219
+ # declines, the second is tried, and so on.
220
+ #
221
+ # @return [Array<Anthropic::Models::Beta::BetaFallbackParam>, nil]
222
+ optional :fallbacks,
223
+ -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaFallbackParam] },
224
+ nil?: true
225
+
192
226
  # @!attribute inference_geo
193
227
  # Specifies the geographic region for inference processing. If not specified, the
194
228
  # workspace's `default_inference_geo` is used.
@@ -436,7 +470,7 @@ module Anthropic
436
470
  # @return [String, nil]
437
471
  optional :user_profile_id, String, nil?: true
438
472
 
439
- # @!method initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, diagnostics: 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, user_profile_id: nil)
473
+ # @!method initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: 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, user_profile_id: nil)
440
474
  # Some parameter documentations has been truncated, see
441
475
  # {Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params} for more
442
476
  # details.
@@ -460,6 +494,10 @@ module Anthropic
460
494
  #
461
495
  # @param diagnostics [Anthropic::Models::Beta::BetaDiagnosticsParam, nil] Request-level diagnostics. Currently carries the previous response
462
496
  #
497
+ # @param fallback_credit_token [String, nil] The `fallback_credit_token` from a prior refusal's `stop_details`.
498
+ #
499
+ # @param fallbacks [Array<Anthropic::Models::Beta::BetaFallbackParam>, nil] Opt-in server-side retry on one or more substitute models when the requested mod
500
+ #
463
501
  # @param inference_geo [String, nil] Specifies the geographic region for inference processing. If not specified, the
464
502
  #
465
503
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] MCP servers to be utilized in this request
@@ -71,7 +71,7 @@ module Anthropic
71
71
  optional :order, enum: -> { Anthropic::Beta::SessionListParams::Order }
72
72
 
73
73
  # @!attribute page
74
- # Opaque pagination cursor from a previous response's next_page.
74
+ # Opaque pagination cursor from a previous response.
75
75
  #
76
76
  # @return [String, nil]
77
77
  optional :page, String
@@ -114,7 +114,7 @@ module Anthropic
114
114
  #
115
115
  # @param order [Symbol, Anthropic::Models::Beta::SessionListParams::Order] Sort direction for results, ordered by created_at. Defaults to desc (newest firs
116
116
  #
117
- # @param page [String] Opaque pagination cursor from a previous response's next_page.
117
+ # @param page [String] Opaque pagination cursor from a previous response.
118
118
  #
119
119
  # @param statuses [Array<Symbol, Anthropic::Models::Beta::SessionListParams::Status>] Filter by session status. Repeat the parameter to match any of multiple statuses
120
120
  #
@@ -9,6 +9,10 @@ module Anthropic
9
9
  module Model
10
10
  extend Anthropic::Internal::Type::Union
11
11
 
12
+ variant const: -> { Anthropic::Models::Model::CLAUDE_FABLE_5 }
13
+
14
+ variant const: -> { Anthropic::Models::Model::CLAUDE_MYTHOS_5 }
15
+
12
16
  variant const: -> { Anthropic::Models::Model::CLAUDE_OPUS_4_8 }
13
17
 
14
18
  variant const: -> { Anthropic::Models::Model::CLAUDE_OPUS_4_7 }
@@ -56,6 +60,12 @@ module Anthropic
56
60
 
57
61
  # @!group
58
62
 
63
+ # Next generation of intelligence for the hardest knowledge work and coding problems
64
+ CLAUDE_FABLE_5 = :"claude-fable-5"
65
+
66
+ # Most capable model for cybersecurity and biology research
67
+ CLAUDE_MYTHOS_5 = :"claude-mythos-5"
68
+
59
69
  # Frontier intelligence for long-running agents and coding
60
70
  CLAUDE_OPUS_4_8 = :"claude-opus-4-8"
61
71
 
@@ -63,6 +73,9 @@ module Anthropic
63
73
  CLAUDE_OPUS_4_7 = :"claude-opus-4-7"
64
74
 
65
75
  # New class of intelligence, strongest in coding and cybersecurity
76
+ # @deprecated Will reach end-of-life on June 30, 2026. Please migrate to claude-mythos-5.
77
+ # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
78
+ # information.
66
79
  CLAUDE_MYTHOS_PREVIEW = :"claude-mythos-preview"
67
80
 
68
81
  # Frontier intelligence for long-running agents and coding
@@ -47,6 +47,7 @@ module Anthropic
47
47
 
48
48
  CYBER = :cyber
49
49
  BIO = :bio
50
+ REASONING_EXTRACTION = :reasoning_extraction
50
51
 
51
52
  # @!method self.values
52
53
  # @return [Array<Symbol>]
@@ -13,8 +13,14 @@ module Anthropic
13
13
  # @return [Symbol, :tool_search_tool_result_error]
14
14
  required :type, const: :tool_search_tool_result_error
15
15
 
16
- # @!method initialize(error_code:, type: :tool_search_tool_result_error)
16
+ # @!attribute error_message
17
+ #
18
+ # @return [String, nil]
19
+ optional :error_message, String, nil?: true
20
+
21
+ # @!method initialize(error_code:, error_message: nil, type: :tool_search_tool_result_error)
17
22
  # @param error_code [Symbol, Anthropic::Models::ToolSearchToolResultErrorCode]
23
+ # @param error_message [String, nil]
18
24
  # @param type [Symbol, :tool_search_tool_result_error]
19
25
  end
20
26
  end
@@ -16,9 +16,9 @@ module Anthropic
16
16
  #
17
17
  # @param model [Symbol, String, Anthropic::Models::Beta::BetaManagedAgentsModel, Anthropic::Models::Beta::BetaManagedAgentsModelConfigParams] Body param: Model identifier. Accepts the [model string](https://platform.claude
18
18
  #
19
- # @param name [String] Body param: Human-readable name for the agent. 1-256 characters.
19
+ # @param name [String] Body param: Human-readable name for the agent.
20
20
  #
21
- # @param description [String, nil] Body param: Description of what the agent does. Up to 2048 characters.
21
+ # @param description [String, nil] Body param: Description of what the agent does.
22
22
  #
23
23
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaManagedAgentsURLMCPServerParams>] Body param: MCP servers this agent connects to. Maximum 20. Names must be unique
24
24
  #
@@ -26,9 +26,9 @@ module Anthropic
26
26
  #
27
27
  # @param multiagent [Anthropic::Models::Beta::BetaManagedAgentsMultiagentParams, nil] Body param: A coordinator topology: the session's primary thread orchestrates wo
28
28
  #
29
- # @param skills [Array<Anthropic::Models::Beta::BetaManagedAgentsAnthropicSkillParams, Anthropic::Models::Beta::BetaManagedAgentsCustomSkillParams>] Body param: Skills available to the agent. Maximum 20.
29
+ # @param skills [Array<Anthropic::Models::Beta::BetaManagedAgentsAnthropicSkillParams, Anthropic::Models::Beta::BetaManagedAgentsCustomSkillParams>] Body param: Skills available to the agent.
30
30
  #
31
- # @param system_ [String, nil] Body param: System prompt for the agent. Up to 100,000 characters.
31
+ # @param system_ [String, nil] Body param: System prompt for the agent.
32
32
  #
33
33
  # @param tools [Array<Anthropic::Models::Beta::BetaManagedAgentsAgentToolset20260401Params, Anthropic::Models::Beta::BetaManagedAgentsMCPToolsetParams, Anthropic::Models::Beta::BetaManagedAgentsCustomToolParams>] Body param: Tool configurations available to the agent. Maximum of 128 tools acr
34
34
  #
@@ -95,7 +95,7 @@ module Anthropic
95
95
  #
96
96
  # @param version [Integer] Body param: The agent's current version, used to prevent concurrent overwrites.
97
97
  #
98
- # @param description [String, nil] Body param: Description. Up to 2048 characters. Omit to preserve; send empty str
98
+ # @param description [String, nil] Body param: Description. Omit to preserve; send empty string or null to clear.
99
99
  #
100
100
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaManagedAgentsURLMCPServerParams>, nil] Body param: MCP servers. Full replacement. Omit to preserve; send empty array or
101
101
  #
@@ -105,11 +105,11 @@ module Anthropic
105
105
  #
106
106
  # @param multiagent [Anthropic::Models::Beta::BetaManagedAgentsMultiagentParams, nil] Body param: A coordinator topology: the session's primary thread orchestrates wo
107
107
  #
108
- # @param name [String] Body param: Human-readable name. 1-256 characters. Omit to preserve. Cannot be c
108
+ # @param name [String] Body param: Human-readable name. Must be non-empty. Omit to preserve. Cannot be
109
109
  #
110
110
  # @param skills [Array<Anthropic::Models::Beta::BetaManagedAgentsAnthropicSkillParams, Anthropic::Models::Beta::BetaManagedAgentsCustomSkillParams>, nil] Body param: Skills. Full replacement. Omit to preserve; send empty array or null
111
111
  #
112
- # @param system_ [String, nil] Body param: System prompt. Up to 100,000 characters. Omit to preserve; send empt
112
+ # @param system_ [String, nil] Body param: System prompt. Omit to preserve; send empty string or null to clear.
113
113
  #
114
114
  # @param tools [Array<Anthropic::Models::Beta::BetaManagedAgentsAgentToolset20260401Params, Anthropic::Models::Beta::BetaManagedAgentsMCPToolsetParams, Anthropic::Models::Beta::BetaManagedAgentsCustomToolParams>, nil] Body param: Tool configurations available to the agent. Full replacement. Omit t
115
115
  #
@@ -40,7 +40,7 @@ module Anthropic
40
40
  # Learn more about the Messages API in our
41
41
  # [user guide](https://docs.claude.com/en/docs/initial-setup)
42
42
  #
43
- # @overload create(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, diagnostics: 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, user_profile_id: nil, betas: nil, request_options: {})
43
+ # @overload create(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: 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, user_profile_id: nil, betas: nil, request_options: {})
44
44
  #
45
45
  # @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
46
46
  #
@@ -56,6 +56,10 @@ module Anthropic
56
56
  #
57
57
  # @param diagnostics [Anthropic::Models::Beta::BetaDiagnosticsParam, nil] Body param: Request-level diagnostics. Currently carries the previous response
58
58
  #
59
+ # @param fallback_credit_token [String, nil] Body param: The `fallback_credit_token` from a prior refusal's `stop_details`.
60
+ #
61
+ # @param fallbacks [Array<Anthropic::Models::Beta::BetaFallbackParam>, nil] Body param: Opt-in server-side retry on one or more substitute models when the r
62
+ #
59
63
  # @param inference_geo [String, nil] Body param: Specifies the geographic region for inference processing. If not spe
60
64
  #
61
65
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
@@ -150,7 +154,7 @@ module Anthropic
150
154
  # Learn more about the Messages API in our
151
155
  # [user guide](https://docs.claude.com/en/docs/initial-setup)
152
156
  #
153
- # @overload stream_raw(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, diagnostics: 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, user_profile_id: nil, betas: nil, request_options: {})
157
+ # @overload stream_raw(max_tokens:, messages:, model:, cache_control: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: 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, user_profile_id: nil, betas: nil, request_options: {})
154
158
  #
155
159
  # @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
156
160
  #
@@ -166,6 +170,10 @@ module Anthropic
166
170
  #
167
171
  # @param diagnostics [Anthropic::Models::Beta::BetaDiagnosticsParam, nil] Body param: Request-level diagnostics. Currently carries the previous response
168
172
  #
173
+ # @param fallback_credit_token [String, nil] Body param: The `fallback_credit_token` from a prior refusal's `stop_details`.
174
+ #
175
+ # @param fallbacks [Array<Anthropic::Models::Beta::BetaFallbackParam>, nil] Body param: Opt-in server-side retry on one or more substitute models when the r
176
+ #
169
177
  # @param inference_geo [String, nil] Body param: Specifies the geographic region for inference processing. If not spe
170
178
  #
171
179
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
@@ -140,7 +140,7 @@ module Anthropic
140
140
  #
141
141
  # @param order [Symbol, Anthropic::Models::Beta::SessionListParams::Order] Query param: Sort direction for results, ordered by created_at. Defaults to desc
142
142
  #
143
- # @param page [String] Query param: Opaque pagination cursor from a previous response's next_page.
143
+ # @param page [String] Query param: Opaque pagination cursor from a previous response.
144
144
  #
145
145
  # @param statuses [Array<Symbol, Anthropic::Models::Beta::SessionListParams::Status>] Query param: Filter by session status. Repeat the parameter to match any of mult
146
146
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anthropic
4
- VERSION = "1.45.0"
4
+ VERSION = "1.47.0"
5
5
  end
data/lib/anthropic.rb CHANGED
@@ -205,6 +205,12 @@ require_relative "anthropic/models/beta/beta_encrypted_code_execution_result_blo
205
205
  require_relative "anthropic/models/beta/beta_encrypted_code_execution_result_block_param"
206
206
  require_relative "anthropic/models/beta/beta_environment"
207
207
  require_relative "anthropic/models/beta/beta_environment_delete_response"
208
+ require_relative "anthropic/models/beta/beta_fallback_block"
209
+ require_relative "anthropic/models/beta/beta_fallback_block_param"
210
+ require_relative "anthropic/models/beta/beta_fallback_info"
211
+ require_relative "anthropic/models/beta/beta_fallback_info_param"
212
+ require_relative "anthropic/models/beta/beta_fallback_message_iteration_usage"
213
+ require_relative "anthropic/models/beta/beta_fallback_param"
208
214
  require_relative "anthropic/models/beta/beta_file_document_source"
209
215
  require_relative "anthropic/models/beta/beta_file_image_source"
210
216
  require_relative "anthropic/models/beta/beta_file_scope"
@@ -118,6 +118,16 @@ module Anthropic
118
118
  :"thinking-token-count-2026-05-13",
119
119
  Anthropic::AnthropicBeta::TaggedSymbol
120
120
  )
121
+ SERVER_SIDE_FALLBACK_2026_06_01 =
122
+ T.let(
123
+ :"server-side-fallback-2026-06-01",
124
+ Anthropic::AnthropicBeta::TaggedSymbol
125
+ )
126
+ FALLBACK_CREDIT_2026_06_01 =
127
+ T.let(
128
+ :"fallback-credit-2026-06-01",
129
+ Anthropic::AnthropicBeta::TaggedSymbol
130
+ )
121
131
  end
122
132
  end
123
133
  end
@@ -30,11 +30,11 @@ module Anthropic
30
30
  end
31
31
  attr_accessor :model
32
32
 
33
- # Human-readable name for the agent. 1-256 characters.
33
+ # Human-readable name for the agent.
34
34
  sig { returns(String) }
35
35
  attr_accessor :name
36
36
 
37
- # Description of what the agent does. Up to 2048 characters.
37
+ # Description of what the agent does.
38
38
  sig { returns(T.nilable(String)) }
39
39
  attr_accessor :description
40
40
 
@@ -84,7 +84,7 @@ module Anthropic
84
84
  end
85
85
  attr_writer :multiagent
86
86
 
87
- # Skills available to the agent. Maximum 20.
87
+ # Skills available to the agent.
88
88
  sig do
89
89
  returns(
90
90
  T.nilable(
@@ -112,7 +112,7 @@ module Anthropic
112
112
  end
113
113
  attr_writer :skills
114
114
 
115
- # System prompt for the agent. Up to 100,000 characters.
115
+ # System prompt for the agent.
116
116
  sig { returns(T.nilable(String)) }
117
117
  attr_accessor :system_
118
118
 
@@ -209,9 +209,9 @@ module Anthropic
209
209
  # e.g. `claude-opus-4-6`, or a `model_config` object for additional configuration
210
210
  # control
211
211
  model:,
212
- # Human-readable name for the agent. 1-256 characters.
212
+ # Human-readable name for the agent.
213
213
  name:,
214
- # Description of what the agent does. Up to 2048 characters.
214
+ # Description of what the agent does.
215
215
  description: nil,
216
216
  # MCP servers this agent connects to. Maximum 20. Names must be unique within the
217
217
  # array.
@@ -222,9 +222,9 @@ module Anthropic
222
222
  # A coordinator topology: the session's primary thread orchestrates work by
223
223
  # spawning session threads, each running an agent drawn from the `agents` roster.
224
224
  multiagent: nil,
225
- # Skills available to the agent. Maximum 20.
225
+ # Skills available to the agent.
226
226
  skills: nil,
227
- # System prompt for the agent. Up to 100,000 characters.
227
+ # System prompt for the agent.
228
228
  system_: nil,
229
229
  # Tool configurations available to the agent. Maximum of 128 tools across all
230
230
  # toolsets allowed.