anthropic 1.13.0 → 1.15.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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/README.md +31 -1
  4. data/lib/anthropic/helpers/input_schema/base_model.rb +6 -3
  5. data/lib/anthropic/helpers/input_schema/json_schema_converter.rb +9 -3
  6. data/lib/anthropic/helpers/input_schema/supported_schemas.rb +106 -0
  7. data/lib/anthropic/helpers/input_schema/union_of.rb +3 -1
  8. data/lib/anthropic/helpers/messages.rb +107 -0
  9. data/lib/anthropic/helpers/streaming/message_stream.rb +54 -43
  10. data/lib/anthropic/helpers/tools/base_tool.rb +82 -0
  11. data/lib/anthropic/helpers/tools/runner.rb +156 -0
  12. data/lib/anthropic/helpers/tools.rb +5 -0
  13. data/lib/anthropic/internal/transport/base_client.rb +7 -1
  14. data/lib/anthropic/internal/transport/pooled_net_requester.rb +6 -2
  15. data/lib/anthropic/models/beta/beta_code_execution_tool_20250522.rb +8 -1
  16. data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +8 -1
  17. data/lib/anthropic/models/beta/beta_json_output_format.rb +27 -0
  18. data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +8 -1
  19. data/lib/anthropic/models/beta/beta_tool.rb +8 -1
  20. data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +8 -1
  21. data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +8 -1
  22. data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +8 -1
  23. data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +8 -1
  24. data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +8 -1
  25. data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +8 -1
  26. data/lib/anthropic/models/beta/beta_tool_text_editor_20250429.rb +8 -1
  27. data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +8 -1
  28. data/lib/anthropic/models/beta/beta_tool_use_block.rb +14 -0
  29. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +8 -1
  30. data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +8 -1
  31. data/lib/anthropic/models/beta/message_count_tokens_params.rb +9 -1
  32. data/lib/anthropic/models/beta/message_create_params.rb +9 -1
  33. data/lib/anthropic/models/beta/messages/batch_create_params.rb +9 -1
  34. data/lib/anthropic/models/tool_use_block.rb +6 -6
  35. data/lib/anthropic/resources/beta/messages/batches.rb +6 -6
  36. data/lib/anthropic/resources/beta/messages.rb +37 -11
  37. data/lib/anthropic/resources/messages/batches.rb +6 -6
  38. data/lib/anthropic/resources/messages.rb +12 -84
  39. data/lib/anthropic/version.rb +1 -1
  40. data/lib/anthropic.rb +16 -10
  41. data/manifest.yaml +1 -0
  42. data/rbi/anthropic/helpers/input_schema/base_model.rbi +7 -2
  43. data/rbi/anthropic/helpers/tools/base_tool.rbi +51 -0
  44. data/rbi/anthropic/helpers/tools/runner.rbi +40 -0
  45. data/rbi/anthropic/helpers/tools.rbi +5 -0
  46. data/rbi/anthropic/internal/transport/base_client.rbi +5 -0
  47. data/rbi/anthropic/internal/transport/pooled_net_requester.rbi +6 -2
  48. data/rbi/anthropic/internal/type/base_model.rbi +8 -4
  49. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250522.rbi +10 -1
  50. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +10 -1
  51. data/rbi/anthropic/models/beta/beta_json_output_format.rbi +46 -0
  52. data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +10 -1
  53. data/rbi/anthropic/models/beta/beta_tool.rbi +9 -0
  54. data/rbi/anthropic/models/beta/beta_tool_bash_20241022.rbi +10 -1
  55. data/rbi/anthropic/models/beta/beta_tool_bash_20250124.rbi +10 -1
  56. data/rbi/anthropic/models/beta/beta_tool_computer_use_20241022.rbi +10 -1
  57. data/rbi/anthropic/models/beta/beta_tool_computer_use_20250124.rbi +10 -1
  58. data/rbi/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +10 -1
  59. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +10 -1
  60. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250429.rbi +10 -1
  61. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +10 -1
  62. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +10 -1
  63. data/rbi/anthropic/models/beta/beta_web_search_tool_20250305.rbi +9 -0
  64. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +17 -0
  65. data/rbi/anthropic/models/beta/message_create_params.rbi +17 -0
  66. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +18 -0
  67. data/rbi/anthropic/models/tool_use_block.rbi +3 -0
  68. data/rbi/anthropic/resources/beta/messages/batches.rbi +6 -6
  69. data/rbi/anthropic/resources/beta/messages.rbi +313 -3
  70. data/rbi/anthropic/resources/messages/batches.rbi +6 -6
  71. data/rbi/anthropic/resources/messages.rbi +5 -3
  72. data/sig/anthropic/internal/transport/base_client.rbs +2 -0
  73. data/sig/anthropic/internal/transport/pooled_net_requester.rbs +4 -1
  74. data/sig/anthropic/models/beta/beta_code_execution_tool_20250522.rbs +9 -2
  75. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +9 -2
  76. data/sig/anthropic/models/beta/beta_json_output_format.rbs +23 -0
  77. data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +9 -2
  78. data/sig/anthropic/models/beta/beta_tool.rbs +7 -0
  79. data/sig/anthropic/models/beta/beta_tool_bash_20241022.rbs +9 -2
  80. data/sig/anthropic/models/beta/beta_tool_bash_20250124.rbs +9 -2
  81. data/sig/anthropic/models/beta/beta_tool_computer_use_20241022.rbs +9 -2
  82. data/sig/anthropic/models/beta/beta_tool_computer_use_20250124.rbs +9 -2
  83. data/sig/anthropic/models/beta/beta_tool_text_editor_20241022.rbs +9 -2
  84. data/sig/anthropic/models/beta/beta_tool_text_editor_20250124.rbs +9 -2
  85. data/sig/anthropic/models/beta/beta_tool_text_editor_20250429.rbs +9 -2
  86. data/sig/anthropic/models/beta/beta_tool_text_editor_20250728.rbs +9 -2
  87. data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +9 -2
  88. data/sig/anthropic/models/beta/beta_web_search_tool_20250305.rbs +7 -0
  89. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +5 -0
  90. data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
  91. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +5 -0
  92. data/sig/anthropic/resources/beta/messages.rbs +3 -0
  93. metadata +14 -4
  94. data/lib/anthropic/helpers/input_schema/property_mapping.rb +0 -47
  95. /data/rbi/anthropic/helpers/{structured_output.rbi → input_schema.rbi} +0 -0
