anthropic 1.49.0 → 1.50.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 +15 -0
- data/README.md +1 -1
- data/lib/anthropic/helpers/stainless_helper_header.rb +43 -0
- data/lib/anthropic/helpers/tools/runner.rb +8 -4
- data/lib/anthropic/internal/stream.rb +1 -1
- data/lib/anthropic/models/beta/agent_create_params.rb +3 -1
- data/lib/anthropic/models/beta/agent_update_params.rb +6 -3
- data/lib/anthropic/models/beta/beta_cache_control_ephemeral.rb +6 -2
- data/lib/anthropic/models/beta/beta_fallback_refusal_trigger.rb +1 -0
- data/lib/anthropic/models/beta/beta_refusal_stop_details.rb +1 -0
- data/lib/anthropic/models/beta/message_create_params.rb +10 -10
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +13 -11
- data/lib/anthropic/models/cache_control_ephemeral.rb +6 -2
- data/lib/anthropic/models/message_create_params.rb +10 -1
- data/lib/anthropic/models/messages/batch_create_params.rb +12 -1
- data/lib/anthropic/models/refusal_stop_details.rb +1 -0
- data/lib/anthropic/resources/beta/messages/batches.rb +4 -2
- data/lib/anthropic/resources/beta/messages.rb +9 -9
- data/lib/anthropic/resources/messages/batches.rb +7 -3
- data/lib/anthropic/resources/messages.rb +57 -41
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +1 -0
- data/rbi/anthropic/models/beta/agent_create_params.rbi +6 -2
- data/rbi/anthropic/models/beta/agent_update_params.rbi +10 -4
- data/rbi/anthropic/models/beta/beta_cache_control_ephemeral.rbi +9 -3
- data/rbi/anthropic/models/beta/beta_fallback_refusal_trigger.rbi +5 -0
- data/rbi/anthropic/models/beta/beta_refusal_stop_details.rbi +5 -0
- data/rbi/anthropic/models/beta/message_create_params.rbi +13 -10
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +20 -13
- data/rbi/anthropic/models/cache_control_ephemeral.rbi +9 -3
- data/rbi/anthropic/models/message_create_params.rbi +13 -0
- data/rbi/anthropic/models/messages/batch_create_params.rbi +17 -0
- data/rbi/anthropic/models/refusal_stop_details.rbi +5 -0
- data/rbi/anthropic/resources/beta/agents.rbi +7 -2
- data/rbi/anthropic/resources/beta/messages/batches.rbi +7 -0
- data/rbi/anthropic/resources/beta/messages.rbi +10 -8
- data/rbi/anthropic/resources/messages/batches.rbi +9 -2
- data/rbi/anthropic/resources/messages.rbi +54 -42
- data/rbi/lib/anthropic/helpers/stainless_helper_header.rbi +17 -0
- data/sig/anthropic/models/beta/beta_fallback_refusal_trigger.rbs +7 -1
- data/sig/anthropic/models/beta/beta_refusal_stop_details.rbs +7 -1
- data/sig/anthropic/models/beta/message_create_params.rbs +8 -6
- data/sig/anthropic/models/beta/messages/batch_create_params.rbs +11 -9
- data/sig/anthropic/models/message_create_params.rbs +8 -1
- data/sig/anthropic/models/messages/batch_create_params.rbs +10 -1
- data/sig/anthropic/models/refusal_stop_details.rbs +7 -1
- data/sig/anthropic/resources/beta/messages/batches.rbs +1 -0
- data/sig/anthropic/resources/beta/messages.rbs +2 -2
- data/sig/anthropic/resources/messages/batches.rbs +1 -0
- data/sig/anthropic/resources/messages.rbs +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0cb9e2af5b982d157a5df70ead8cf936d4f613750111f8c8633196404b340bf4
|
|
4
|
+
data.tar.gz: d51e60fe8a84879be1eed6f229088ee078d08124ad6820a338baf44d78abac2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea21a2e85414e4bbf4d279bc3261eba4109c861ef45eecb280d2f561edc3c6c35e58424d541ca0168bd4dda5365a49a6d94e66e004fa2d838ec2cd7a134fcea1
|
|
7
|
+
data.tar.gz: 1830e871fd2b75c8453a3a597eead9e82871818a6c04f7aa801da37bb89914be65aa36ecbd7ab7cd7ed27dcdb8ec026be237081df8f74dab0efc10f84ec37e29
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.50.0 (2026-06-24)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.49.0...v1.50.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.49.0...v1.50.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **client:** add support for system.message streaming events ([2333173](https://github.com/anthropics/anthropic-sdk-ruby/commit/23331737588b1942dfda599a04ccb23109824f80))
|
|
10
|
+
* **helpers:** single source for x-stainless-helper + tag the BetaToolRunner ([#36](https://github.com/anthropics/anthropic-sdk-ruby/issues/36)) ([95124e5](https://github.com/anthropics/anthropic-sdk-ruby/commit/95124e582c1f413b5dd05f4cc5dafecfe87b6666))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Chores
|
|
14
|
+
|
|
15
|
+
* **api:** add support for new refusal category ([9b5050f](https://github.com/anthropics/anthropic-sdk-ruby/commit/9b5050f677532d60ee8b47e08c62b3e59aacdc7b))
|
|
16
|
+
* **api:** add support for sending User Profile ID in request headers ([4a263e8](https://github.com/anthropics/anthropic-sdk-ruby/commit/4a263e8b43096c92533701eb4423c2abc21e3408))
|
|
17
|
+
|
|
3
18
|
## 1.49.0 (2026-06-18)
|
|
4
19
|
|
|
5
20
|
Full Changelog: [v1.48.2...v1.49.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.48.2...v1.49.0)
|
data/README.md
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Helpers
|
|
5
|
+
# Single source of truth for the `x-stainless-helper` telemetry header — the
|
|
6
|
+
# key, the closed value vocabulary shared across SDKs, and the comma-append
|
|
7
|
+
# merge.
|
|
8
|
+
#
|
|
9
|
+
# @api private
|
|
10
|
+
module StainlessHelperHeader
|
|
11
|
+
# Telemetry header naming the SDK helper(s) a request came from. Always
|
|
12
|
+
# this lowercase form; header lookups are case-insensitive but a single
|
|
13
|
+
# canonical casing keeps every call site greppable.
|
|
14
|
+
HEADER = "x-stainless-helper"
|
|
15
|
+
|
|
16
|
+
# Closed value vocabulary. Existing values keep their original spellings —
|
|
17
|
+
# telemetry consumers match on them, so renames lose history. New tags are
|
|
18
|
+
# hyphenated lowercase.
|
|
19
|
+
BETA_TOOL_RUNNER = "BetaToolRunner"
|
|
20
|
+
|
|
21
|
+
class << self
|
|
22
|
+
# The {HEADER} value to set after appending `value` to whatever is
|
|
23
|
+
# already present in `headers` — existing tags keep their position, the
|
|
24
|
+
# new tag goes at the end, duplicates are dropped, joined as one
|
|
25
|
+
# comma-separated string. The backend logs the header as one opaque
|
|
26
|
+
# string, so a second header line or a clobbered value loses data.
|
|
27
|
+
#
|
|
28
|
+
# @param headers [Hash{String => String}]
|
|
29
|
+
# @param value [String]
|
|
30
|
+
# @return [String]
|
|
31
|
+
def merged_value(headers, value)
|
|
32
|
+
existing =
|
|
33
|
+
headers
|
|
34
|
+
.filter_map { |k, v| v if k.to_s.casecmp?(HEADER) }
|
|
35
|
+
.flat_map { _1.to_s.split(",") }
|
|
36
|
+
.map(&:strip)
|
|
37
|
+
.reject(&:empty?)
|
|
38
|
+
(existing + [value]).uniq.join(", ")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -25,7 +25,7 @@ module Anthropic
|
|
|
25
25
|
message = nil
|
|
26
26
|
unless finished?
|
|
27
27
|
fold do
|
|
28
|
-
message = @client.beta.messages.create(with_helper_header(_1,
|
|
28
|
+
message = @client.beta.messages.create(with_helper_header(_1, StainlessHelperHeader::BETA_TOOL_RUNNER))
|
|
29
29
|
[true, message]
|
|
30
30
|
end
|
|
31
31
|
end
|
|
@@ -46,7 +46,7 @@ module Anthropic
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
fold do
|
|
49
|
-
message = @client.beta.messages.create(with_helper_header(_1,
|
|
49
|
+
message = @client.beta.messages.create(with_helper_header(_1, StainlessHelperHeader::BETA_TOOL_RUNNER))
|
|
50
50
|
blk.call(message)
|
|
51
51
|
[false, message]
|
|
52
52
|
end
|
|
@@ -59,7 +59,7 @@ module Anthropic
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
fold do
|
|
62
|
-
stream = @client.beta.messages.stream(with_helper_header(_1,
|
|
62
|
+
stream = @client.beta.messages.stream(with_helper_header(_1, StainlessHelperHeader::BETA_TOOL_RUNNER))
|
|
63
63
|
blk.call(stream)
|
|
64
64
|
[false, stream.accumulated_message]
|
|
65
65
|
ensure
|
|
@@ -260,8 +260,12 @@ module Anthropic
|
|
|
260
260
|
private def with_helper_header(params, helper)
|
|
261
261
|
options = params[:request_options] || {}
|
|
262
262
|
headers = options[:extra_headers] || {}
|
|
263
|
+
merged = StainlessHelperHeader.merged_value(headers, helper)
|
|
263
264
|
|
|
264
|
-
{
|
|
265
|
+
{
|
|
266
|
+
**params,
|
|
267
|
+
request_options: {**options, extra_headers: {**headers, StainlessHelperHeader::HEADER => merged}}
|
|
268
|
+
}
|
|
265
269
|
end
|
|
266
270
|
end
|
|
267
271
|
end
|
|
@@ -26,7 +26,7 @@ module Anthropic
|
|
|
26
26
|
unwrapped = Anthropic::Internal::Util.dig(decoded, @unwrap)
|
|
27
27
|
y << Anthropic::Internal::Type::Converter.coerce(@model, unwrapped)
|
|
28
28
|
in {
|
|
29
|
-
event: "message_start" | "message_delta" | "message_stop" | "content_block_start" | "content_block_delta" | "content_block_stop" | "message" | "user.message" | "user.interrupt" | "user.tool_confirmation" | "user.custom_tool_result" | "user.tool_result" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "agent.mcp_tool_use" | "agent.mcp_tool_result" | "agent.custom_tool_use" | "agent.thread_context_compacted" | "session.status_running" | "session.status_idle" | "session.status_rescheduled" | "session.status_terminated" | "session.error" | "session.deleted" | "session.updated" | "span.model_request_start" | "span.model_request_end" | "span.outcome_evaluation_start" | "span.outcome_evaluation_ongoing" | "span.outcome_evaluation_end" | "user.define_outcome" | "agent.thread_message_received" | "agent.thread_message_sent" | "agent.session_thread_message_received" | "agent.session_thread_message_sent" | "session.thread_created" | "session.thread_status_created" | "session.thread_status_running" | "session.thread_status_idle" | "session.thread_status_rescheduled" | "session.thread_status_terminated",
|
|
29
|
+
event: "message_start" | "message_delta" | "message_stop" | "content_block_start" | "content_block_delta" | "content_block_stop" | "message" | "user.message" | "user.interrupt" | "user.tool_confirmation" | "user.custom_tool_result" | "user.tool_result" | "agent.message" | "agent.thinking" | "agent.tool_use" | "agent.tool_result" | "agent.mcp_tool_use" | "agent.mcp_tool_result" | "agent.custom_tool_use" | "agent.thread_context_compacted" | "session.status_running" | "session.status_idle" | "session.status_rescheduled" | "session.status_terminated" | "session.error" | "session.deleted" | "session.updated" | "span.model_request_start" | "span.model_request_end" | "span.outcome_evaluation_start" | "span.outcome_evaluation_ongoing" | "span.outcome_evaluation_end" | "user.define_outcome" | "agent.thread_message_received" | "agent.thread_message_sent" | "agent.session_thread_message_received" | "agent.session_thread_message_sent" | "session.thread_created" | "session.thread_status_created" | "session.thread_status_running" | "session.thread_status_idle" | "session.thread_status_rescheduled" | "session.thread_status_terminated" | "system.message",
|
|
30
30
|
data: String => data
|
|
31
31
|
}
|
|
32
32
|
decoded = JSON.parse(data, symbolize_names: true)
|
|
@@ -31,7 +31,9 @@ module Anthropic
|
|
|
31
31
|
|
|
32
32
|
# @!attribute mcp_servers
|
|
33
33
|
# MCP servers this agent connects to. Maximum 20. Names must be unique within the
|
|
34
|
-
# array.
|
|
34
|
+
# array. Every server must be referenced by an `mcp_toolset` in `tools`;
|
|
35
|
+
# unreferenced servers are rejected. See the
|
|
36
|
+
# [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
|
|
35
37
|
#
|
|
36
38
|
# @return [Array<Anthropic::Models::Beta::BetaManagedAgentsURLMCPServerParams>, nil]
|
|
37
39
|
optional :mcp_servers,
|
|
@@ -28,8 +28,11 @@ module Anthropic
|
|
|
28
28
|
optional :description, String, nil?: true
|
|
29
29
|
|
|
30
30
|
# @!attribute mcp_servers
|
|
31
|
-
# MCP servers. Full replacement. Omit to preserve; send empty array or null to
|
|
32
|
-
# clear. Names must be unique. Maximum 20.
|
|
31
|
+
# MCP servers. Full replacement. Omit to preserve; send empty array or `null` to
|
|
32
|
+
# clear. Names must be unique. Maximum 20. Every server must be referenced by an
|
|
33
|
+
# `mcp_toolset` in the agent's resulting `tools`; unreferenced servers are
|
|
34
|
+
# rejected. See the
|
|
35
|
+
# [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
|
|
33
36
|
#
|
|
34
37
|
# @return [Array<Anthropic::Models::Beta::BetaManagedAgentsURLMCPServerParams>, nil]
|
|
35
38
|
optional :mcp_servers,
|
|
@@ -110,7 +113,7 @@ module Anthropic
|
|
|
110
113
|
#
|
|
111
114
|
# @param description [String, nil] Description. Omit to preserve; send empty string or null to clear.
|
|
112
115
|
#
|
|
113
|
-
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaManagedAgentsURLMCPServerParams>, nil] MCP servers. Full replacement. Omit to preserve; send empty array or null to
|
|
116
|
+
# @param mcp_servers [Array<Anthropic::Models::Beta::BetaManagedAgentsURLMCPServerParams>, nil] MCP servers. Full replacement. Omit to preserve; send empty array or `null` to c
|
|
114
117
|
#
|
|
115
118
|
# @param metadata [Hash{Symbol=>String, nil}, nil] Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omi
|
|
116
119
|
#
|
|
@@ -17,7 +17,9 @@ module Anthropic
|
|
|
17
17
|
# - `5m`: 5 minutes
|
|
18
18
|
# - `1h`: 1 hour
|
|
19
19
|
#
|
|
20
|
-
# Defaults to `5m`.
|
|
20
|
+
# Defaults to `5m`. See
|
|
21
|
+
# [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
|
|
22
|
+
# for details.
|
|
21
23
|
#
|
|
22
24
|
# @return [Symbol, Anthropic::Models::Beta::BetaCacheControlEphemeral::TTL, nil]
|
|
23
25
|
optional :ttl, enum: -> { Anthropic::Beta::BetaCacheControlEphemeral::TTL }
|
|
@@ -37,7 +39,9 @@ module Anthropic
|
|
|
37
39
|
# - `5m`: 5 minutes
|
|
38
40
|
# - `1h`: 1 hour
|
|
39
41
|
#
|
|
40
|
-
# Defaults to `5m`.
|
|
42
|
+
# Defaults to `5m`. See
|
|
43
|
+
# [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
|
|
44
|
+
# for details.
|
|
41
45
|
#
|
|
42
46
|
# @see Anthropic::Models::Beta::BetaCacheControlEphemeral#ttl
|
|
43
47
|
module TTL
|
|
@@ -395,20 +395,20 @@ module Anthropic
|
|
|
395
395
|
# @return [Float, nil]
|
|
396
396
|
optional :top_p, Float
|
|
397
397
|
|
|
398
|
-
# @!attribute user_profile_id
|
|
399
|
-
# The user profile ID to attribute this request to. Use when acting on behalf of a
|
|
400
|
-
# party other than your organization.
|
|
401
|
-
#
|
|
402
|
-
# @return [String, nil]
|
|
403
|
-
optional :user_profile_id, String, nil?: true
|
|
404
|
-
|
|
405
398
|
# @!attribute betas
|
|
406
399
|
# Optional header to specify the beta version(s) you want to use.
|
|
407
400
|
#
|
|
408
401
|
# @return [Array<String, Symbol, Anthropic::Models::AnthropicBeta>, nil]
|
|
409
402
|
optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }
|
|
410
403
|
|
|
411
|
-
# @!
|
|
404
|
+
# @!attribute user_profile_id
|
|
405
|
+
# The user profile ID to attribute this request to. Use when acting on behalf of a
|
|
406
|
+
# party other than your organization. Requires the `user-profiles` beta header.
|
|
407
|
+
#
|
|
408
|
+
# @return [String, nil]
|
|
409
|
+
optional :user_profile_id, String
|
|
410
|
+
|
|
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, betas: nil, user_profile_id: nil, request_options: {})
|
|
412
412
|
# Some parameter documentations has been truncated, see
|
|
413
413
|
# {Anthropic::Models::Beta::MessageCreateParams} for more details.
|
|
414
414
|
#
|
|
@@ -460,10 +460,10 @@ module Anthropic
|
|
|
460
460
|
#
|
|
461
461
|
# @param top_p [Float] Use nucleus sampling.
|
|
462
462
|
#
|
|
463
|
-
# @param user_profile_id [String, nil] The user profile ID to attribute this request to. Use when acting on behalf of a
|
|
464
|
-
#
|
|
465
463
|
# @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Optional header to specify the beta version(s) you want to use.
|
|
466
464
|
#
|
|
465
|
+
# @param user_profile_id [String] The user profile ID to attribute this request to. Use when acting on behalf of a
|
|
466
|
+
#
|
|
467
467
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
|
|
468
468
|
|
|
469
469
|
# Container identifier for reuse across requests.
|
|
@@ -23,7 +23,16 @@ module Anthropic
|
|
|
23
23
|
# @return [Array<String, Symbol, Anthropic::Models::AnthropicBeta>, nil]
|
|
24
24
|
optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }
|
|
25
25
|
|
|
26
|
-
# @!
|
|
26
|
+
# @!attribute user_profile_id
|
|
27
|
+
# The user profile ID to attribute the requests in this batch to. Use when acting
|
|
28
|
+
# on behalf of a party other than your organization. Requires the `user-profiles`
|
|
29
|
+
# beta header. Applies to every request in the batch; an individual request whose
|
|
30
|
+
# `user_profile_id` body field conflicts with this header is errored.
|
|
31
|
+
#
|
|
32
|
+
# @return [String, nil]
|
|
33
|
+
optional :user_profile_id, String
|
|
34
|
+
|
|
35
|
+
# @!method initialize(requests:, betas: nil, user_profile_id: nil, request_options: {})
|
|
27
36
|
# Some parameter documentations has been truncated, see
|
|
28
37
|
# {Anthropic::Models::Beta::Messages::BatchCreateParams} for more details.
|
|
29
38
|
#
|
|
@@ -31,6 +40,8 @@ module Anthropic
|
|
|
31
40
|
#
|
|
32
41
|
# @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Optional header to specify the beta version(s) you want to use.
|
|
33
42
|
#
|
|
43
|
+
# @param user_profile_id [String] The user profile ID to attribute the requests in this batch to. Use when acting
|
|
44
|
+
#
|
|
34
45
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
|
|
35
46
|
|
|
36
47
|
class Request < Anthropic::Internal::Type::BaseModel
|
|
@@ -463,14 +474,7 @@ module Anthropic
|
|
|
463
474
|
# @return [Float, nil]
|
|
464
475
|
optional :top_p, Float
|
|
465
476
|
|
|
466
|
-
# @!
|
|
467
|
-
# The user profile ID to attribute this request to. Use when acting on behalf of a
|
|
468
|
-
# party other than your organization.
|
|
469
|
-
#
|
|
470
|
-
# @return [String, nil]
|
|
471
|
-
optional :user_profile_id, String, nil?: true
|
|
472
|
-
|
|
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)
|
|
477
|
+
# @!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)
|
|
474
478
|
# Some parameter documentations has been truncated, see
|
|
475
479
|
# {Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params} for more
|
|
476
480
|
# details.
|
|
@@ -529,8 +533,6 @@ module Anthropic
|
|
|
529
533
|
# @param top_k [Integer] Only sample from the top K options for each subsequent token.
|
|
530
534
|
#
|
|
531
535
|
# @param top_p [Float] Use nucleus sampling.
|
|
532
|
-
#
|
|
533
|
-
# @param user_profile_id [String, nil] The user profile ID to attribute this request to. Use when acting on behalf of a
|
|
534
536
|
|
|
535
537
|
# Container identifier for reuse across requests.
|
|
536
538
|
#
|
|
@@ -16,7 +16,9 @@ module Anthropic
|
|
|
16
16
|
# - `5m`: 5 minutes
|
|
17
17
|
# - `1h`: 1 hour
|
|
18
18
|
#
|
|
19
|
-
# Defaults to `5m`.
|
|
19
|
+
# Defaults to `5m`. See
|
|
20
|
+
# [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
|
|
21
|
+
# for details.
|
|
20
22
|
#
|
|
21
23
|
# @return [Symbol, Anthropic::Models::CacheControlEphemeral::TTL, nil]
|
|
22
24
|
optional :ttl, enum: -> { Anthropic::CacheControlEphemeral::TTL }
|
|
@@ -36,7 +38,9 @@ module Anthropic
|
|
|
36
38
|
# - `5m`: 5 minutes
|
|
37
39
|
# - `1h`: 1 hour
|
|
38
40
|
#
|
|
39
|
-
# Defaults to `5m`.
|
|
41
|
+
# Defaults to `5m`. See
|
|
42
|
+
# [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
|
|
43
|
+
# for details.
|
|
40
44
|
#
|
|
41
45
|
# @see Anthropic::Models::CacheControlEphemeral#ttl
|
|
42
46
|
module TTL
|
|
@@ -318,7 +318,14 @@ module Anthropic
|
|
|
318
318
|
# @return [Float, nil]
|
|
319
319
|
optional :top_p, Float
|
|
320
320
|
|
|
321
|
-
# @!
|
|
321
|
+
# @!attribute user_profile_id
|
|
322
|
+
# The user profile ID to attribute this request to. Use when acting on behalf of a
|
|
323
|
+
# party other than your organization. Requires the `user-profiles` beta header.
|
|
324
|
+
#
|
|
325
|
+
# @return [String, nil]
|
|
326
|
+
optional :user_profile_id, String
|
|
327
|
+
|
|
328
|
+
# @!method initialize(max_tokens:, messages:, model:, cache_control: nil, container: nil, inference_geo: nil, metadata: nil, output_config: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, user_profile_id: nil, request_options: {})
|
|
322
329
|
# Some parameter documentations has been truncated, see
|
|
323
330
|
# {Anthropic::Models::MessageCreateParams} for more details.
|
|
324
331
|
#
|
|
@@ -356,6 +363,8 @@ module Anthropic
|
|
|
356
363
|
#
|
|
357
364
|
# @param top_p [Float] Use nucleus sampling.
|
|
358
365
|
#
|
|
366
|
+
# @param user_profile_id [String] The user profile ID to attribute this request to. Use when acting on behalf of a
|
|
367
|
+
#
|
|
359
368
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
|
|
360
369
|
|
|
361
370
|
# Determines whether to use priority capacity (if available) or standard capacity
|
|
@@ -16,12 +16,23 @@ module Anthropic
|
|
|
16
16
|
required :requests,
|
|
17
17
|
-> { Anthropic::Internal::Type::ArrayOf[Anthropic::Messages::BatchCreateParams::Request] }
|
|
18
18
|
|
|
19
|
-
# @!
|
|
19
|
+
# @!attribute user_profile_id
|
|
20
|
+
# The user profile ID to attribute the requests in this batch to. Use when acting
|
|
21
|
+
# on behalf of a party other than your organization. Requires the `user-profiles`
|
|
22
|
+
# beta header. Applies to every request in the batch; an individual request whose
|
|
23
|
+
# `user_profile_id` body field conflicts with this header is errored.
|
|
24
|
+
#
|
|
25
|
+
# @return [String, nil]
|
|
26
|
+
optional :user_profile_id, String
|
|
27
|
+
|
|
28
|
+
# @!method initialize(requests:, user_profile_id: nil, request_options: {})
|
|
20
29
|
# Some parameter documentations has been truncated, see
|
|
21
30
|
# {Anthropic::Models::Messages::BatchCreateParams} for more details.
|
|
22
31
|
#
|
|
23
32
|
# @param requests [Array<Anthropic::Models::Messages::BatchCreateParams::Request>] List of requests for prompt completion. Each is an individual request to create
|
|
24
33
|
#
|
|
34
|
+
# @param user_profile_id [String] The user profile ID to attribute the requests in this batch to. Use when acting
|
|
35
|
+
#
|
|
25
36
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
|
|
26
37
|
|
|
27
38
|
class Request < Anthropic::Internal::Type::BaseModel
|
|
@@ -17,12 +17,14 @@ module Anthropic
|
|
|
17
17
|
# Learn more about the Message Batches API in our
|
|
18
18
|
# [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
|
|
19
19
|
#
|
|
20
|
-
# @overload create(requests:, betas: nil, request_options: {})
|
|
20
|
+
# @overload create(requests:, betas: nil, user_profile_id: nil, request_options: {})
|
|
21
21
|
#
|
|
22
22
|
# @param requests [Array<Anthropic::Models::Beta::Messages::BatchCreateParams::Request>] Body param: List of requests for prompt completion. Each is an individual reques
|
|
23
23
|
#
|
|
24
24
|
# @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
|
|
25
25
|
#
|
|
26
|
+
# @param user_profile_id [String] Header param: The user profile ID to attribute the requests in this batch to. Us
|
|
27
|
+
#
|
|
26
28
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
27
29
|
#
|
|
28
30
|
# @return [Anthropic::Models::Beta::Messages::BetaMessageBatch]
|
|
@@ -30,7 +32,7 @@ module Anthropic
|
|
|
30
32
|
# @see Anthropic::Models::Beta::Messages::BatchCreateParams
|
|
31
33
|
def create(params)
|
|
32
34
|
parsed, options = Anthropic::Beta::Messages::BatchCreateParams.dump_request(params)
|
|
33
|
-
header_params = {betas: "anthropic-beta"}
|
|
35
|
+
header_params = {betas: "anthropic-beta", user_profile_id: "anthropic-user-profile-id"}
|
|
34
36
|
@client.request(
|
|
35
37
|
method: :post,
|
|
36
38
|
path: "v1/messages/batches?beta=true",
|
|
@@ -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, 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,
|
|
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, betas: nil, user_profile_id: nil, request_options: {})
|
|
44
44
|
#
|
|
45
45
|
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
|
46
46
|
#
|
|
@@ -90,10 +90,10 @@ module Anthropic
|
|
|
90
90
|
#
|
|
91
91
|
# @param top_p [Float] Body param: Use nucleus sampling.
|
|
92
92
|
#
|
|
93
|
-
# @param user_profile_id [String, nil] Body param: The user profile ID to attribute this request to. Use when acting on
|
|
94
|
-
#
|
|
95
93
|
# @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
|
|
96
94
|
#
|
|
95
|
+
# @param user_profile_id [String] Header param: The user profile ID to attribute this request to. Use when acting
|
|
96
|
+
#
|
|
97
97
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
98
98
|
#
|
|
99
99
|
# @return [Anthropic::Models::Beta::BetaMessage]
|
|
@@ -128,7 +128,7 @@ module Anthropic
|
|
|
128
128
|
options = {timeout: 600, **options}
|
|
129
129
|
end
|
|
130
130
|
|
|
131
|
-
header_params = {betas: "anthropic-beta"}
|
|
131
|
+
header_params = {betas: "anthropic-beta", user_profile_id: "anthropic-user-profile-id"}
|
|
132
132
|
@client.request(
|
|
133
133
|
method: :post,
|
|
134
134
|
path: "v1/messages?beta=true",
|
|
@@ -154,7 +154,7 @@ module Anthropic
|
|
|
154
154
|
# Learn more about the Messages API in our
|
|
155
155
|
# [user guide](https://docs.claude.com/en/docs/initial-setup)
|
|
156
156
|
#
|
|
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,
|
|
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, betas: nil, user_profile_id: nil, request_options: {})
|
|
158
158
|
#
|
|
159
159
|
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
|
160
160
|
#
|
|
@@ -204,10 +204,10 @@ module Anthropic
|
|
|
204
204
|
#
|
|
205
205
|
# @param top_p [Float] Body param: Use nucleus sampling.
|
|
206
206
|
#
|
|
207
|
-
# @param user_profile_id [String, nil] Body param: The user profile ID to attribute this request to. Use when acting on
|
|
208
|
-
#
|
|
209
207
|
# @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
|
|
210
208
|
#
|
|
209
|
+
# @param user_profile_id [String] Header param: The user profile ID to attribute this request to. Use when acting
|
|
210
|
+
#
|
|
211
211
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
212
212
|
#
|
|
213
213
|
# @return [Anthropic::Internal::Stream<Anthropic::Models::Beta::BetaRawMessageStartEvent, Anthropic::Models::Beta::BetaRawMessageDeltaEvent, Anthropic::Models::Beta::BetaRawMessageStopEvent, Anthropic::Models::Beta::BetaRawContentBlockStartEvent, Anthropic::Models::Beta::BetaRawContentBlockDeltaEvent, Anthropic::Models::Beta::BetaRawContentBlockStopEvent>]
|
|
@@ -229,7 +229,7 @@ module Anthropic
|
|
|
229
229
|
is_beta: true
|
|
230
230
|
)
|
|
231
231
|
|
|
232
|
-
header_params = {betas: "anthropic-beta"}
|
|
232
|
+
header_params = {betas: "anthropic-beta", user_profile_id: "anthropic-user-profile-id"}
|
|
233
233
|
raw_stream = @client.request(
|
|
234
234
|
method: :post,
|
|
235
235
|
path: "v1/messages?beta=true",
|
|
@@ -310,7 +310,7 @@ module Anthropic
|
|
|
310
310
|
|
|
311
311
|
Anthropic::Helpers::Messages.distill_input_schema_models!(parsed, strict: nil, is_beta: true)
|
|
312
312
|
|
|
313
|
-
header_params = {betas: "anthropic-beta"}
|
|
313
|
+
header_params = {betas: "anthropic-beta", user_profile_id: "anthropic-user-profile-id"}
|
|
314
314
|
@client.request(
|
|
315
315
|
method: :post,
|
|
316
316
|
path: "v1/messages?beta=true",
|
|
@@ -16,9 +16,11 @@ module Anthropic
|
|
|
16
16
|
# Learn more about the Message Batches API in our
|
|
17
17
|
# [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
|
|
18
18
|
#
|
|
19
|
-
# @overload create(requests:, request_options: {})
|
|
19
|
+
# @overload create(requests:, user_profile_id: nil, request_options: {})
|
|
20
20
|
#
|
|
21
|
-
# @param requests [Array<Anthropic::Models::Messages::BatchCreateParams::Request>] List of requests for prompt completion. Each is an individual
|
|
21
|
+
# @param requests [Array<Anthropic::Models::Messages::BatchCreateParams::Request>] Body param: List of requests for prompt completion. Each is an individual reques
|
|
22
|
+
#
|
|
23
|
+
# @param user_profile_id [String] Header param: The user profile ID to attribute the requests in this batch to. Us
|
|
22
24
|
#
|
|
23
25
|
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
24
26
|
#
|
|
@@ -27,10 +29,12 @@ module Anthropic
|
|
|
27
29
|
# @see Anthropic::Models::Messages::BatchCreateParams
|
|
28
30
|
def create(params)
|
|
29
31
|
parsed, options = Anthropic::Messages::BatchCreateParams.dump_request(params)
|
|
32
|
+
header_params = {user_profile_id: "anthropic-user-profile-id"}
|
|
30
33
|
@client.request(
|
|
31
34
|
method: :post,
|
|
32
35
|
path: "v1/messages/batches",
|
|
33
|
-
|
|
36
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
37
|
+
body: parsed.except(*header_params.keys),
|
|
34
38
|
model: Anthropic::Messages::MessageBatch,
|
|
35
39
|
options: options
|
|
36
40
|
)
|