anthropic 2.0.0 → 2.2.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 +35 -0
- data/README.md +1 -1
- data/lib/anthropic/client.rb +8 -0
- data/lib/anthropic/helpers/bedrock/client.rb +5 -0
- data/lib/anthropic/helpers/bedrock/mantle_client.rb +5 -0
- data/lib/anthropic/helpers/stainless_helper_header.rb +1 -0
- data/lib/anthropic/helpers/threads/beta_message_thread.rb +635 -0
- data/lib/anthropic/helpers/tools/runner.rb +79 -11
- data/lib/anthropic/helpers/vertex/client.rb +5 -0
- data/lib/anthropic/internal/report_page_cursor.rb +2 -2
- data/lib/anthropic/internal/tracing.rb +2 -0
- data/lib/anthropic/models/anthropic_beta.rb +6 -0
- data/lib/anthropic/models/beta/beta_message_thread_param.rb +61 -0
- data/lib/anthropic/models/beta/beta_thread_continue_params.rb +29 -0
- data/lib/anthropic/models/beta/beta_thread_create_params.rb +21 -0
- data/lib/anthropic/models/beta/message_create_params.rb +13 -1
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +13 -1
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_group.rb +271 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_group_by.rb +40 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_item.rb +57 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_metrics.rb +57 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_order_by.rb +22 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_group.rb +247 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_group_by.rb +38 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_item.rb +57 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_metrics.rb +79 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_order_by.rb +24 -0
- data/lib/anthropic/models/beta/organization/analytics/cost_list_params.rb +360 -0
- data/lib/anthropic/models/beta/organization/analytics/usage_list_params.rb +353 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_actor.rb +81 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_actor_type.rb +22 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_api_actor.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor.rb +42 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_aws_provider.rb +35 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_azure_provider.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_gcp_provider.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_oidc_provider.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_provider.rb +72 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_grouped_cost_type.rb +21 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_report_user_actor.rb +65 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_service_account_actor.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_service_tier.rb +23 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_speed.rb +19 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_time_bucket_width.rb +20 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_usage_cost_inference_geo.rb +19 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_usage_cost_product_filter.rb +34 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_usage_cost_sort_order.rb +19 -0
- data/lib/anthropic/models/beta/organization/beta_organization_rate_limit.rb +2 -1
- data/lib/anthropic/models/beta/organization/beta_plugin.rb +12 -6
- data/lib/anthropic/models/beta/organization/beta_plugin_content_scan.rb +11 -5
- data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit.rb +2 -1
- data/lib/anthropic/models/organization/organization_rate_limit.rb +2 -1
- data/lib/anthropic/models/organization/workspaces/workspace_rate_limit.rb +2 -1
- data/lib/anthropic/models/user_profile.rb +26 -1
- data/lib/anthropic/models/user_profile_enforcement_action.rb +66 -0
- data/lib/anthropic/models/user_profile_enforcement_action_ban.rb +62 -0
- data/lib/anthropic/models/user_profile_enforcement_action_next_step.rb +17 -0
- data/lib/anthropic/models/user_profile_enforcement_action_reason.rb +23 -0
- data/lib/anthropic/models/user_profile_enforcement_action_restriction.rb +67 -0
- data/lib/anthropic/models/user_profile_enforcement_status.rb +20 -0
- data/lib/anthropic/models/user_profile_list_params.rb +17 -1
- data/lib/anthropic/models.rb +12 -0
- data/lib/anthropic/resources/beta/messages.rb +78 -4
- data/lib/anthropic/resources/beta/organization/analytics/cost.rb +175 -0
- data/lib/anthropic/resources/beta/organization/analytics/cost_report.rb +13 -6
- data/lib/anthropic/resources/beta/organization/analytics/usage.rb +176 -0
- data/lib/anthropic/resources/beta/organization/analytics/usage_report.rb +9 -2
- data/lib/anthropic/resources/beta/organization/analytics/user_cost_report.rb +12 -5
- data/lib/anthropic/resources/beta/organization/analytics/user_usage_report.rb +15 -8
- data/lib/anthropic/resources/beta/organization/analytics.rb +8 -0
- data/lib/anthropic/resources/beta/organization/plugin_marketplaces.rb +6 -6
- data/lib/anthropic/resources/beta/organization/plugins.rb +12 -9
- data/lib/anthropic/resources/user_profiles.rb +5 -3
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +42 -0
- data/rbi/anthropic/client.rbi +5 -0
- data/rbi/anthropic/helpers/bedrock/client.rbi +5 -0
- data/rbi/anthropic/helpers/bedrock/mantle_client.rbi +5 -0
- data/rbi/anthropic/helpers/threads/beta_message_thread.rbi +100 -0
- data/rbi/anthropic/helpers/vertex/client.rbi +5 -0
- data/rbi/anthropic/internal/tracing.rbi +4 -0
- data/rbi/anthropic/models/anthropic_beta.rbi +10 -0
- data/rbi/anthropic/models/beta/beta_message_thread_param.rbi +80 -0
- data/rbi/anthropic/models/beta/beta_thread_continue_params.rbi +43 -0
- data/rbi/anthropic/models/beta/beta_thread_create_params.rbi +31 -0
- data/rbi/anthropic/models/beta/message_create_params.rbi +37 -0
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +37 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_group.rbi +439 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_group_by.rbi +140 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_item.rbi +110 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_metrics.rbi +79 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_order_by.rbi +50 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_group.rbi +399 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_group_by.rbi +130 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_item.rbi +110 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_metrics.rbi +120 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_order_by.rbi +60 -0
- data/rbi/anthropic/models/beta/organization/analytics/cost_list_params.rbi +624 -0
- data/rbi/anthropic/models/beta/organization/analytics/usage_list_params.rbi +612 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_actor.rbi +134 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_actor_type.rbi +54 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_api_actor.rbi +40 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor.rbi +75 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_aws_provider.rbi +54 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_azure_provider.rbi +42 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_gcp_provider.rbi +42 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_oidc_provider.rbi +42 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_provider.rbi +107 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_grouped_cost_type.rbi +53 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_report_user_actor.rbi +94 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_service_account_actor.rbi +42 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_service_tier.rbi +63 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_speed.rbi +40 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_time_bucket_width.rbi +48 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_usage_cost_inference_geo.rbi +43 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_usage_cost_product_filter.rbi +98 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_usage_cost_sort_order.rbi +43 -0
- data/rbi/anthropic/models/beta/organization/beta_organization_rate_limit.rbi +4 -2
- data/rbi/anthropic/models/beta/organization/beta_plugin.rbi +20 -8
- data/rbi/anthropic/models/beta/organization/beta_plugin_content_scan.rbi +15 -6
- data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit.rbi +4 -2
- data/rbi/anthropic/models/organization/organization_rate_limit.rbi +4 -2
- data/rbi/anthropic/models/organization/workspaces/workspace_rate_limit.rbi +4 -2
- data/rbi/anthropic/models/user_profile.rbi +42 -0
- data/rbi/anthropic/models/user_profile_enforcement_action.rbi +95 -0
- data/rbi/anthropic/models/user_profile_enforcement_action_ban.rbi +96 -0
- data/rbi/anthropic/models/user_profile_enforcement_action_next_step.rbi +34 -0
- data/rbi/anthropic/models/user_profile_enforcement_action_reason.rbi +58 -0
- data/rbi/anthropic/models/user_profile_enforcement_action_restriction.rbi +106 -0
- data/rbi/anthropic/models/user_profile_enforcement_status.rbi +39 -0
- data/rbi/anthropic/models/user_profile_list_params.rbi +36 -0
- data/rbi/anthropic/models.rbi +16 -0
- data/rbi/anthropic/resources/beta/messages.rbi +191 -0
- data/rbi/anthropic/resources/beta/organization/analytics/cost.rbi +245 -0
- data/rbi/anthropic/resources/beta/organization/analytics/cost_report.rbi +12 -5
- data/rbi/anthropic/resources/beta/organization/analytics/usage.rbi +240 -0
- data/rbi/anthropic/resources/beta/organization/analytics/usage_report.rbi +9 -2
- data/rbi/anthropic/resources/beta/organization/analytics/user_cost_report.rbi +12 -5
- data/rbi/anthropic/resources/beta/organization/analytics/user_usage_report.rbi +14 -7
- data/rbi/anthropic/resources/beta/organization/analytics.rbi +10 -0
- data/rbi/anthropic/resources/beta/organization/plugin_marketplaces.rbi +6 -6
- data/rbi/anthropic/resources/beta/organization/plugins.rbi +12 -9
- data/rbi/anthropic/resources/user_profiles.rbi +12 -0
- data/rbi/lib/anthropic/helpers/stainless_helper_header.rbi +2 -0
- data/sig/anthropic/client.rbs +2 -0
- data/sig/anthropic/helpers/bedrock/client.rbs +2 -0
- data/sig/anthropic/helpers/threads/beta_message_thread.rbs +40 -0
- data/sig/anthropic/helpers/tools/runner.rbs +40 -0
- data/sig/anthropic/helpers/vertex/client.rbs +2 -0
- data/sig/anthropic/internal/tracing.rbs +2 -0
- data/sig/anthropic/models/anthropic_beta.rbs +4 -0
- data/sig/anthropic/models/beta/beta_message_thread_param.rbs +40 -0
- data/sig/anthropic/models/beta/beta_thread_continue_params.rbs +20 -0
- data/sig/anthropic/models/beta/beta_thread_create_params.rbs +17 -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/beta/organization/analytics/beta_analytics_cost_group.rbs +126 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_cost_group_by.rbs +60 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_cost_item.rbs +41 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_cost_metrics.rbs +41 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_cost_order_by.rbs +21 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_group.rbs +116 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_group_by.rbs +56 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_item.rbs +41 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_metrics.rbs +56 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_order_by.rbs +28 -0
- data/sig/anthropic/models/beta/organization/analytics/cost_list_params.rbs +188 -0
- data/sig/anthropic/models/beta/organization/analytics/usage_list_params.rbs +188 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_actor.rbs +67 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_actor_type.rbs +21 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_api_actor.rbs +19 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor.rbs +34 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_aws_provider.rbs +30 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_azure_provider.rbs +20 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_gcp_provider.rbs +20 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_oidc_provider.rbs +20 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_provider.rbs +60 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_grouped_cost_type.rbs +21 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_report_user_actor.rbs +44 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_service_account_actor.rbs +26 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_service_tier.rbs +28 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_speed.rbs +18 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_time_bucket_width.rbs +19 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_usage_cost_inference_geo.rbs +18 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_usage_cost_product_filter.rbs +40 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_usage_cost_sort_order.rbs +18 -0
- data/sig/anthropic/models/user_profile.rbs +10 -0
- data/sig/anthropic/models/user_profile_enforcement_action.rbs +50 -0
- data/sig/anthropic/models/user_profile_enforcement_action_ban.rbs +45 -0
- data/sig/anthropic/models/user_profile_enforcement_action_next_step.rbs +13 -0
- data/sig/anthropic/models/user_profile_enforcement_action_reason.rbs +24 -0
- data/sig/anthropic/models/user_profile_enforcement_action_restriction.rbs +45 -0
- data/sig/anthropic/models/user_profile_enforcement_status.rbs +17 -0
- data/sig/anthropic/models/user_profile_list_params.rbs +9 -0
- data/sig/anthropic/models.rbs +12 -0
- data/sig/anthropic/resources/beta/messages.rbs +33 -0
- data/sig/anthropic/resources/beta/organization/analytics/cost.rbs +46 -0
- data/sig/anthropic/resources/beta/organization/analytics/usage.rbs +46 -0
- data/sig/anthropic/resources/beta/organization/analytics.rbs +4 -0
- data/sig/anthropic/resources/user_profiles.rbs +1 -0
- metadata +130 -3
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Helpers
|
|
5
|
+
module Threads
|
|
6
|
+
# A conversation that the API keeps between requests, so that each turn sends only
|
|
7
|
+
# the messages that are new. Create one with `client.beta.messages.thread(...)`.
|
|
8
|
+
#
|
|
9
|
+
# A thread runs one turn at a time and is not safe for concurrent use.
|
|
10
|
+
class BetaMessageThread
|
|
11
|
+
# The whole history: every message that was sent, every reply, and the messages
|
|
12
|
+
# staged for the next turn.
|
|
13
|
+
sig { returns(T::Array[T::Hash[Symbol, T.anything]]) }
|
|
14
|
+
def messages
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The reply the next turn continues from, or `nil` when the next turn starts a new
|
|
18
|
+
# thread.
|
|
19
|
+
sig { returns(T.nilable(String)) }
|
|
20
|
+
def previous_message_id
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# What `client.beta.messages.thread` takes to create a thread that behaves the
|
|
24
|
+
# same, with `messages` set to the whole history.
|
|
25
|
+
sig { returns(T::Hash[Symbol, T.anything]) }
|
|
26
|
+
def params
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Stages messages for the next turn without sending them.
|
|
30
|
+
sig do
|
|
31
|
+
params(
|
|
32
|
+
messages:
|
|
33
|
+
T.any(
|
|
34
|
+
Anthropic::Beta::BetaMessageParam::Variants,
|
|
35
|
+
Anthropic::Beta::BetaMessage,
|
|
36
|
+
Anthropic::Internal::AnyHash
|
|
37
|
+
)
|
|
38
|
+
).void
|
|
39
|
+
end
|
|
40
|
+
def append(*messages)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Changes the thread's request fields for every later turn, where `nil` removes a
|
|
44
|
+
# field. It sends no request. `system_` and `tools` cannot change once a turn has
|
|
45
|
+
# created the thread.
|
|
46
|
+
sig { params(params: T.anything).void }
|
|
47
|
+
def update(**params)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns a new, independent thread with this thread's history and request fields.
|
|
51
|
+
# It sends no request.
|
|
52
|
+
sig { returns(Anthropic::Helpers::Threads::BetaMessageThread) }
|
|
53
|
+
def fork
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Creates a tool runner that runs over this thread. It sends no request.
|
|
57
|
+
sig do
|
|
58
|
+
params(max_iterations: T.nilable(Integer)).returns(
|
|
59
|
+
Anthropic::Helpers::Tools::Runner
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
def tool_runner(max_iterations: nil)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Sends the messages staged with `#append`, followed by `messages`, as one turn
|
|
66
|
+
# and returns the reply. `params` takes the keywords of `#update` and applies to
|
|
67
|
+
# this turn only.
|
|
68
|
+
sig do
|
|
69
|
+
params(
|
|
70
|
+
messages:
|
|
71
|
+
T.any(
|
|
72
|
+
Anthropic::Beta::BetaMessageParam::Variants,
|
|
73
|
+
Anthropic::Beta::BetaMessage,
|
|
74
|
+
Anthropic::Internal::AnyHash
|
|
75
|
+
),
|
|
76
|
+
params: T.anything
|
|
77
|
+
).returns(Anthropic::Beta::BetaMessage)
|
|
78
|
+
end
|
|
79
|
+
def send_message(*messages, **params)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Sends the next turn like `#send_message` and returns the stream of the reply.
|
|
83
|
+
# The turn is in progress until the stream ends or is closed.
|
|
84
|
+
sig do
|
|
85
|
+
params(
|
|
86
|
+
messages:
|
|
87
|
+
T.any(
|
|
88
|
+
Anthropic::Beta::BetaMessageParam::Variants,
|
|
89
|
+
Anthropic::Beta::BetaMessage,
|
|
90
|
+
Anthropic::Internal::AnyHash
|
|
91
|
+
),
|
|
92
|
+
params: T.anything
|
|
93
|
+
).returns(Anthropic::Streaming::MessageStream)
|
|
94
|
+
end
|
|
95
|
+
def stream(*messages, **params)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -349,6 +349,10 @@ module Anthropic
|
|
|
349
349
|
"anthropic.organization.analytics.skills.list"
|
|
350
350
|
ORGANIZATION_ANALYTICS_ARTIFACTS_LIST =
|
|
351
351
|
"anthropic.organization.analytics.artifacts.list"
|
|
352
|
+
ORGANIZATION_ANALYTICS_USAGE_LIST =
|
|
353
|
+
"anthropic.organization.analytics.usage.list"
|
|
354
|
+
ORGANIZATION_ANALYTICS_COST_LIST =
|
|
355
|
+
"anthropic.organization.analytics.cost.list"
|
|
352
356
|
ORGANIZATION_ANALYTICS_USAGE_REPORT_LIST =
|
|
353
357
|
"anthropic.organization.analytics.usage_report.list"
|
|
354
358
|
ORGANIZATION_ANALYTICS_USER_USAGE_REPORT_LIST =
|
|
@@ -227,6 +227,16 @@ module Anthropic
|
|
|
227
227
|
)
|
|
228
228
|
WEBHOOKS_2026_10_07 =
|
|
229
229
|
T.let(:"webhooks-2026-10-07", Anthropic::AnthropicBeta::TaggedSymbol)
|
|
230
|
+
MESSAGE_THREADS_2026_08_12 =
|
|
231
|
+
T.let(
|
|
232
|
+
:"message-threads-2026-08-12",
|
|
233
|
+
Anthropic::AnthropicBeta::TaggedSymbol
|
|
234
|
+
)
|
|
235
|
+
ANALYTICS_USAGE_COST_2026_08_24 =
|
|
236
|
+
T.let(
|
|
237
|
+
:"analytics-usage-cost-2026-08-24",
|
|
238
|
+
Anthropic::AnthropicBeta::TaggedSymbol
|
|
239
|
+
)
|
|
230
240
|
end
|
|
231
241
|
end
|
|
232
242
|
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaMessageThreadParam = Beta::BetaMessageThreadParam
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
# Server-held conversation state (a Thread). `{"type": "create"}` asks the server
|
|
9
|
+
# to hold this conversation's state under the response's `id`;
|
|
10
|
+
# `{"type": "continue", "previous_message_id": ...}` resumes from a previous
|
|
11
|
+
# response so only the new turn's messages are sent. The response shape is
|
|
12
|
+
# unchanged.
|
|
13
|
+
module BetaMessageThreadParam
|
|
14
|
+
extend Anthropic::Internal::Type::Union
|
|
15
|
+
|
|
16
|
+
Variants =
|
|
17
|
+
T.type_alias do
|
|
18
|
+
T.any(
|
|
19
|
+
Anthropic::Beta::BetaThreadCreateParams,
|
|
20
|
+
Anthropic::Beta::BetaThreadContinueParams
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
module Type
|
|
25
|
+
extend Anthropic::Internal::Type::Enum
|
|
26
|
+
|
|
27
|
+
TaggedSymbol =
|
|
28
|
+
T.type_alias do
|
|
29
|
+
T.all(Symbol, Anthropic::Beta::BetaMessageThreadParam::Type)
|
|
30
|
+
end
|
|
31
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
32
|
+
|
|
33
|
+
CREATE =
|
|
34
|
+
T.let(
|
|
35
|
+
:create,
|
|
36
|
+
Anthropic::Beta::BetaMessageThreadParam::Type::TaggedSymbol
|
|
37
|
+
)
|
|
38
|
+
CONTINUE =
|
|
39
|
+
T.let(
|
|
40
|
+
:continue,
|
|
41
|
+
Anthropic::Beta::BetaMessageThreadParam::Type::TaggedSymbol
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
sig do
|
|
45
|
+
override.returns(
|
|
46
|
+
T::Array[
|
|
47
|
+
Anthropic::Beta::BetaMessageThreadParam::Type::TaggedSymbol
|
|
48
|
+
]
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
def self.values
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
sig do
|
|
56
|
+
override.returns(
|
|
57
|
+
T::Array[Anthropic::Beta::BetaMessageThreadParam::Variants]
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
def self.variants
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Creates a new instance of the variant class whose `type` matches the given
|
|
64
|
+
# value, passing the remaining arguments to its constructor.
|
|
65
|
+
sig do
|
|
66
|
+
params(
|
|
67
|
+
type: Anthropic::Beta::BetaMessageThreadParam::Type::OrSymbol,
|
|
68
|
+
previous_message_id: String
|
|
69
|
+
).returns(Anthropic::Beta::BetaMessageThreadParam::Variants)
|
|
70
|
+
end
|
|
71
|
+
def self.new(
|
|
72
|
+
type:,
|
|
73
|
+
# The `id` of the previous response in this Thread.
|
|
74
|
+
previous_message_id: nil
|
|
75
|
+
)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaThreadContinueParams = Beta::BetaThreadContinueParams
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaThreadContinueParams < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaThreadContinueParams,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The `id` of the previous response in this Thread.
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
attr_accessor :previous_message_id
|
|
20
|
+
|
|
21
|
+
sig { returns(Symbol) }
|
|
22
|
+
attr_accessor :type
|
|
23
|
+
|
|
24
|
+
# Resume from the response named by `previous_message_id`.
|
|
25
|
+
sig do
|
|
26
|
+
params(previous_message_id: String, type: Symbol).returns(
|
|
27
|
+
T.attached_class
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
def self.new(
|
|
31
|
+
# The `id` of the previous response in this Thread.
|
|
32
|
+
previous_message_id:,
|
|
33
|
+
type: :continue
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
sig { override.returns({ previous_message_id: String, type: Symbol }) }
|
|
38
|
+
def to_hash
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
BetaThreadCreateParams = Beta::BetaThreadCreateParams
|
|
6
|
+
|
|
7
|
+
module Beta
|
|
8
|
+
class BetaThreadCreateParams < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::BetaThreadCreateParams,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig { returns(Symbol) }
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
# Start holding conversation state under this response's `id`.
|
|
21
|
+
sig { params(type: Symbol).returns(T.attached_class) }
|
|
22
|
+
def self.new(type: :create)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
sig { override.returns({ type: Symbol }) }
|
|
26
|
+
def to_hash
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -398,6 +398,23 @@ module Anthropic
|
|
|
398
398
|
end
|
|
399
399
|
attr_writer :thinking
|
|
400
400
|
|
|
401
|
+
# Server-held conversation state (a Thread). `{"type": "create"}` asks the server
|
|
402
|
+
# to hold this conversation's state under the response's `id`;
|
|
403
|
+
# `{"type": "continue", "previous_message_id": ...}` resumes from a previous
|
|
404
|
+
# response so only the new turn's messages are sent. The response shape is
|
|
405
|
+
# unchanged.
|
|
406
|
+
sig do
|
|
407
|
+
returns(
|
|
408
|
+
T.nilable(
|
|
409
|
+
T.any(
|
|
410
|
+
Anthropic::Beta::BetaThreadCreateParams,
|
|
411
|
+
Anthropic::Beta::BetaThreadContinueParams
|
|
412
|
+
)
|
|
413
|
+
)
|
|
414
|
+
)
|
|
415
|
+
end
|
|
416
|
+
attr_accessor :thread
|
|
417
|
+
|
|
401
418
|
# How the model should use the provided tools. The model can use a specific tool,
|
|
402
419
|
# any available tool, decide by itself, or not use tools at all.
|
|
403
420
|
sig do
|
|
@@ -680,6 +697,13 @@ module Anthropic
|
|
|
680
697
|
Anthropic::Beta::BetaThinkingConfigBetweenTools::OrHash,
|
|
681
698
|
Anthropic::Beta::BetaThinkingConfigAdaptive::OrHash
|
|
682
699
|
),
|
|
700
|
+
thread:
|
|
701
|
+
T.nilable(
|
|
702
|
+
T.any(
|
|
703
|
+
Anthropic::Beta::BetaThreadCreateParams::OrHash,
|
|
704
|
+
Anthropic::Beta::BetaThreadContinueParams::OrHash
|
|
705
|
+
)
|
|
706
|
+
),
|
|
683
707
|
tool_choice:
|
|
684
708
|
T.any(
|
|
685
709
|
Anthropic::Beta::BetaToolChoiceAuto::OrHash,
|
|
@@ -925,6 +949,12 @@ module Anthropic
|
|
|
925
949
|
# [thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#configuring-thinking)
|
|
926
950
|
# for each model's behavior.
|
|
927
951
|
thinking: nil,
|
|
952
|
+
# Server-held conversation state (a Thread). `{"type": "create"}` asks the server
|
|
953
|
+
# to hold this conversation's state under the response's `id`;
|
|
954
|
+
# `{"type": "continue", "previous_message_id": ...}` resumes from a previous
|
|
955
|
+
# response so only the new turn's messages are sent. The response shape is
|
|
956
|
+
# unchanged.
|
|
957
|
+
thread: nil,
|
|
928
958
|
# How the model should use the provided tools. The model can use a specific tool,
|
|
929
959
|
# any available tool, decide by itself, or not use tools at all.
|
|
930
960
|
tool_choice: nil,
|
|
@@ -1072,6 +1102,13 @@ module Anthropic
|
|
|
1072
1102
|
Anthropic::Beta::BetaThinkingConfigBetweenTools,
|
|
1073
1103
|
Anthropic::Beta::BetaThinkingConfigAdaptive
|
|
1074
1104
|
),
|
|
1105
|
+
thread:
|
|
1106
|
+
T.nilable(
|
|
1107
|
+
T.any(
|
|
1108
|
+
Anthropic::Beta::BetaThreadCreateParams,
|
|
1109
|
+
Anthropic::Beta::BetaThreadContinueParams
|
|
1110
|
+
)
|
|
1111
|
+
),
|
|
1075
1112
|
tool_choice:
|
|
1076
1113
|
T.any(
|
|
1077
1114
|
Anthropic::Beta::BetaToolChoiceAuto,
|
|
@@ -611,6 +611,23 @@ module Anthropic
|
|
|
611
611
|
end
|
|
612
612
|
attr_writer :thinking
|
|
613
613
|
|
|
614
|
+
# Server-held conversation state (a Thread). `{"type": "create"}` asks the server
|
|
615
|
+
# to hold this conversation's state under the response's `id`;
|
|
616
|
+
# `{"type": "continue", "previous_message_id": ...}` resumes from a previous
|
|
617
|
+
# response so only the new turn's messages are sent. The response shape is
|
|
618
|
+
# unchanged.
|
|
619
|
+
sig do
|
|
620
|
+
returns(
|
|
621
|
+
T.nilable(
|
|
622
|
+
T.any(
|
|
623
|
+
Anthropic::Beta::BetaThreadCreateParams,
|
|
624
|
+
Anthropic::Beta::BetaThreadContinueParams
|
|
625
|
+
)
|
|
626
|
+
)
|
|
627
|
+
)
|
|
628
|
+
end
|
|
629
|
+
attr_accessor :thread
|
|
630
|
+
|
|
614
631
|
# How the model should use the provided tools. The model can use a specific tool,
|
|
615
632
|
# any available tool, decide by itself, or not use tools at all.
|
|
616
633
|
sig do
|
|
@@ -872,6 +889,13 @@ module Anthropic
|
|
|
872
889
|
Anthropic::Beta::BetaThinkingConfigBetweenTools::OrHash,
|
|
873
890
|
Anthropic::Beta::BetaThinkingConfigAdaptive::OrHash
|
|
874
891
|
),
|
|
892
|
+
thread:
|
|
893
|
+
T.nilable(
|
|
894
|
+
T.any(
|
|
895
|
+
Anthropic::Beta::BetaThreadCreateParams::OrHash,
|
|
896
|
+
Anthropic::Beta::BetaThreadContinueParams::OrHash
|
|
897
|
+
)
|
|
898
|
+
),
|
|
875
899
|
tool_choice:
|
|
876
900
|
T.any(
|
|
877
901
|
Anthropic::Beta::BetaToolChoiceAuto::OrHash,
|
|
@@ -1122,6 +1146,12 @@ module Anthropic
|
|
|
1122
1146
|
# [thinking](https://platform.claude.com/docs/en/build-with-claude/thinking#configuring-thinking)
|
|
1123
1147
|
# for each model's behavior.
|
|
1124
1148
|
thinking: nil,
|
|
1149
|
+
# Server-held conversation state (a Thread). `{"type": "create"}` asks the server
|
|
1150
|
+
# to hold this conversation's state under the response's `id`;
|
|
1151
|
+
# `{"type": "continue", "previous_message_id": ...}` resumes from a previous
|
|
1152
|
+
# response so only the new turn's messages are sent. The response shape is
|
|
1153
|
+
# unchanged.
|
|
1154
|
+
thread: nil,
|
|
1125
1155
|
# How the model should use the provided tools. The model can use a specific tool,
|
|
1126
1156
|
# any available tool, decide by itself, or not use tools at all.
|
|
1127
1157
|
tool_choice: nil,
|
|
@@ -1271,6 +1301,13 @@ module Anthropic
|
|
|
1271
1301
|
Anthropic::Beta::BetaThinkingConfigBetweenTools,
|
|
1272
1302
|
Anthropic::Beta::BetaThinkingConfigAdaptive
|
|
1273
1303
|
),
|
|
1304
|
+
thread:
|
|
1305
|
+
T.nilable(
|
|
1306
|
+
T.any(
|
|
1307
|
+
Anthropic::Beta::BetaThreadCreateParams,
|
|
1308
|
+
Anthropic::Beta::BetaThreadContinueParams
|
|
1309
|
+
)
|
|
1310
|
+
),
|
|
1274
1311
|
tool_choice:
|
|
1275
1312
|
T.any(
|
|
1276
1313
|
Anthropic::Beta::BetaToolChoiceAuto,
|