@@ -31,7 +31,7 @@ module Anthropic
31
31
  #
32
32
  # Assumes superclass fields are totally defined before fields are accessed /
33
33
  # defined on subclasses.
34
- sig { params(child: T.self_type).void }
34
+ sig { params(child: Anthropic::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -276,9 +276,13 @@ module Anthropic
276
276
 
277
277
  # Create a new instance of a model.
278
278
  sig do
279
- params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(
280
- T.attached_class
281
- )
279
+ params(
280
+ data:
281
+ T.any(
282
+ T::Hash[Symbol, T.anything],
283
+ Anthropic::Internal::Type::BaseModel
284
+ )
285
+ ).returns(T.attached_class)
282
286
  end
283
287
  def self.new(data = {})
284
288
  end
@@ -35,10 +35,17 @@ module Anthropic
35
35
  end
36
36
  attr_writer :cache_control
37
37
 
38
+ sig { returns(T.nilable(T::Boolean)) }
39
+ attr_reader :strict
40
+
41
+ sig { params(strict: T::Boolean).void }
42
+ attr_writer :strict
43
+
38
44
  sig do
39
45
  params(
40
46
  cache_control:
41
47
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
48
+ strict: T::Boolean,
42
49
  name: Symbol,
43
50
  type: Symbol
44
51
  ).returns(T.attached_class)
@@ -46,6 +53,7 @@ module Anthropic
46
53
  def self.new(
47
54
  # Create a cache control breakpoint at this content block.
48
55
  cache_control: nil,
56
+ strict: nil,
49
57
  # Name of the tool.
50
58
  #
51
59
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -60,7 +68,8 @@ module Anthropic
60
68
  name: Symbol,
61
69
  type: Symbol,
62
70
  cache_control:
63
- T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
71
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
72
+ strict: T::Boolean
64
73
  }
65
74
  )
66
75
  end
@@ -35,10 +35,17 @@ module Anthropic
35
35
  end
36
36
  attr_writer :cache_control
37
37
 
38
+ sig { returns(T.nilable(T::Boolean)) }
39
+ attr_reader :strict
40
+
41
+ sig { params(strict: T::Boolean).void }
42
+ attr_writer :strict
43
+
38
44
  sig do
39
45
  params(
40
46
  cache_control:
41
47
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
48
+ strict: T::Boolean,
42
49
  name: Symbol,
43
50
  type: Symbol
44
51
  ).returns(T.attached_class)
@@ -46,6 +53,7 @@ module Anthropic
46
53
  def self.new(
47
54
  # Create a cache control breakpoint at this content block.
48
55
  cache_control: nil,
56
+ strict: nil,
49
57
  # Name of the tool.
50
58
  #
51
59
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -60,7 +68,8 @@ module Anthropic
60
68
  name: Symbol,
61
69
  type: Symbol,
62
70
  cache_control:
63
- T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
71
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
72
+ strict: T::Boolean
64
73
  }
65
74
  )
