anthropic 1.14.0 → 1.15.1

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/helpers/messages.rb +28 -8
  5. data/lib/anthropic/helpers/streaming/message_stream.rb +0 -1
  6. data/lib/anthropic/models/beta/beta_code_execution_tool_20250522.rb +8 -1
  7. data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +8 -1
  8. data/lib/anthropic/models/beta/beta_json_output_format.rb +27 -0
  9. data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +8 -1
  10. data/lib/anthropic/models/beta/beta_message.rb +12 -0
  11. data/lib/anthropic/models/beta/beta_text_block.rb +8 -0
  12. data/lib/anthropic/models/beta/beta_tool.rb +8 -1
  13. data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +8 -1
  14. data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +8 -1
  15. data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +8 -1
  16. data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +8 -1
  17. data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +8 -1
  18. data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +8 -1
  19. data/lib/anthropic/models/beta/beta_tool_text_editor_20250429.rb +8 -1
  20. data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +8 -1
  21. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +8 -1
  22. data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +8 -1
  23. data/lib/anthropic/models/beta/message_count_tokens_params.rb +9 -1
  24. data/lib/anthropic/models/beta/message_create_params.rb +9 -1
  25. data/lib/anthropic/models/beta/messages/batch_create_params.rb +9 -1
  26. data/lib/anthropic/resources/beta/messages/batches.rb +6 -6
  27. data/lib/anthropic/resources/beta/messages.rb +14 -6
  28. data/lib/anthropic/resources/messages/batches.rb +6 -6
  29. data/lib/anthropic/resources/messages.rb +5 -3
  30. data/lib/anthropic/version.rb +1 -1
  31. data/lib/anthropic.rb +1 -0
  32. data/rbi/anthropic/helpers/streaming/message_stream.rbi +8 -1
  33. data/rbi/anthropic/helpers/tools/base_tool.rbi +13 -3
  34. data/rbi/anthropic/helpers/tools/runner.rbi +12 -6
  35. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250522.rbi +10 -1
  36. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +10 -1
  37. data/rbi/anthropic/models/beta/beta_json_output_format.rbi +46 -0
  38. data/rbi/anthropic/models/beta/beta_mcp_tool_use_block.rbi +3 -0
  39. data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +10 -1
  40. data/rbi/anthropic/models/beta/beta_message.rbi +4 -0
  41. data/rbi/anthropic/models/beta/beta_text_block.rbi +4 -0
  42. data/rbi/anthropic/models/beta/beta_tool.rbi +9 -0
  43. data/rbi/anthropic/models/beta/beta_tool_bash_20241022.rbi +10 -1
  44. data/rbi/anthropic/models/beta/beta_tool_bash_20250124.rbi +10 -1
  45. data/rbi/anthropic/models/beta/beta_tool_computer_use_20241022.rbi +10 -1
  46. data/rbi/anthropic/models/beta/beta_tool_computer_use_20250124.rbi +10 -1
  47. data/rbi/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +10 -1
  48. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +10 -1
  49. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250429.rbi +10 -1
  50. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +10 -1
  51. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +10 -1
  52. data/rbi/anthropic/models/beta/beta_web_search_tool_20250305.rbi +9 -0
  53. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +17 -0
  54. data/rbi/anthropic/models/beta/message_create_params.rbi +17 -0
  55. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +18 -0
  56. data/rbi/anthropic/models/tool_use_block.rbi +3 -3
  57. data/rbi/anthropic/resources/beta/messages/batches.rbi +6 -6
  58. data/rbi/anthropic/resources/beta/messages.rbi +17 -3
  59. data/rbi/anthropic/resources/messages/batches.rbi +6 -6
  60. data/rbi/anthropic/resources/messages.rbi +5 -3
  61. data/sig/anthropic/helpers/streaming/message_stream.rbs +2 -1
  62. data/sig/anthropic/models/beta/beta_code_execution_tool_20250522.rbs +9 -2
  63. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +9 -2
  64. data/sig/anthropic/models/beta/beta_json_output_format.rbs +23 -0
  65. data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +9 -2
  66. data/sig/anthropic/models/beta/beta_message.rbs +2 -0
  67. data/sig/anthropic/models/beta/beta_text_block.rbs +2 -0
  68. data/sig/anthropic/models/beta/beta_tool.rbs +7 -0
  69. data/sig/anthropic/models/beta/beta_tool_bash_20241022.rbs +9 -2
  70. data/sig/anthropic/models/beta/beta_tool_bash_20250124.rbs +9 -2
  71. data/sig/anthropic/models/beta/beta_tool_computer_use_20241022.rbs +9 -2
  72. data/sig/anthropic/models/beta/beta_tool_computer_use_20250124.rbs +9 -2
  73. data/sig/anthropic/models/beta/beta_tool_text_editor_20241022.rbs +9 -2
  74. data/sig/anthropic/models/beta/beta_tool_text_editor_20250124.rbs +9 -2
  75. data/sig/anthropic/models/beta/beta_tool_text_editor_20250429.rbs +9 -2
  76. data/sig/anthropic/models/beta/beta_tool_text_editor_20250728.rbs +9 -2
  77. data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +9 -2
  78. data/sig/anthropic/models/beta/beta_web_search_tool_20250305.rbs +7 -0
  79. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +5 -0
  80. data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
  81. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +5 -0
  82. data/sig/anthropic/resources/beta/messages.rbs +3 -0
  83. metadata +5 -2
