anthropic 1.16.3 → 1.17.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 (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +38 -10
  4. data/lib/anthropic/helpers/messages.rb +86 -1
  5. data/lib/anthropic/helpers/streaming/message_stream.rb +54 -29
  6. data/lib/anthropic/models/beta/beta_code_execution_tool_20250522.rb +2 -1
  7. data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +2 -1
  8. data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +2 -1
  9. data/lib/anthropic/models/beta/beta_output_config.rb +22 -4
  10. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +25 -25
  11. data/lib/anthropic/models/beta/beta_tool.rb +2 -1
  12. data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +2 -1
  13. data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +2 -1
  14. data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +2 -1
  15. data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +2 -1
  16. data/lib/anthropic/models/beta/beta_tool_computer_use_20251124.rb +2 -1
  17. data/lib/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rb +2 -1
  18. data/lib/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rb +2 -1
  19. data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +2 -1
  20. data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +2 -1
  21. data/lib/anthropic/models/beta/beta_tool_text_editor_20250429.rb +2 -1
  22. data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +2 -1
  23. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +2 -1
  24. data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +2 -1
  25. data/lib/anthropic/models/beta/beta_web_search_tool_result_error_code.rb +1 -0
  26. data/lib/anthropic/models/beta/message_count_tokens_params.rb +10 -5
  27. data/lib/anthropic/models/beta/message_create_params.rb +10 -5
  28. data/lib/anthropic/models/beta/messages/batch_create_params.rb +10 -5
  29. data/lib/anthropic/models/json_output_format.rb +23 -0
  30. data/lib/anthropic/models/message.rb +12 -0
  31. data/lib/anthropic/models/message_count_tokens_params.rb +9 -1
  32. data/lib/anthropic/models/message_create_params.rb +9 -1
  33. data/lib/anthropic/models/messages/batch_create_params.rb +9 -1
  34. data/lib/anthropic/models/model.rb +6 -0
  35. data/lib/anthropic/models/output_config.rb +20 -0
  36. data/lib/anthropic/models/text_block.rb +8 -0
  37. data/lib/anthropic/models/tool.rb +9 -1
  38. data/lib/anthropic/models/tool_bash_20250124.rb +9 -1
  39. data/lib/anthropic/models/tool_text_editor_20250124.rb +9 -1
  40. data/lib/anthropic/models/tool_text_editor_20250429.rb +9 -1
  41. data/lib/anthropic/models/tool_text_editor_20250728.rb +9 -1
  42. data/lib/anthropic/models/web_search_tool_20250305.rb +9 -1
  43. data/lib/anthropic/models/web_search_tool_request_error.rb +1 -0
  44. data/lib/anthropic/models/web_search_tool_result_error.rb +1 -0
  45. data/lib/anthropic/models.rb +4 -0
  46. data/lib/anthropic/resources/beta/messages.rb +26 -14
  47. data/lib/anthropic/resources/messages.rb +15 -4
  48. data/lib/anthropic/version.rb +1 -1
  49. data/lib/anthropic.rb +2 -0
  50. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250522.rbi +2 -0
  51. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +2 -0
  52. data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +2 -0
  53. data/rbi/anthropic/models/beta/beta_output_config.rbi +32 -6
  54. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +48 -36
  55. data/rbi/anthropic/models/beta/beta_tool.rbi +2 -0
  56. data/rbi/anthropic/models/beta/beta_tool_bash_20241022.rbi +2 -0
  57. data/rbi/anthropic/models/beta/beta_tool_bash_20250124.rbi +2 -0
  58. data/rbi/anthropic/models/beta/beta_tool_computer_use_20241022.rbi +2 -0
  59. data/rbi/anthropic/models/beta/beta_tool_computer_use_20250124.rbi +2 -0
  60. data/rbi/anthropic/models/beta/beta_tool_computer_use_20251124.rbi +2 -0
  61. data/rbi/anthropic/models/beta/beta_tool_search_tool_bm25_20251119.rbi +2 -0
  62. data/rbi/anthropic/models/beta/beta_tool_search_tool_regex_20251119.rbi +2 -0
  63. data/rbi/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +2 -0
  64. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +2 -0
  65. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250429.rbi +2 -0
  66. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +2 -0
  67. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +2 -0
  68. data/rbi/anthropic/models/beta/beta_web_search_tool_20250305.rbi +2 -0
  69. data/rbi/anthropic/models/beta/beta_web_search_tool_result_error_code.rbi +5 -0
  70. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +12 -6
  71. data/rbi/anthropic/models/beta/message_create_params.rbi +12 -6
  72. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +12 -6
  73. data/rbi/anthropic/models/json_output_format.rbi +37 -0
  74. data/rbi/anthropic/models/message.rbi +5 -0
  75. data/rbi/anthropic/models/message_count_tokens_params.rbi +11 -0
  76. data/rbi/anthropic/models/message_create_params.rbi +11 -0
  77. data/rbi/anthropic/models/messages/batch_create_params.rbi +11 -0
  78. data/rbi/anthropic/models/output_config.rbi +40 -0
  79. data/rbi/anthropic/models/tool.rbi +11 -0
  80. data/rbi/anthropic/models/tool_bash_20250124.rbi +12 -1
  81. data/rbi/anthropic/models/tool_text_editor_20250124.rbi +12 -1
  82. data/rbi/anthropic/models/tool_text_editor_20250429.rbi +12 -1
  83. data/rbi/anthropic/models/tool_text_editor_20250728.rbi +12 -1
  84. data/rbi/anthropic/models/web_search_tool_20250305.rbi +11 -0
  85. data/rbi/anthropic/models/web_search_tool_request_error.rbi +5 -0
  86. data/rbi/anthropic/models/web_search_tool_result_error.rbi +5 -0
  87. data/rbi/anthropic/models.rbi +4 -0
  88. data/rbi/anthropic/resources/beta/messages.rbi +21 -9
  89. data/rbi/anthropic/resources/messages.rbi +9 -0
  90. data/sig/anthropic/models/beta/beta_output_config.rbs +10 -3
  91. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +21 -17
  92. data/sig/anthropic/models/beta/beta_web_search_tool_result_error_code.rbs +2 -0
  93. data/sig/anthropic/models/json_output_format.rbs +16 -0
  94. data/sig/anthropic/models/message_count_tokens_params.rbs +7 -0
  95. data/sig/anthropic/models/message_create_params.rbs +7 -0
  96. data/sig/anthropic/models/messages/batch_create_params.rbs +9 -0
  97. data/sig/anthropic/models/output_config.rbs +13 -0
  98. data/sig/anthropic/models/tool.rbs +7 -0
  99. data/sig/anthropic/models/tool_bash_20250124.rbs +9 -2
  100. data/sig/anthropic/models/tool_text_editor_20250124.rbs +9 -2
  101. data/sig/anthropic/models/tool_text_editor_20250429.rbs +9 -2
  102. data/sig/anthropic/models/tool_text_editor_20250728.rbs +9 -2
  103. data/sig/anthropic/models/web_search_tool_20250305.rbs +7 -0
  104. data/sig/anthropic/models/web_search_tool_request_error.rbs +2 -0
  105. data/sig/anthropic/models/web_search_tool_result_error.rbs +2 -0
  106. data/sig/anthropic/models.rbs +4 -0
  107. data/sig/anthropic/resources/messages.rbs +3 -0
  108. metadata +22 -2
@@ -471,10 +471,14 @@ module Anthropic
471
471
  mcp_servers: nil,
472
472
  # Body param: An object describing metadata about the request.
473
473
  metadata: nil,
474
- # Body param: Configuration options for the model's output. Controls aspects like
475
- # how much effort the model puts into its response.
474
+ # Body param: Configuration options for the model's output, such as the output
475
+ # format.
476
476
  output_config: nil,
477
- # Body param: A schema to specify Claude's output format in responses.
477
+ # Body param: Deprecated: Use `output_config.format` instead. See
478
+ # [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
479
+ #
480
+ # A schema to specify Claude's output format in responses. This parameter will be
481
+ # removed in a future release.
478
482
  output_format: nil,
479
483
  # Body param: Determines whether to use priority capacity (if available) or
480
484
  # standard capacity for this request.
@@ -793,10 +797,14 @@ module Anthropic
793
797
  mcp_servers: nil,
794
798
  # Body param: An object describing metadata about the request.
795
799
  metadata: nil,
796
- # Body param: Configuration options for the model's output. Controls aspects like
797
- # how much effort the model puts into its response.
800
+ # Body param: Configuration options for the model's output, such as the output
801
+ # format.
798
802
  output_config: nil,
799
- # Body param: A schema to specify Claude's output format in responses.
803
+ # Body param: Deprecated: Use `output_config.format` instead. See
804
+ # [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
805
+ #
806
+ # A schema to specify Claude's output format in responses. This parameter will be
807
+ # removed in a future release.
800
808
  output_format: nil,
801
809
  # Body param: Determines whether to use priority capacity (if available) or
802
810
  # standard capacity for this request.
@@ -1084,10 +1092,14 @@ module Anthropic
1084
1092
  context_management: nil,
1085
1093
  # Body param: MCP servers to be utilized in this request
1086
1094
  mcp_servers: nil,
1087
- # Body param: Configuration options for the model's output. Controls aspects like
1088
- # how much effort the model puts into its response.
1095
+ # Body param: Configuration options for the model's output, such as the output
1096
+ # format.
1089
1097
  output_config: nil,
1090
- # Body param: A schema to specify Claude's output format in responses.
1098
+ # Body param: Deprecated: Use `output_config.format` instead. See
1099
+ # [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
1100
+ #
1101
+ # A schema to specify Claude's output format in responses. This parameter will be
1102
+ # removed in a future release.
1091
1103
  output_format: nil,
1092
1104
  # Body param: System prompt.
1093
1105
  #
@@ -22,6 +22,7 @@ module Anthropic
22
22
  messages: T::Array[Anthropic::MessageParam::OrHash],
23
23
  model: T.any(Anthropic::Model::OrSymbol, String),
24
24
  metadata: Anthropic::Metadata::OrHash,
25
+ output_config: Anthropic::OutputConfig::OrHash,
25
26
  service_tier: Anthropic::MessageCreateParams::ServiceTier::OrSymbol,
26
27
  stop_sequences: T::Array[String],
27
28
  system_: Anthropic::MessageCreateParams::System::Variants,
@@ -136,6 +137,8 @@ module Anthropic
136
137
  model:,
137
138
  # An object describing metadata about the request.
138
139
  metadata: nil,
140
+ # Configuration options for the model's output, such as the output format.
141
+ output_config: nil,
139
142
  # Determines whether to use priority capacity (if available) or standard capacity
140
143
  # for this request.
141
144
  #
@@ -588,6 +591,7 @@ module Anthropic
588
591
  messages: T::Array[Anthropic::MessageParam::OrHash],
589
592
  model: T.any(Anthropic::Model::OrSymbol, String),
590
593
  metadata: Anthropic::Metadata::OrHash,
594
+ output_config: Anthropic::OutputConfig::OrHash,
591
595
  service_tier: Anthropic::MessageCreateParams::ServiceTier::OrSymbol,
592
596
  stop_sequences: T::Array[String],
593
597
  system_: Anthropic::MessageCreateParams::System::Variants,
@@ -706,6 +710,8 @@ module Anthropic
706
710
  model:,
707
711
  # An object describing metadata about the request.
708
712
  metadata: nil,
713
+ # Configuration options for the model's output, such as the output format.
714
+ output_config: nil,
709
715
  # Determines whether to use priority capacity (if available) or standard capacity
710
716
  # for this request.
711
717
  #
@@ -862,6 +868,7 @@ module Anthropic
862
868
  params(
863
869
  messages: T::Array[Anthropic::MessageParam::OrHash],
864
870
  model: T.any(Anthropic::Model::OrSymbol, String),
871
+ output_config: Anthropic::OutputConfig::OrHash,
865
872
  system_: Anthropic::MessageCountTokensParams::System::Variants,
866
873
  thinking:
867
874
  T.any(
@@ -960,6 +967,8 @@ module Anthropic
960
967
  # [models](https://docs.anthropic.com/en/docs/models-overview) for additional
961
968
  # details and options.
962
969
  model:,
970
+ # Configuration options for the model's output, such as the output format.
971
+ output_config: nil,
963
972
  # System prompt.
964
973
  #
965
974
  # A system prompt is a way of providing context and instructions to Claude, such
@@ -4,17 +4,24 @@ module Anthropic
4
4
 
5
5
  module Beta
6
6
  type beta_output_config =
7
- { effort: Anthropic::Models::Beta::BetaOutputConfig::effort? }
7
+ {
8
+ effort: Anthropic::Models::Beta::BetaOutputConfig::effort?,
9
+ format_: Anthropic::Beta::BetaJSONOutputFormat?
10
+ }
8
11
 
9
12
  class BetaOutputConfig < Anthropic::Internal::Type::BaseModel
10
13
  attr_accessor effort: Anthropic::Models::Beta::BetaOutputConfig::effort?
11
14
 
15
+ attr_accessor format_: Anthropic::Beta::BetaJSONOutputFormat?
16
+
12
17
  def initialize: (
13
- ?effort: Anthropic::Models::Beta::BetaOutputConfig::effort?
18
+ ?effort: Anthropic::Models::Beta::BetaOutputConfig::effort?,
19
+ ?format_: Anthropic::Beta::BetaJSONOutputFormat?
14
20
  ) -> void
15
21
 
16
22
  def to_hash: -> {
17
- effort: Anthropic::Models::Beta::BetaOutputConfig::effort?
23
+ effort: Anthropic::Models::Beta::BetaOutputConfig::effort?,
24
+ format_: Anthropic::Beta::BetaJSONOutputFormat?
18
25
  }
19
26
 
20
27
  type effort = :low | :medium | :high
@@ -6,49 +6,43 @@ module Anthropic
6
6
  type beta_server_tool_use_block =
7
7
  {
8
8
  id: String,
9
- caller_: Anthropic::Models::Beta::BetaServerToolUseBlock::caller_,
10
9
  input: ::Hash[Symbol, top],
11
10
  name: Anthropic::Models::Beta::BetaServerToolUseBlock::name_,
12
- type: :server_tool_use
11
+ type: :server_tool_use,
12
+ caller_: Anthropic::Models::Beta::BetaServerToolUseBlock::caller_
13
13
  }
14
14
 
15
15
  class BetaServerToolUseBlock < Anthropic::Internal::Type::BaseModel
16
16
  attr_accessor id: String
17
17
 
18
- attr_accessor caller_: Anthropic::Models::Beta::BetaServerToolUseBlock::caller_
19
-
20
18
  attr_accessor input: ::Hash[Symbol, top]
21
19
 
22
20
  attr_accessor name: Anthropic::Models::Beta::BetaServerToolUseBlock::name_
23
21
 
24
22
  attr_accessor type: :server_tool_use
25
23
 
24
+ attr_reader caller_: Anthropic::Models::Beta::BetaServerToolUseBlock::caller_?
25
+
26
+ def caller_=: (
27
+ Anthropic::Models::Beta::BetaServerToolUseBlock::caller_
28
+ ) -> Anthropic::Models::Beta::BetaServerToolUseBlock::caller_
29
+
26
30
  def initialize: (
27
31
  id: String,
28
- caller_: Anthropic::Models::Beta::BetaServerToolUseBlock::caller_,
29
32
  input: ::Hash[Symbol, top],
30
33
  name: Anthropic::Models::Beta::BetaServerToolUseBlock::name_,
34
+ ?caller_: Anthropic::Models::Beta::BetaServerToolUseBlock::caller_,
31
35
  ?type: :server_tool_use
32
36
  ) -> void
33
37
 
34
38
  def to_hash: -> {
35
39
  id: String,
36
- caller_: Anthropic::Models::Beta::BetaServerToolUseBlock::caller_,
37
40
  input: ::Hash[Symbol, top],
38
41
  name: Anthropic::Models::Beta::BetaServerToolUseBlock::name_,
39
- type: :server_tool_use
42
+ type: :server_tool_use,
43
+ caller_: Anthropic::Models::Beta::BetaServerToolUseBlock::caller_
40
44
  }
41
45
 
42
- type caller_ =
43
- Anthropic::Beta::BetaDirectCaller
44
- | Anthropic::Beta::BetaServerToolCaller
45
-
46
- module Caller
47
- extend Anthropic::Internal::Type::Union
48
-
49
- def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaServerToolUseBlock::caller_]
50
- end
51
-
52
46
  type name_ =
53
47
  :web_search
54
48
  | :web_fetch
@@ -71,6 +65,16 @@ module Anthropic
71
65
 
72
66
  def self?.values: -> ::Array[Anthropic::Models::Beta::BetaServerToolUseBlock::name_]
73
67
  end
68
+
69
+ type caller_ =
70
+ Anthropic::Beta::BetaDirectCaller
71
+ | Anthropic::Beta::BetaServerToolCaller
72
+
73
+ module Caller
74
+ extend Anthropic::Internal::Type::Union
75
+
76
+ def self?.variants: -> ::Array[Anthropic::Models::Beta::BetaServerToolUseBlock::caller_]
77
+ end
74
78
  end
75
79
  end
76
80
  end
@@ -9,6 +9,7 @@ module Anthropic
9
9
  | :max_uses_exceeded
10
10
  | :too_many_requests
11
11
  | :query_too_long
12
+ | :request_too_large
12
13
 
13
14
  module BetaWebSearchToolResultErrorCode
14
15
  extend Anthropic::Internal::Type::Enum
@@ -18,6 +19,7 @@ module Anthropic
18
19
  MAX_USES_EXCEEDED: :max_uses_exceeded
19
20
  TOO_MANY_REQUESTS: :too_many_requests
20
21
  QUERY_TOO_LONG: :query_too_long
22
+ REQUEST_TOO_LARGE: :request_too_large
21
23
 
22
24
  def self?.values: -> ::Array[Anthropic::Models::Beta::beta_web_search_tool_result_error_code]
23
25
  end
@@ -0,0 +1,16 @@
1
+ module Anthropic
2
+ module Models
3
+ type json_output_format =
4
+ { schema: ::Hash[Symbol, top], type: :json_schema }
5
+
6
+ class JSONOutputFormat < Anthropic::Internal::Type::BaseModel
7
+ attr_accessor schema: ::Hash[Symbol, top]
8
+
9
+ attr_accessor type: :json_schema
10
+
11
+ def initialize: (schema: ::Hash[Symbol, top], ?type: :json_schema) -> void
12
+
13
+ def to_hash: -> { schema: ::Hash[Symbol, top], type: :json_schema }
14
+ end
15
+ end
16
+ end
@@ -4,6 +4,7 @@ module Anthropic
4
4
  {
5
5
  messages: ::Array[Anthropic::MessageParam],
6
6
  model: Anthropic::Models::model,
7
+ output_config: Anthropic::OutputConfig,
7
8
  system_: Anthropic::Models::MessageCountTokensParams::system_,
8
9
  thinking: Anthropic::Models::thinking_config_param,
9
10
  tool_choice: Anthropic::Models::tool_choice,
@@ -19,6 +20,10 @@ module Anthropic
19
20
 
20
21
  attr_accessor model: Anthropic::Models::model
21
22
 
23
+ attr_reader output_config: Anthropic::OutputConfig?
24
+
25
+ def output_config=: (Anthropic::OutputConfig) -> Anthropic::OutputConfig
26
+
22
27
  attr_reader system_: Anthropic::Models::MessageCountTokensParams::system_?
23
28
 
24
29
  def system_=: (
@@ -46,6 +51,7 @@ module Anthropic
46
51
  def initialize: (
47
52
  messages: ::Array[Anthropic::MessageParam],
48
53
  model: Anthropic::Models::model,
54
+ ?output_config: Anthropic::OutputConfig,
49
55
  ?system_: Anthropic::Models::MessageCountTokensParams::system_,
50
56
  ?thinking: Anthropic::Models::thinking_config_param,
51
57
  ?tool_choice: Anthropic::Models::tool_choice,
@@ -56,6 +62,7 @@ module Anthropic
56
62
  def to_hash: -> {
57
63
  messages: ::Array[Anthropic::MessageParam],
58
64
  model: Anthropic::Models::model,
65
+ output_config: Anthropic::OutputConfig,
59
66
  system_: Anthropic::Models::MessageCountTokensParams::system_,
60
67
  thinking: Anthropic::Models::thinking_config_param,
61
68
  tool_choice: Anthropic::Models::tool_choice,
@@ -6,6 +6,7 @@ module Anthropic
6
6
  messages: ::Array[Anthropic::MessageParam],
7
7
  model: Anthropic::Models::model,
8
8
  metadata: Anthropic::Metadata,
9
+ output_config: Anthropic::OutputConfig,
9
10
  service_tier: Anthropic::Models::MessageCreateParams::service_tier,
10
11
  stop_sequences: ::Array[String],
11
12
  system_: Anthropic::Models::MessageCreateParams::system_,
@@ -32,6 +33,10 @@ module Anthropic
32
33
 
33
34
  def metadata=: (Anthropic::Metadata) -> Anthropic::Metadata
34
35
 
36
+ attr_reader output_config: Anthropic::OutputConfig?
37
+
38
+ def output_config=: (Anthropic::OutputConfig) -> Anthropic::OutputConfig
39
+
35
40
  attr_reader service_tier: Anthropic::Models::MessageCreateParams::service_tier?
36
41
 
37
42
  def service_tier=: (
@@ -83,6 +88,7 @@ module Anthropic
83
88
  messages: ::Array[Anthropic::MessageParam],
84
89
  model: Anthropic::Models::model,
85
90
  ?metadata: Anthropic::Metadata,
91
+ ?output_config: Anthropic::OutputConfig,
86
92
  ?service_tier: Anthropic::Models::MessageCreateParams::service_tier,
87
93
  ?stop_sequences: ::Array[String],
88
94
  ?system_: Anthropic::Models::MessageCreateParams::system_,
@@ -100,6 +106,7 @@ module Anthropic
100
106
  messages: ::Array[Anthropic::MessageParam],
101
107
  model: Anthropic::Models::model,
102
108
  metadata: Anthropic::Metadata,
109
+ output_config: Anthropic::OutputConfig,
103
110
  service_tier: Anthropic::Models::MessageCreateParams::service_tier,
104
111
  stop_sequences: ::Array[String],
105
112
  system_: Anthropic::Models::MessageCreateParams::system_,
@@ -48,6 +48,7 @@ module Anthropic
48
48
  messages: ::Array[Anthropic::MessageParam],
49
49
  model: Anthropic::Models::model,
50
50
  metadata: Anthropic::Metadata,
51
+ output_config: Anthropic::OutputConfig,
51
52
  service_tier: Anthropic::Models::Messages::BatchCreateParams::Request::Params::service_tier,
52
53
  stop_sequences: ::Array[String],
53
54
  stream: bool,
@@ -71,6 +72,12 @@ module Anthropic
71
72
 
72
73
  def metadata=: (Anthropic::Metadata) -> Anthropic::Metadata
73
74
 
75
+ attr_reader output_config: Anthropic::OutputConfig?
76
+
77
+ def output_config=: (
78
+ Anthropic::OutputConfig
79
+ ) -> Anthropic::OutputConfig
80
+
74
81
  attr_reader service_tier: Anthropic::Models::Messages::BatchCreateParams::Request::Params::service_tier?
75
82
 
76
83
  def service_tier=: (
@@ -126,6 +133,7 @@ module Anthropic
126
133
  messages: ::Array[Anthropic::MessageParam],
127
134
  model: Anthropic::Models::model,
128
135
  ?metadata: Anthropic::Metadata,
136
+ ?output_config: Anthropic::OutputConfig,
129
137
  ?service_tier: Anthropic::Models::Messages::BatchCreateParams::Request::Params::service_tier,
130
138
  ?stop_sequences: ::Array[String],
131
139
  ?stream: bool,
@@ -143,6 +151,7 @@ module Anthropic
143
151
  messages: ::Array[Anthropic::MessageParam],
144
152
  model: Anthropic::Models::model,
145
153
  metadata: Anthropic::Metadata,
154
+ output_config: Anthropic::OutputConfig,
146
155
  service_tier: Anthropic::Models::Messages::BatchCreateParams::Request::Params::service_tier,
147
156
  stop_sequences: ::Array[String],
148
157
  stream: bool,
@@ -0,0 +1,13 @@
1
+ module Anthropic
2
+ module Models
3
+ type output_config = { format_: Anthropic::JSONOutputFormat? }
4
+
5
+ class OutputConfig < Anthropic::Internal::Type::BaseModel
6
+ attr_accessor format_: Anthropic::JSONOutputFormat?
7
+
8
+ def initialize: (?format_: Anthropic::JSONOutputFormat?) -> void
9
+
10
+ def to_hash: -> { format_: Anthropic::JSONOutputFormat? }
11
+ end
12
+ end
13
+ end
@@ -6,6 +6,7 @@ module Anthropic
6
6
  name: String,
7
7
  cache_control: Anthropic::CacheControlEphemeral?,
8
8
  description: String,
9
+ strict: bool,
9
10
  type: Anthropic::Models::Tool::type_?
10
11
  }
11
12
 
@@ -20,6 +21,10 @@ module Anthropic
20
21
 
21
22
  def description=: (String) -> String
22
23
 
24
+ attr_reader strict: bool?
25
+
26
+ def strict=: (bool) -> bool
27
+
23
28
  attr_accessor type: Anthropic::Models::Tool::type_?
24
29
 
25
30
  def initialize: (
@@ -27,6 +32,7 @@ module Anthropic
27
32
  name: String,
28
33
  ?cache_control: Anthropic::CacheControlEphemeral?,
29
34
  ?description: String,
35
+ ?strict: bool,
30
36
  ?type: Anthropic::Models::Tool::type_?
31
37
  ) -> void
32
38
 
@@ -35,6 +41,7 @@ module Anthropic
35
41
  name: String,
36
42
  cache_control: Anthropic::CacheControlEphemeral?,
37
43
  description: String,
44
+ strict: bool,
38
45
  type: Anthropic::Models::Tool::type_?
39
46
  }
40
47
 
@@ -4,7 +4,8 @@ module Anthropic
4
4
  {
5
5
  name: :bash,
6
6
  type: :bash_20250124,
7
- cache_control: Anthropic::CacheControlEphemeral?
7
+ cache_control: Anthropic::CacheControlEphemeral?,
8
+ strict: bool
8
9
  }
9
10
 
10
11
  class ToolBash20250124 < Anthropic::Internal::Type::BaseModel
@@ -14,8 +15,13 @@ module Anthropic
14
15
 
15
16
  attr_accessor cache_control: Anthropic::CacheControlEphemeral?
16
17
 
18
+ attr_reader strict: bool?
19
+
20
+ def strict=: (bool) -> bool
21
+
17
22
  def initialize: (
18
23
  ?cache_control: Anthropic::CacheControlEphemeral?,
24
+ ?strict: bool,
19
25
  ?name: :bash,
20
26
  ?type: :bash_20250124
21
27
  ) -> void
@@ -23,7 +29,8 @@ module Anthropic
23
29
  def to_hash: -> {
24
30
  name: :bash,
25
31
  type: :bash_20250124,
26
- cache_control: Anthropic::CacheControlEphemeral?
32
+ cache_control: Anthropic::CacheControlEphemeral?,
33
+ strict: bool
27
34
  }
28
35
  end
29
36
  end
@@ -4,7 +4,8 @@ module Anthropic
4
4
  {
5
5
  name: :str_replace_editor,
6
6
  type: :text_editor_20250124,
7
- cache_control: Anthropic::CacheControlEphemeral?
7
+ cache_control: Anthropic::CacheControlEphemeral?,
8
+ strict: bool
8
9
  }
9
10
 
10
11
  class ToolTextEditor20250124 < Anthropic::Internal::Type::BaseModel
@@ -14,8 +15,13 @@ module Anthropic
14
15
 
15
16
  attr_accessor cache_control: Anthropic::CacheControlEphemeral?
16
17
 
18
+ attr_reader strict: bool?
19
+
20
+ def strict=: (bool) -> bool
21
+
17
22
  def initialize: (
18
23
  ?cache_control: Anthropic::CacheControlEphemeral?,
24
+ ?strict: bool,
19
25
  ?name: :str_replace_editor,
20
26
  ?type: :text_editor_20250124
21
27
  ) -> void
@@ -23,7 +29,8 @@ module Anthropic
23
29
  def to_hash: -> {
24
30
  name: :str_replace_editor,
25
31
  type: :text_editor_20250124,
26
- cache_control: Anthropic::CacheControlEphemeral?
32
+ cache_control: Anthropic::CacheControlEphemeral?,
33
+ strict: bool
27
34
  }
28
35
  end
29
36
  end
@@ -4,7 +4,8 @@ module Anthropic
4
4
  {
5
5
  name: :str_replace_based_edit_tool,
6
6
  type: :text_editor_20250429,
7
- cache_control: Anthropic::CacheControlEphemeral?
7
+ cache_control: Anthropic::CacheControlEphemeral?,
8
+ strict: bool
8
9
  }
9
10
 
10
11
  class ToolTextEditor20250429 < Anthropic::Internal::Type::BaseModel
@@ -14,8 +15,13 @@ module Anthropic
14
15
 
15
16
  attr_accessor cache_control: Anthropic::CacheControlEphemeral?
16
17
 
18
+ attr_reader strict: bool?
19
+
20
+ def strict=: (bool) -> bool
21
+
17
22
  def initialize: (
18
23
  ?cache_control: Anthropic::CacheControlEphemeral?,
24
+ ?strict: bool,
19
25
  ?name: :str_replace_based_edit_tool,
20
26
  ?type: :text_editor_20250429
21
27
  ) -> void
@@ -23,7 +29,8 @@ module Anthropic
23
29
  def to_hash: -> {
24
30
  name: :str_replace_based_edit_tool,
25
31
  type: :text_editor_20250429,
26
- cache_control: Anthropic::CacheControlEphemeral?
32
+ cache_control: Anthropic::CacheControlEphemeral?,
33
+ strict: bool
27
34
  }
28
35
  end
29
36
  end
@@ -5,7 +5,8 @@ module Anthropic
5
5
  name: :str_replace_based_edit_tool,
6
6
  type: :text_editor_20250728,
7
7
  cache_control: Anthropic::CacheControlEphemeral?,
8
- max_characters: Integer?
8
+ max_characters: Integer?,
9
+ strict: bool
9
10
  }
10
11
 
11
12
  class ToolTextEditor20250728 < Anthropic::Internal::Type::BaseModel
@@ -17,9 +18,14 @@ module Anthropic
17
18
 
18
19
  attr_accessor max_characters: Integer?
19
20
 
21
+ attr_reader strict: bool?
22
+
23
+ def strict=: (bool) -> bool
24
+
20
25
  def initialize: (
21
26
  ?cache_control: Anthropic::CacheControlEphemeral?,
22
27
  ?max_characters: Integer?,
28
+ ?strict: bool,
23
29
  ?name: :str_replace_based_edit_tool,
24
30
  ?type: :text_editor_20250728
25
31
  ) -> void
@@ -28,7 +34,8 @@ module Anthropic
28
34
  name: :str_replace_based_edit_tool,
29
35
  type: :text_editor_20250728,
30
36
  cache_control: Anthropic::CacheControlEphemeral?,
31
- max_characters: Integer?
37
+ max_characters: Integer?,
38
+ strict: bool
32
39
  }
33
40
  end
34
41
  end
@@ -8,6 +8,7 @@ module Anthropic
8
8
  blocked_domains: ::Array[String]?,
9
9
  cache_control: Anthropic::CacheControlEphemeral?,
10
10
  max_uses: Integer?,
11
+ strict: bool,
11
12
  user_location: Anthropic::WebSearchTool20250305::UserLocation?
12
13
  }
13
14
 
@@ -24,6 +25,10 @@ module Anthropic
24
25
 
25
26
  attr_accessor max_uses: Integer?
26
27
 
28
+ attr_reader strict: bool?
29
+
30
+ def strict=: (bool) -> bool
31
+
27
32
  attr_accessor user_location: Anthropic::WebSearchTool20250305::UserLocation?
28
33
 
29
34
  def initialize: (
@@ -31,6 +36,7 @@ module Anthropic
31
36
  ?blocked_domains: ::Array[String]?,
32
37
  ?cache_control: Anthropic::CacheControlEphemeral?,
33
38
  ?max_uses: Integer?,
39
+ ?strict: bool,
34
40
  ?user_location: Anthropic::WebSearchTool20250305::UserLocation?,
35
41
  ?name: :web_search,
36
42
  ?type: :web_search_20250305
@@ -43,6 +49,7 @@ module Anthropic
43
49
  blocked_domains: ::Array[String]?,
44
50
  cache_control: Anthropic::CacheControlEphemeral?,
45
51
  max_uses: Integer?,
52
+ strict: bool,
46
53
  user_location: Anthropic::WebSearchTool20250305::UserLocation?
47
54
  }
48
55
 
@@ -27,6 +27,7 @@ module Anthropic
27
27
  | :max_uses_exceeded
28
28
  | :too_many_requests
29
29
  | :query_too_long
30
+ | :request_too_large
30
31
 
31
32
  module ErrorCode
32
33
  extend Anthropic::Internal::Type::Enum
@@ -36,6 +37,7 @@ module Anthropic
36
37
  MAX_USES_EXCEEDED: :max_uses_exceeded
37
38
  TOO_MANY_REQUESTS: :too_many_requests
38
39
  QUERY_TOO_LONG: :query_too_long
40
+ REQUEST_TOO_LARGE: :request_too_large
39
41
 
40
42
  def self?.values: -> ::Array[Anthropic::Models::WebSearchToolRequestError::error_code]
41
43
  end
@@ -27,6 +27,7 @@ module Anthropic
27
27
  | :max_uses_exceeded
28
28
  | :too_many_requests
29
29
  | :query_too_long
30
+ | :request_too_large
30
31
 
31
32
  module ErrorCode
32
33
  extend Anthropic::Internal::Type::Enum
@@ -36,6 +37,7 @@ module Anthropic
36
37
  MAX_USES_EXCEEDED: :max_uses_exceeded
37
38
  TOO_MANY_REQUESTS: :too_many_requests
38
39
  QUERY_TOO_LONG: :query_too_long
40
+ REQUEST_TOO_LARGE: :request_too_large
39
41
 
40
42
  def self?.values: -> ::Array[Anthropic::Models::WebSearchToolResultError::error_code]
41
43
  end
@@ -89,6 +89,8 @@ module Anthropic
89
89
 
90
90
  class InvalidRequestError = Anthropic::Models::InvalidRequestError
91
91
 
92
+ class JSONOutputFormat = Anthropic::Models::JSONOutputFormat
93
+
92
94
  class Message = Anthropic::Models::Message
93
95
 
94
96
  class MessageCountTokensParams = Anthropic::Models::MessageCountTokensParams
@@ -117,6 +119,8 @@ module Anthropic
117
119
 
118
120
  class NotFoundError = Anthropic::Models::NotFoundError
119
121
 
122
+ class OutputConfig = Anthropic::Models::OutputConfig
123
+
120
124
  class OverloadedError = Anthropic::Models::OverloadedError
121
125
 
122
126
  class PermissionError = Anthropic::Models::PermissionError
@@ -8,6 +8,7 @@ module Anthropic
8
8
  messages: ::Array[Anthropic::MessageParam],
9
9
  model: Anthropic::Models::model,
10
10
  ?metadata: Anthropic::Metadata,
11
+ ?output_config: Anthropic::OutputConfig,
11
12
  ?service_tier: Anthropic::Models::MessageCreateParams::service_tier,
12
13
  ?stop_sequences: ::Array[String],
13
14
  ?system_: Anthropic::Models::MessageCreateParams::system_,
@@ -25,6 +26,7 @@ module Anthropic
25
26
  messages: ::Array[Anthropic::MessageParam],
26
27
  model: Anthropic::Models::model,
27
28
  ?metadata: Anthropic::Metadata,
29
+ ?output_config: Anthropic::OutputConfig,
28
30
  ?service_tier: Anthropic::Models::MessageCreateParams::service_tier,
29
31
  ?stop_sequences: ::Array[String],
30
32
  ?system_: Anthropic::Models::MessageCreateParams::system_,
@@ -40,6 +42,7 @@ module Anthropic
40
42
  def count_tokens: (
41
43
  messages: ::Array[Anthropic::MessageParam],
42
44
  model: Anthropic::Models::model,
45
+ ?output_config: Anthropic::OutputConfig,
43
46
  ?system_: Anthropic::Models::MessageCountTokensParams::system_,
44
47
  ?thinking: Anthropic::Models::thinking_config_param,
45
48
  ?tool_choice: Anthropic::Models::tool_choice,