66
75
  end
@@ -0,0 +1,46 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaJSONOutputFormat = Beta::BetaJSONOutputFormat
6
+
7
+ module Beta
8
+ class BetaJSONOutputFormat < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaJSONOutputFormat,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # The JSON schema of the format
18
+ sig { returns(T::Hash[Symbol, T.anything]) }
19
+ attr_accessor :schema
20
+
21
+ sig { returns(Symbol) }
22
+ attr_accessor :type
23
+
24
+ sig do
25
+ params(schema: T::Hash[Symbol, T.anything], type: Symbol).returns(
26
+ T.attached_class
27
+ )
28
+ end
29
+ def self.new(
30
+ # The JSON schema of the format
31
+ schema:,
32
+ type: :json_schema
33
+ )
34
+ end
35
+
36
+ sig do
37
+ override.returns(
38
+ { schema: T::Hash[Symbol, T.anything], type: Symbol }
39
+ )
40
+ end
41
+ def to_hash
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -35,10 +35,17 @@ module Anthropic
35
35
  end
36
36
  attr_writer :cache_control
37
37
 
38
+ sig { returns(T.nilable(T::Boolean)) }
39
+ attr_reader :strict
40
+
41
+ sig { params(strict: T::Boolean).void }
42
+ attr_writer :strict
43
+
38
44
  sig do
39
45
  params(
40
46
  cache_control:
41
47
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
48
+ strict: T::Boolean,
42
49
  name: Symbol,
43
50
  type: Symbol
44
51
  ).returns(T.attached_class)
@@ -46,6 +53,7 @@ module Anthropic
46
53
  def self.new(
47
54
  # Create a cache control breakpoint at this content block.
48
55
  cache_control: nil,
56
+ strict: nil,
49
57
  # Name of the tool.
50
58
  #
51
59
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -60,7 +68,8 @@ module Anthropic
60
68
  name: Symbol,
61
69
  type: Symbol,
62
70
  cache_control:
63
- T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
71
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
72
+ strict: T::Boolean
64
73
  }
65
74
  )
66
75
  end
@@ -55,6 +55,12 @@ module Anthropic
55
55
  sig { params(description: String).void }
56
56
  attr_writer :description
57
57
 
58
+ sig { returns(T.nilable(T::Boolean)) }
59
+ attr_reader :strict
60
+
61
+ sig { params(strict: T::Boolean).void }
62
+ attr_writer :strict
63
+
58
64
  sig { returns(T.nilable(Anthropic::Beta::BetaTool::Type::OrSymbol)) }
59
65
  attr_accessor :type
60
66
 
@@ -65,6 +71,7 @@ module Anthropic
65
71
  cache_control:
66
72
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
67
73
  description: String,
74
+ strict: T::Boolean,
68
75
  type: T.nilable(Anthropic::Beta::BetaTool::Type::OrSymbol)
69
76
  ).returns(T.attached_class)
70
77
  end
@@ -87,6 +94,7 @@ module Anthropic
87
94
  # perform. You can use natural language descriptions to reinforce important
88
95
  # aspects of the tool input JSON schema.
89
96
  description: nil,
97
+ strict: nil,
90
98
  type: nil
91
99
  )
92
100
  end
@@ -99,6 +107,7 @@ module Anthropic
99
107
  cache_control:
100
108
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
101
109
  description: String,