@@ -15,7 +15,7 @@ module Anthropic
15
15
  # can take up to 24 hours to complete.
16
16
  #
17
17
  # Learn more about the Message Batches API in our
18
- # [user guide](/en/docs/build-with-claude/batch-processing)
18
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
19
19
  #
20
20
  # @overload create(requests:, betas: nil, request_options: {})
21
21
  #
@@ -46,7 +46,7 @@ module Anthropic
46
46
  # `results_url` field in the response.
47
47
  #
48
48
  # Learn more about the Message Batches API in our
49
- # [user guide](/en/docs/build-with-claude/batch-processing)
49
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
50
50
  #
51
51
  # @overload retrieve(message_batch_id, betas: nil, request_options: {})
52
52
  #
@@ -77,7 +77,7 @@ module Anthropic
77
77
  # returned first.
78
78
  #
79
79
  # Learn more about the Message Batches API in our
80
- # [user guide](/en/docs/build-with-claude/batch-processing)
80
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
81
81
  #
82
82
  # @overload list(after_id: nil, before_id: nil, limit: nil, betas: nil, request_options: {})
83
83
  #
@@ -114,7 +114,7 @@ module Anthropic
114
114
  # like to delete an in-progress batch, you must first cancel it.
115
115
  #
116
116
  # Learn more about the Message Batches API in our
117
- # [user guide](/en/docs/build-with-claude/batch-processing)
117
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
118
118
  #
119
119
  # @overload delete(message_batch_id, betas: nil, request_options: {})
120
120
  #
@@ -149,7 +149,7 @@ module Anthropic
149
149
  # non-interruptible.
150
150
  #
151
151
  # Learn more about the Message Batches API in our
152
- # [user guide](/en/docs/build-with-claude/batch-processing)
152
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
153
153
  #
154
154
  # @overload cancel(message_batch_id, betas: nil, request_options: {})
155
155
  #
@@ -180,7 +180,7 @@ module Anthropic
180
180
  # requests. Use the `custom_id` field to match results to requests.
181
181
  #
182
182
  # Learn more about the Message Batches API in our
183
- # [user guide](/en/docs/build-with-claude/batch-processing)
183
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
184
184
  #
185
185
  # @overload results_streaming(message_batch_id, betas: nil, request_options: {})
186
186
  #
@@ -25,9 +25,10 @@ module Anthropic
25
25
  # The Messages API can be used for either single queries or stateless multi-turn
26
26
  # conversations.
27
27
  #
28
- # Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
28
+ # Learn more about the Messages API in our
29
+ # [user guide](https://docs.claude.com/en/docs/initial-setup)
29
30
  #
30
- # @overload create(max_tokens:, messages:, model:, container: nil, context_management: nil, mcp_servers: nil, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
31
+ # @overload create(max_tokens:, messages:, model:, container: nil, context_management: nil, mcp_servers: nil, metadata: nil, output_format: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
31
32
  #
32
33
  # @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
33
34
  #
@@ -43,6 +44,8 @@ module Anthropic
43
44
  #
44
45
  # @param metadata [Anthropic::Models::Beta::BetaMetadata] Body param: An object describing metadata about the request.
45
46
  #
47
+ # @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Body param:
48
+ #
46
49
  # @param service_tier [Symbol, Anthropic::Models::Beta::MessageCreateParams::ServiceTier] Body param: Determines whether to use priority capacity (if available) or standa
47
50
  #
48
51
  # @param stop_sequences [Array<String>] Body param: Custom text sequences that will cause the model to stop generating.
@@ -114,9 +117,10 @@ module Anthropic
114
117
  # The Messages API can be used for either single queries or stateless multi-turn
115
118
  # conversations.
116
119
  #
117
- # Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
120
+ # Learn more about the Messages API in our
121
+ # [user guide](https://docs.claude.com/en/docs/initial-setup)
118
122
  #
119
- # @overload stream_raw(max_tokens:, messages:, model:, container: nil, context_management: nil, mcp_servers: nil, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
123
+ # @overload stream_raw(max_tokens:, messages:, model:, container: nil, context_management: nil, mcp_servers: nil, metadata: nil, output_format: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
120
124
  #
121
125
  # @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
122
126
  #
@@ -132,6 +136,8 @@ module Anthropic
132
136
  #
133
137
  # @param metadata [Anthropic::Models::Beta::BetaMetadata] Body param: An object describing metadata about the request.
134
138
  #
139
+ # @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Body param:
140
+ #
135
141
  # @param service_tier [Symbol, Anthropic::Models::Beta::MessageCreateParams::ServiceTier] Body param: Determines whether to use priority capacity (if available) or standa
136
142
  #
137
143
  # @param stop_sequences [Array<String>] Body param: Custom text sequences that will cause the model to stop generating.
@@ -265,9 +271,9 @@ module Anthropic
265
271
  # including tools, images, and documents, without creating it.
266
272
  #
267
273
  # Learn more about token counting in our
268
- # [user guide](/en/docs/build-with-claude/token-counting)
274
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
269
275
  #
270
- # @overload count_tokens(messages:, model:, context_management: nil, mcp_servers: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
276
+ # @overload count_tokens(messages:, model:, context_management: nil, mcp_servers: nil, output_format: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
271
277
  #
272
278
  # @param messages [Array<Anthropic::Models::Beta::BetaMessageParam>] Body param: Input messages.
273
279
  #
@@ -277,6 +283,8 @@ module Anthropic
277
283
  #
278
284
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
279
285
  #
286
+ # @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil] Body param:
287
+ #
280
288
  # @param system_ [String, Array<Anthropic::Models::Beta::BetaTextBlockParam>] Body param: System prompt.
281
289
  #
282
290
  # @param thinking [Anthropic::Models::Beta::BetaThinkingConfigEnabled, Anthropic::Models::Beta::BetaThinkingConfigDisabled] Body param: Configuration for enabling Claude's extended thinking.
@@ -14,7 +14,7 @@ module Anthropic
14
14
  # can take up to 24 hours to complete.
15
15
  #
16
16
  # Learn more about the Message Batches API in our
17
- # [user guide](/en/docs/build-with-claude/batch-processing)
17
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
18
18
  #
19
19
  # @overload create(requests:, request_options: {})
20
20
  #
@@ -41,7 +41,7 @@ module Anthropic
41
41
  # `results_url` field in the response.
42
42
  #
43
43
  # Learn more about the Message Batches API in our
44
- # [user guide](/en/docs/build-with-claude/batch-processing)
44
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
45
45
  #
46
46
  # @overload retrieve(message_batch_id, request_options: {})
47
47
  #
@@ -68,7 +68,7 @@ module Anthropic
68
68
  # returned first.
69
69
  #
70
70
  # Learn more about the Message Batches API in our