110
+ strict: T::Boolean,
102
111
  type: T.nilable(Anthropic::Beta::BetaTool::Type::OrSymbol)
103
112
  }
104
113
  )
@@ -35,10 +35,17 @@ module Anthropic
35
35
  end
36
36
  attr_writer :cache_control
37
37
 
38
+ sig { returns(T.nilable(T::Boolean)) }
39
+ attr_reader :strict
40
+
41
+ sig { params(strict: T::Boolean).void }
42
+ attr_writer :strict
43
+
38
44
  sig do
39
45
  params(
40
46
  cache_control:
41
47
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
48
+ strict: T::Boolean,
42
49
  name: Symbol,
43
50
  type: Symbol
44
51
  ).returns(T.attached_class)
@@ -46,6 +53,7 @@ module Anthropic
46
53
  def self.new(
47
54
  # Create a cache control breakpoint at this content block.
48
55
  cache_control: nil,
56
+ strict: nil,
49
57
  # Name of the tool.
50
58
  #
51
59
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -60,7 +68,8 @@ module Anthropic
60
68
  name: Symbol,
61
69
  type: Symbol,
62
70
  cache_control:
63
- T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
71
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
72
+ strict: T::Boolean
64
73
  }
65
74
  )
66
75
  end
@@ -35,10 +35,17 @@ module Anthropic
35
35
  end
36
36
  attr_writer :cache_control
37
37
 
38
+ sig { returns(T.nilable(T::Boolean)) }
39
+ attr_reader :strict
40
+
41
+ sig { params(strict: T::Boolean).void }
42
+ attr_writer :strict
43
+
38
44
  sig do
39
45
  params(
40
46
  cache_control:
41
47
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
48
+ strict: T::Boolean,
42
49
  name: Symbol,
43
50
  type: Symbol
44
51
  ).returns(T.attached_class)
@@ -46,6 +53,7 @@ module Anthropic
46
53
  def self.new(
47
54
  # Create a cache control breakpoint at this content block.
48
55
  cache_control: nil,
56
+ strict: nil,
49
57
  # Name of the tool.
50
58
  #
51
59
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -60,7 +68,8 @@ module Anthropic
60
68
  name: Symbol,
61
69
  type: Symbol,
62
70
  cache_control:
63
- T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
71
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
72
+ strict: T::Boolean
64
73
  }
65
74
  )
66
75
  end
@@ -47,6 +47,12 @@ module Anthropic
47
47
  sig { returns(T.nilable(Integer)) }
48
48
  attr_accessor :display_number
49
49
 
50
+ sig { returns(T.nilable(T::Boolean)) }
51
+ attr_reader :strict
52
+
53
+ sig { params(strict: T::Boolean).void }
54
+ attr_writer :strict
55
+
50
56
  sig do
51
57
  params(
52
58
  display_height_px: Integer,
@@ -54,6 +60,7 @@ module Anthropic
54
60
  cache_control:
55
61
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
56
62
  display_number: T.nilable(Integer),
63
+ strict: T::Boolean,
57
64
  name: Symbol,
58
65
  type: Symbol
59
66
  ).returns(T.attached_class)
@@ -67,6 +74,7 @@ module Anthropic
67
74
  cache_control: nil,
68
75
  # The X11 display number (e.g. 0, 1) for the display.
69
76
  display_number: nil,
77
+ strict: nil,
70
78
  # Name of the tool.
71
79
  #
72
80
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -84,7 +92,8 @@ module Anthropic
84
92
  type: Symbol,
85
93
  cache_control:
86
94
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
87
- display_number: T.nilable(Integer)
95
+ display_number: T.nilable(Integer),
96
+ strict: T::Boolean
88
97
  }
89
98
  )
90
99
  end
@@ -47,6 +47,12 @@ module Anthropic
47
47
  sig { returns(T.nilable(Integer)) }
48
48
  attr_accessor :display_number
49
49
 
50
+ sig { returns(T.nilable(T::Boolean)) }
51
+ attr_reader :strict
52
+
53
+ sig { params(strict: T::Boolean).void }
54
+ attr_writer :strict
55
+
50
56
  sig do