71
- # [user guide](/en/docs/build-with-claude/batch-processing)
71
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
72
72
  #
73
73
  # @overload list(after_id: nil, before_id: nil, limit: nil, request_options: {})
74
74
  #
@@ -101,7 +101,7 @@ module Anthropic
101
101
  # like to delete an in-progress batch, you must first cancel it.
102
102
  #
103
103
  # Learn more about the Message Batches API in our
104
- # [user guide](/en/docs/build-with-claude/batch-processing)
104
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
105
105
  #
106
106
  # @overload delete(message_batch_id, request_options: {})
107
107
  #
@@ -132,7 +132,7 @@ module Anthropic
132
132
  # non-interruptible.
133
133
  #
134
134
  # Learn more about the Message Batches API in our
135
- # [user guide](/en/docs/build-with-claude/batch-processing)
135
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
136
136
  #
137
137
  # @overload cancel(message_batch_id, request_options: {})
138
138
  #
@@ -159,7 +159,7 @@ module Anthropic
159
159
  # requests. Use the `custom_id` field to match results to requests.
160
160
  #
161
161
  # Learn more about the Message Batches API in our
162
- # [user guide](/en/docs/build-with-claude/batch-processing)
162
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/batch-processing)
163
163
  #
164
164
  # @overload results_streaming(message_batch_id, request_options: {})
165
165
  #
@@ -17,7 +17,8 @@ module Anthropic
17
17
  # The Messages API can be used for either single queries or stateless multi-turn
18
18
  # conversations.
19
19
  #
20
- # Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
20
+ # Learn more about the Messages API in our
21
+ # [user guide](https://docs.claude.com/en/docs/initial-setup)
21
22
  #
22
23
  # @overload create(max_tokens:, messages:, model:, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {})
23
24
  #
@@ -166,7 +167,8 @@ module Anthropic
166
167
  # The Messages API can be used for either single queries or stateless multi-turn
167
168
  # conversations.
168
169
  #
169
- # Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
170
+ # Learn more about the Messages API in our
171
+ # [user guide](https://docs.claude.com/en/docs/initial-setup)
170
172
  #
171
173
  # @overload stream_raw(max_tokens:, messages:, model:, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, request_options: {})
172
174
  #
@@ -228,7 +230,7 @@ module Anthropic
228
230
  # including tools, images, and documents, without creating it.
229
231
  #
230
232
  # Learn more about token counting in our
231
- # [user guide](/en/docs/build-with-claude/token-counting)
233
+ # [user guide](https://docs.claude.com/en/docs/build-with-claude/token-counting)
232
234
  #
233
235
  # @overload count_tokens(messages:, model:, system_: nil, thinking: nil, tool_choice: nil, tools: nil, request_options: {})
234
236
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anthropic
4
- VERSION = "1.14.0"
4
+ VERSION = "1.15.1"
5
5
  end
data/lib/anthropic.rb CHANGED
@@ -140,6 +140,7 @@ require_relative "anthropic/models/beta/beta_image_block_param"
140
140
  require_relative "anthropic/models/beta/beta_input_json_delta"
141
141
  require_relative "anthropic/models/beta/beta_input_tokens_clear_at_least"
142
142
  require_relative "anthropic/models/beta/beta_input_tokens_trigger"
143
+ require_relative "anthropic/models/beta/beta_json_output_format"
143
144
  require_relative "anthropic/models/beta/beta_mcp_tool_result_block"
144
145
  require_relative "anthropic/models/beta/beta_mcp_tool_use_block"
145
146
  require_relative "anthropic/models/beta/beta_mcp_tool_use_block_param"
@@ -51,7 +51,14 @@ module Anthropic
51
51
  def text
52
52
  end
53
53
 
54
- sig { returns(Anthropic::Models::Message) }
54
+ sig do
55
+ returns(
56
+ T.any(
57
+ Anthropic::Models::Message,
58
+ Anthropic::Models::Beta::BetaMessage
59
+ )
60
+ )
61
+ end
55
62
  def accumulated_message
56
63
  end
57
64
 
@@ -12,7 +12,9 @@ module Anthropic
12
12
  class << self