51
57
  params(
52
58
  display_height_px: Integer,
@@ -54,6 +60,7 @@ module Anthropic
54
60
  cache_control:
55
61
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
56
62
  display_number: T.nilable(Integer),
63
+ strict: T::Boolean,
57
64
  name: Symbol,
58
65
  type: Symbol
59
66
  ).returns(T.attached_class)
@@ -67,6 +74,7 @@ module Anthropic
67
74
  cache_control: nil,
68
75
  # The X11 display number (e.g. 0, 1) for the display.
69
76
  display_number: nil,
77
+ strict: nil,
70
78
  # Name of the tool.
71
79
  #
72
80
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -84,7 +92,8 @@ module Anthropic
84
92
  type: Symbol,
85
93
  cache_control:
86
94
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
87
- display_number: T.nilable(Integer)
95
+ display_number: T.nilable(Integer),
96
+ strict: T::Boolean
88
97
  }
89
98
  )
90
99
  end
@@ -35,10 +35,17 @@ module Anthropic
35
35
  end
36
36
  attr_writer :cache_control
37
37
 
38
+ sig { returns(T.nilable(T::Boolean)) }
39
+ attr_reader :strict
40
+
41
+ sig { params(strict: T::Boolean).void }
42
+ attr_writer :strict
43
+
38
44
  sig do
39
45
  params(
40
46
  cache_control:
41
47
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
48
+ strict: T::Boolean,
42
49
  name: Symbol,
43
50
  type: Symbol
44
51
  ).returns(T.attached_class)
@@ -46,6 +53,7 @@ module Anthropic
46
53
  def self.new(
47
54
  # Create a cache control breakpoint at this content block.
48
55
  cache_control: nil,
56
+ strict: nil,
49
57
  # Name of the tool.
50
58
  #
51
59
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -60,7 +68,8 @@ module Anthropic
60
68
  name: Symbol,
61
69
  type: Symbol,
62
70
  cache_control:
63
- T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
71
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
72
+ strict: T::Boolean
64
73
  }
65
74
  )
66
75
  end
@@ -35,10 +35,17 @@ module Anthropic
35
35
  end
36
36
  attr_writer :cache_control
37
37
 
38
+ sig { returns(T.nilable(T::Boolean)) }
39
+ attr_reader :strict
40
+
41
+ sig { params(strict: T::Boolean).void }
42
+ attr_writer :strict
43
+
38
44
  sig do
39
45
  params(
40
46
  cache_control:
41
47
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
48
+ strict: T::Boolean,
42
49
  name: Symbol,
43
50
  type: Symbol
44
51
  ).returns(T.attached_class)
@@ -46,6 +53,7 @@ module Anthropic
46
53
  def self.new(
47
54
  # Create a cache control breakpoint at this content block.
48
55
  cache_control: nil,
56
+ strict: nil,
49
57
  # Name of the tool.
50
58
  #
51
59
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -60,7 +68,8 @@ module Anthropic
60
68
  name: Symbol,
61
69
  type: Symbol,
62
70
  cache_control:
63
- T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
71
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
72
+ strict: T::Boolean
64
73
  }
65
74
  )
66
75
  end
@@ -35,10 +35,17 @@ module Anthropic
35
35
  end
36
36
  attr_writer :cache_control
37
37
 
38
+ sig { returns(T.nilable(T::Boolean)) }
39
+ attr_reader :strict
40
+
41
+ sig { params(strict: T::Boolean).void }
42
+ attr_writer :strict
43
+
38
44
  sig do
39
45
  params(
40
46
  cache_control:
41
47
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
48
+ strict: T::Boolean,
42
49
  name: Symbol,
43
50
  type: Symbol
44
51
  ).returns(T.attached_class)
@@ -46,6 +53,7 @@ module Anthropic
46
53
  def self.new(
47
54
  # Create a cache control breakpoint at this content block.
48
55
  cache_control: nil,
56
+ strict: nil,
49
57
  # Name of the tool.
50
58
  #
51
59
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -60,7 +68,8 @@ module Anthropic
60
68
  name: Symbol,
61
69
  type: Symbol,
62
70
  cache_control:
63
- T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
71
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
72
+ strict: T::Boolean
64
73
  }
65
74
  )
66
75
  end
@@ -40,11 +40,18 @@ module Anthropic
40
40
  sig { returns(T.nilable(Integer)) }
41
41
  attr_accessor :max_characters
42
42
 