13
13
  # @api public
14
14
  #
15
- sig { returns(T.class_of(Anthropic::Helpers::InputSchema::BaseModel)) }
15
+ sig do
16
+ returns(T.class_of(Anthropic::Helpers::InputSchema::BaseModel))
17
+ end
16
18
  attr_reader :model
17
19
 
18
20
  sig { returns(T.class_of(String)) }
@@ -28,7 +30,11 @@ module Anthropic
28
30
 
29
31
  # @api public
30
32
  #
31
- sig { params(model: T.class_of(Anthropic::Helpers::InputSchema::BaseModel)).returns(T.class_of(Anthropic::Helpers::InputSchema::BaseModel)) }
33
+ sig do
34
+ params(
35
+ model: T.class_of(Anthropic::Helpers::InputSchema::BaseModel)
36
+ ).returns(T.class_of(Anthropic::Helpers::InputSchema::BaseModel))
37
+ end
32
38
  def input_schema(model) = (@model = model)
33
39
  end
34
40
 
@@ -42,7 +48,11 @@ module Anthropic
42
48
 
43
49
  # @api public
44
50
  #
45
- sig { params(parsed: Anthropic::Helpers::InputSchema::BaseModel).returns(T.anything) }
51
+ sig do
52
+ params(parsed: Anthropic::Helpers::InputSchema::BaseModel).returns(
53
+ T.anything
54
+ )
55
+ end
46
56
  def call(parsed)
47
57
  end
48
58
  end
@@ -10,30 +10,36 @@ module Anthropic
10
10
  attr_accessor :params
11
11
 
12
12
  sig { returns(T::Boolean) }
13
- def finished?; end
13
+ def finished?
14
+ end
14
15
 
15
16
  sig { params(messages: Anthropic::Models::Beta::BetaMessageParam).void }
16
- def feed_messages(*messages); end
17
+ def feed_messages(*messages)
18
+ end
17
19
 
18
20
  sig { returns(Anthropic::Models::BetaMessage) }
19
- def next_message; end
21
+ def next_message
22
+ end
20
23
 
21
24
  sig { returns(T::Array[Anthropic::Models::BetaMessage]) }
22
- def run_until_finished; end
25
+ def run_until_finished
26
+ end
23
27
 
24
28
  sig do
25
29
  params(
26
30
  blk: T.proc.params(arg0: Anthropic::Models::BetaMessage).void
27
31
  ).void
28
32
  end
29
- def each_message(&blk); end
33
+ def each_message(&blk)
34
+ end
30
35
 
31
36
  sig do
32
37
  params(
33
38
  blk: T.proc.params(arg0: Anthropic::Streaming::MessageStream).void
34
39
  ).void
35
40
  end
36
- def each_streaming(&blk); end
41
+ def each_streaming(&blk)
42
+ end
37
43
  end
38
44
  end
39
45
  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
@@ -20,6 +20,9 @@ module Anthropic
20
20
  sig { returns(T::Hash[Symbol, T.anything]) }
21
21
  attr_accessor :input
22
22
 
23
+ sig { returns(T.nilable(T.anything)) }
24
+ attr_accessor :parsed
25
+
23
26
  # The name of the MCP tool
24
27
  sig { returns(String) }
25
28
  attr_accessor :name
@@ -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
@@ -29,6 +29,10 @@ module Anthropic
29
29
  end
30
30
  attr_writer :container
31
31
 
32
+ sig { returns(T.nilable(T.anything)) }
33
+ def parsed_output
34
+ end
35
+
32
36
  # Content generated by the model.
33
37
  #
34
38
  # This is an array of content blocks, each of which has a `type` that determines
@@ -26,6 +26,10 @@ module Anthropic
26
26
  sig { returns(String) }
27
27
  attr_accessor :text
28
28
 
29
+ # parsed value of `#text` when a JSON output schema object has been specified
30
+ sig { returns(T.nilable(T.anything)) }
31
+ attr_accessor :parsed
32
+
29
33
  sig { returns(Symbol) }
30
34
  attr_accessor :type
31
35
 
@@ -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