43
+ sig { returns(T.nilable(T::Boolean)) }
44
+ attr_reader :strict
45
+
46
+ sig { params(strict: T::Boolean).void }
47
+ attr_writer :strict
48
+
43
49
  sig do
44
50
  params(
45
51
  cache_control:
46
52
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
47
53
  max_characters: T.nilable(Integer),
54
+ strict: T::Boolean,
48
55
  name: Symbol,
49
56
  type: Symbol
50
57
  ).returns(T.attached_class)
@@ -55,6 +62,7 @@ module Anthropic
55
62
  # Maximum number of characters to display when viewing a file. If not specified,
56
63
  # defaults to displaying the full file.
57
64
  max_characters: nil,
65
+ strict: nil,
58
66
  # Name of the tool.
59
67
  #
60
68
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -70,7 +78,8 @@ module Anthropic
70
78
  type: Symbol,
71
79
  cache_control:
72
80
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
73
- max_characters: T.nilable(Integer)
81
+ max_characters: T.nilable(Integer),
82
+ strict: T::Boolean
74
83
  }
75
84
  )
76
85
  end
@@ -65,6 +65,12 @@ module Anthropic
65
65
  sig { returns(T.nilable(Integer)) }
66
66
  attr_accessor :max_uses
67
67
 
68
+ sig { returns(T.nilable(T::Boolean)) }
69
+ attr_reader :strict
70
+
71
+ sig { params(strict: T::Boolean).void }
72
+ attr_writer :strict
73
+
68
74
  sig do
69
75
  params(
70
76
  allowed_domains: T.nilable(T::Array[String]),
@@ -75,6 +81,7 @@ module Anthropic
75
81
  T.nilable(Anthropic::Beta::BetaCitationsConfigParam::OrHash),
76
82
  max_content_tokens: T.nilable(Integer),
77
83
  max_uses: T.nilable(Integer),
84
+ strict: T::Boolean,
78
85
  name: Symbol,
79
86
  type: Symbol
80
87
  ).returns(T.attached_class)
@@ -94,6 +101,7 @@ module Anthropic
94
101
  max_content_tokens: nil,
95
102
  # Maximum number of times the tool can be used in the API request.
96
103
  max_uses: nil,
104
+ strict: nil,
97
105
  # Name of the tool.
98
106
  #
99
107
  # This is how the tool will be called by the model and in `tool_use` blocks.
@@ -113,7 +121,8 @@ module Anthropic
113
121
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
114
122
  citations: T.nilable(Anthropic::Beta::BetaCitationsConfigParam),
115
123
  max_content_tokens: T.nilable(Integer),
116
- max_uses: T.nilable(Integer)
124
+ max_uses: T.nilable(Integer),
125
+ strict: T::Boolean
117
126
  }
118
127
  )
119
128
  end
@@ -49,6 +49,12 @@ module Anthropic
49
49
  sig { returns(T.nilable(Integer)) }
50
50
  attr_accessor :max_uses
51
51
 
52
+ sig { returns(T.nilable(T::Boolean)) }
53
+ attr_reader :strict
54
+
55
+ sig { params(strict: T::Boolean).void }
56
+ attr_writer :strict
57
+
52
58
  # Parameters for the user's location. Used to provide more relevant search
53
59
  # results.
54
60
  sig do
@@ -75,6 +81,7 @@ module Anthropic
75
81
  cache_control:
76
82
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
77
83
  max_uses: T.nilable(Integer),
84
+ strict: T::Boolean,
78
85
  user_location:
79
86
  T.nilable(
80
87
  Anthropic::Beta::BetaWebSearchTool20250305::UserLocation::OrHash
@@ -94,6 +101,7 @@ module Anthropic
94
101
  cache_control: nil,
95
102
  # Maximum number of times the tool can be used in the API request.
96
103
  max_uses: nil,
104
+ strict: nil,
97
105
  # Parameters for the user's location. Used to provide more relevant search
98
106
  # results.
99
107
  user_location: nil,
@@ -115,6 +123,7 @@ module Anthropic
115
123
  cache_control:
116
124
  T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
117
125
  max_uses: T.nilable(Integer),
126
+ strict: T::Boolean,
118
127
  user_location:
119
128
  T.nilable(
120
129
  Anthropic::Beta::BetaWebSearchTool20250305::UserLocation
@@ -124,6 +124,18 @@ module Anthropic
124
124
  end
125
125
  attr_writer :mcp_servers
126
126
 
127
+ # A schema to specify Claude's output format in responses.
128
+ sig { returns(T.nilable(Anthropic::Beta::BetaJSONOutputFormat)) }
129
+ attr_reader :output_format
130
+
131
+ sig do
132
+ params(
133
+ output_format:
134
+ T.nilable(Anthropic::Beta::BetaJSONOutputFormat::OrHash)
135
+ ).void
136
+ end
137
+ attr_writer :output_format
138
+
127
139
  # System prompt.
128
140
  #
129
141
  # A system prompt is a way of providing context and instructions to Claude, such
@@ -359,6 +371,8 @@ module Anthropic
359
371
  T::Array[
360
372
  Anthropic::Beta::BetaRequestMCPServerURLDefinition::OrHash
361
373
  ],
374
+ output_format:
375
+ T.nilable(Anthropic::Beta::BetaJSONOutputFormat::OrHash),
362
376
  system_:
363
377
  Anthropic::Beta::MessageCountTokensParams::System::Variants,
364
378
  thinking:
@@ -474,6 +488,8 @@ module Anthropic
474
488
  context_management: nil,
475
489
  # MCP servers to be utilized in this request
476
490
  mcp_servers: nil,
491
+ # A schema to specify Claude's output format in responses.
492
+ output_format: nil,
477
493
  # System prompt.
478
494
  #
479
495
  # A system prompt is a way of providing context and instructions to Claude, such
@@ -584,6 +600,7 @@ module Anthropic
584
600
  T.nilable(Anthropic::Beta::BetaContextManagementConfig),
585
601
  mcp_servers:
586
602
  T::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
603
+ output_format: T.nilable(Anthropic::Beta::BetaJSONOutputFormat),
587
604
  system_:
588
605
  Anthropic::Beta::MessageCountTokensParams::System::Variants,
589
606
  thinking:
@@ -149,6 +149,18 @@ module Anthropic
149
149
  sig { params(metadata: Anthropic::Beta::BetaMetadata::OrHash).void }
150
150
  attr_writer :metadata
151
151
 
152
+ # A schema to specify Claude's output format in responses.
153
+ sig { returns(T.nilable(Anthropic::Beta::BetaJSONOutputFormat)) }
154
+ attr_reader :output_format
155
+
156
+ sig do
157
+ params(
158
+ output_format:
159
+ T.nilable(Anthropic::Beta::BetaJSONOutputFormat::OrHash)
160
+ ).void
161
+ end
162
+ attr_writer :output_format
163
+
152
164
  # Determines whether to use priority capacity (if available) or standard capacity
153
165
  # for this request.
154
166
  #
@@ -467,6 +479,8 @@ module Anthropic
467
479
  Anthropic::Beta::BetaRequestMCPServerURLDefinition::OrHash
468
480
  ],
469
481
  metadata: Anthropic::Beta::BetaMetadata::OrHash,
482
+ output_format:
483
+ T.nilable(Anthropic::Beta::BetaJSONOutputFormat::OrHash),
470
484
  service_tier:
471
485
  Anthropic::Beta::MessageCreateParams::ServiceTier::OrSymbol,
472
486
  stop_sequences: T::Array[String],
@@ -599,6 +613,8 @@ module Anthropic
599
613
  mcp_servers: nil,
600
614
  # An object describing metadata about the request.
601
615
  metadata: nil,
616
+ # A schema to specify Claude's output format in responses.
617
+ output_format: nil,
602
618
  # Determines whether to use priority capacity (if available) or standard capacity
603
619
  # for this request.
604
620
  #
@@ -756,6 +772,7 @@ module Anthropic
756
772
  mcp_servers:
757
773
  T::Array[Anthropic::Beta::BetaRequestMCPServerURLDefinition],
758
774
  metadata: Anthropic::Beta::BetaMetadata,
775
+ output_format: T.nilable(Anthropic::Beta::BetaJSONOutputFormat),
759
776
  service_tier:
760
777
  Anthropic::Beta::MessageCreateParams::ServiceTier::OrSymbol,
761
778
  stop_sequences: T::Array[String],