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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd00e27834064b69a4c340776b3a6dcc50be9cde619c86fca93663c421cb7dff
4
- data.tar.gz: 8a07090aaa4fc943673bba3a67411ef3d2dede001e8a597487c6be61b17a6d36
3
+ metadata.gz: 4ced85b0845309fa483a95e407acb558e39bccf379888470f19a8c1eae31e907
4
+ data.tar.gz: 14578f144cd3cbfc87f893778708dc0edc4f6e688b38f190282d3aa1281b37b2
5
5
  SHA512:
6
- metadata.gz: f50ad464f5deeaf0be1635ca3fe270b82efd88332c145472ca653048b3e970925b531f9e652401d8f5cfe6e055083e540aadd2f3f6ae18b743acb2e58c0a513c
7
- data.tar.gz: 0706ceb70895b9cfedf683a8edbc183a73b45234c62531c15a281860891de1ed2160245f104a3f4f752eb7d82235de0d6ade340bdf66e1a5de99801cf755a951
6
+ metadata.gz: 57200336a627b02746585da5c51260c9d59abfbc6727244370e6b4ff1a3d1abc47c0f24bfdcecb7ca474fed1e79aedc829c3e3d886af298efb1dcd3e4670df44
7
+ data.tar.gz: 249c20c997d69379e5eb9195639da67da2a46834a6bb20672e1993ccc794d10e5471911dc7237fa94c56a00eb67dd88841a1cbf19ae7435712f05369223f6c4e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.15.1 (2025-11-14)
4
+
5
+ Full Changelog: [v1.15.0...v1.15.1](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.15.0...v1.15.1)
6
+
7
+ ## 1.15.0 (2025-11-14)
8
+
9
+ Full Changelog: [v1.14.0...v1.15.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.14.0...v1.15.0)
10
+
11
+ ### Features
12
+
13
+ * **api:** add support for structured outputs beta ([1a4ec00](https://github.com/anthropics/anthropic-sdk-ruby/commit/1a4ec00f3eb519f23fd29eb6a18b256aa2002c11))
14
+
3
15
  ## 1.14.0 (2025-11-07)
4
16
 
5
17
  Full Changelog: [v1.13.0...v1.14.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.13.0...v1.14.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "anthropic", "~> 1.14.0"
18
+ gem "anthropic", "~> 1.15.1"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -20,18 +20,13 @@ module Anthropic
20
20
 
21
21
  case data
22
22
  in {tools: Array => tool_array}
23
- # rubocop:disable Metrics/BlockLength
24
23
  mapped = tool_array.map do |tool|
25
24
  case tool
26
25
  # Direct tool class:
27
26
  in Anthropic::Helpers::InputSchema::JsonSchemaConverter
28
27
  classname = tool.is_a?(Anthropic::Helpers::Tools::BaseTool) ? tool.class.name : tool.name
29
- name = classname
30
- .split("::")
31
- .last
32
- .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
33
- .gsub(/([a-z\d])([A-Z])/, '\1_\2')
34
- .downcase
28
+ name = model_name(classname)
29
+
35
30
  description =
36
31
  case tool
37
32
  in Anthropic::Helpers::Tools::BaseTool
@@ -59,9 +54,20 @@ module Anthropic
59
54
  end
60
55
  end
61
56
  tool_array.replace(mapped)
57
+ in {output_format: Anthropic::Helpers::InputSchema::JsonSchemaConverter => model}
58
+ name = model_name(model.name)
59
+ models.store(name, model)
60
+ schema = model.to_json_schema
61
+ Anthropic::Helpers::InputSchema::SupportedSchemas.transform_schema!(schema)
62
+ data.update(output_format: {type: :json_schema, schema: schema})
63
+ in {output_format: {schema: Anthropic::Helpers::StructuredOutput::JsonSchemaConverter => model} => output_format}
64
+ name = model_name(model.name)
65
+ models.store(name, model)
66
+ schema = model.to_json_schema
67
+ Anthropic::Helpers::InputSchema::SupportedSchemas.transform_schema!(schema)
68
+ output_format.update(type: :json_schema, schema:)
62
69
  else
63
70
  end
64
- # rubocop:enable Metrics/BlockLength
65
71
 
66
72
  [tools, models]
67
73
  end
@@ -101,6 +107,20 @@ module Anthropic
101
107
 
102
108
  raw
103
109
  end
110
+
111
+ # @api private
112
+ #
113
+ # @param classname [String]
114
+ #
115
+ # @return [String]
116
+ private def model_name(classname)
117
+ classname
118
+ .split("::")
119
+ .last
120
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
121
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
122
+ .downcase
123
+ end
104
124
  end
105
125
  end
106
126
  end
@@ -278,7 +278,6 @@ module Anthropic
278
278
  @accumated_message_snapshot = nil
279
279
  # Mapping of tool names to model classes for parsing.
280
280
  @tools = tools
281
- # Mapping of tool names to model classes for parsing.
282
281
  @models = models
283
282
  # Lazy enumerable that transforms raw events into consumable events.
284
283
  @iterator = iterator
@@ -23,12 +23,19 @@ module Anthropic
23
23
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
24
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
25
 
26
- # @!method initialize(cache_control: nil, name: :code_execution, type: :code_execution_20250522)
26
+ # @!attribute strict
27
+ #
28
+ # @return [Boolean, nil]
29
+ optional :strict, Anthropic::Internal::Type::Boolean
30
+
31
+ # @!method initialize(cache_control: nil, strict: nil, name: :code_execution, type: :code_execution_20250522)
27
32
  # Some parameter documentations has been truncated, see
28
33
  # {Anthropic::Models::Beta::BetaCodeExecutionTool20250522} for more details.
29
34
  #
30
35
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
31
36
  #
37
+ # @param strict [Boolean]
38
+ #
32
39
  # @param name [Symbol, :code_execution] Name of the tool.
33
40
  #
34
41
  # @param type [Symbol, :code_execution_20250522]
@@ -23,12 +23,19 @@ module Anthropic
23
23
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
24
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
25
 
26
- # @!method initialize(cache_control: nil, name: :code_execution, type: :code_execution_20250825)
26
+ # @!attribute strict
27
+ #
28
+ # @return [Boolean, nil]
29
+ optional :strict, Anthropic::Internal::Type::Boolean
30
+
31
+ # @!method initialize(cache_control: nil, strict: nil, name: :code_execution, type: :code_execution_20250825)
27
32
  # Some parameter documentations has been truncated, see
28
33
  # {Anthropic::Models::Beta::BetaCodeExecutionTool20250825} for more details.
29
34
  #
30
35
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
31
36
  #
37
+ # @param strict [Boolean]
38
+ #
32
39
  # @param name [Symbol, :code_execution] Name of the tool.
33
40
  #
34
41
  # @param type [Symbol, :code_execution_20250825]
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaJSONOutputFormat < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute schema
8
+ # The JSON schema of the format
9
+ #
10
+ # @return [Hash{Symbol=>Object}]
11
+ required :schema, Anthropic::Internal::Type::HashOf[Anthropic::Internal::Type::Unknown]
12
+
13
+ # @!attribute type
14
+ #
15
+ # @return [Symbol, :json_schema]
16
+ required :type, const: :json_schema
17
+
18
+ # @!method initialize(schema:, type: :json_schema)
19
+ # @param schema [Hash{Symbol=>Object}] The JSON schema of the format
20
+ #
21
+ # @param type [Symbol, :json_schema]
22
+ end
23
+ end
24
+
25
+ BetaJSONOutputFormat = Beta::BetaJSONOutputFormat
26
+ end
27
+ end
@@ -23,12 +23,19 @@ module Anthropic
23
23
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
24
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
25
 
26
- # @!method initialize(cache_control: nil, name: :memory, type: :memory_20250818)
26
+ # @!attribute strict
27
+ #
28
+ # @return [Boolean, nil]
29
+ optional :strict, Anthropic::Internal::Type::Boolean
30
+
31
+ # @!method initialize(cache_control: nil, strict: nil, name: :memory, type: :memory_20250818)
27
32
  # Some parameter documentations has been truncated, see
28
33
  # {Anthropic::Models::Beta::BetaMemoryTool20250818} for more details.
29
34
  #
30
35
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
31
36
  #
37
+ # @param strict [Boolean]
38
+ #
32
39
  # @param name [Symbol, :memory] Name of the tool.
33
40
  #
34
41
  # @param type [Symbol, :memory_20250818]
@@ -59,6 +59,18 @@ module Anthropic
59
59
  # @return [Array<Anthropic::Models::Beta::BetaTextBlock, Anthropic::Models::Beta::BetaThinkingBlock, Anthropic::Models::Beta::BetaRedactedThinkingBlock, Anthropic::Models::Beta::BetaToolUseBlock, Anthropic::Models::Beta::BetaServerToolUseBlock, Anthropic::Models::Beta::BetaWebSearchToolResultBlock, Anthropic::Models::Beta::BetaWebFetchToolResultBlock, Anthropic::Models::Beta::BetaCodeExecutionToolResultBlock, Anthropic::Models::Beta::BetaBashCodeExecutionToolResultBlock, Anthropic::Models::Beta::BetaTextEditorCodeExecutionToolResultBlock, Anthropic::Models::Beta::BetaMCPToolUseBlock, Anthropic::Models::Beta::BetaMCPToolResultBlock, Anthropic::Models::Beta::BetaContainerUploadBlock>]
60
60
  required :content, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::Beta::BetaContentBlock] }
61
61
 
62
+ # parsed value of response when a JSON output schema object has been specified via :output_format
63
+ #
64
+ # @return [Object, nil]
65
+ def parsed_output
66
+ case content
67
+ in [*, {parsed:}]
68
+ parsed
69
+ else
70
+ nil
71
+ end
72
+ end
73
+
62
74
  # @!attribute context_management
63
75
  # Context management response.
64
76
  #
@@ -21,6 +21,14 @@ module Anthropic
21
21
  # @return [String]
22
22
  required :text, String
23
23
 
24
+ response_only do
25
+ # @!attribute parsed
26
+ # parsed value of `#text` when a JSON output schema object has been specified
27
+ #
28
+ # @return [Object, nil]
29
+ optional :parsed, Anthropic::Helpers::InputSchema::ParsedJson
30
+ end
31
+
24
32
  # @!attribute type
25
33
  #
26
34
  # @return [Symbol, :text]
@@ -38,12 +38,17 @@ module Anthropic
38
38
  # @return [String, nil]
39
39
  optional :description, String
40
40
 
41
+ # @!attribute strict
42
+ #
43
+ # @return [Boolean, nil]
44
+ optional :strict, Anthropic::Internal::Type::Boolean
45
+
41
46
  # @!attribute type
42
47
  #
43
48
  # @return [Symbol, Anthropic::Models::Beta::BetaTool::Type, nil]
44
49
  optional :type, enum: -> { Anthropic::Beta::BetaTool::Type }, nil?: true
45
50
 
46
- # @!method initialize(input_schema:, name:, cache_control: nil, description: nil, type: nil)
51
+ # @!method initialize(input_schema:, name:, cache_control: nil, description: nil, strict: nil, type: nil)
47
52
  # Some parameter documentations has been truncated, see
48
53
  # {Anthropic::Models::Beta::BetaTool} for more details.
49
54
  #
@@ -55,6 +60,8 @@ module Anthropic
55
60
  #
56
61
  # @param description [String] Description of what this tool does.
57
62
  #
63
+ # @param strict [Boolean]
64
+ #
58
65
  # @param type [Symbol, Anthropic::Models::Beta::BetaTool::Type, nil]
59
66
 
60
67
  # @see Anthropic::Models::Beta::BetaTool#input_schema
@@ -23,12 +23,19 @@ module Anthropic
23
23
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
24
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
25
 
26
- # @!method initialize(cache_control: nil, name: :bash, type: :bash_20241022)
26
+ # @!attribute strict
27
+ #
28
+ # @return [Boolean, nil]
29
+ optional :strict, Anthropic::Internal::Type::Boolean
30
+
31
+ # @!method initialize(cache_control: nil, strict: nil, name: :bash, type: :bash_20241022)
27
32
  # Some parameter documentations has been truncated, see
28
33
  # {Anthropic::Models::Beta::BetaToolBash20241022} for more details.
29
34
  #
30
35
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
31
36
  #
37
+ # @param strict [Boolean]
38
+ #
32
39
  # @param name [Symbol, :bash] Name of the tool.
33
40
  #
34
41
  # @param type [Symbol, :bash_20241022]
@@ -23,12 +23,19 @@ module Anthropic
23
23
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
24
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
25
 
26
- # @!method initialize(cache_control: nil, name: :bash, type: :bash_20250124)
26
+ # @!attribute strict
27
+ #
28
+ # @return [Boolean, nil]
29
+ optional :strict, Anthropic::Internal::Type::Boolean
30
+
31
+ # @!method initialize(cache_control: nil, strict: nil, name: :bash, type: :bash_20250124)
27
32
  # Some parameter documentations has been truncated, see
28
33
  # {Anthropic::Models::Beta::BetaToolBash20250124} for more details.
29
34
  #
30
35
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
31
36
  #
37
+ # @param strict [Boolean]
38
+ #
32
39
  # @param name [Symbol, :bash] Name of the tool.
33
40
  #
34
41
  # @param type [Symbol, :bash_20250124]
@@ -41,7 +41,12 @@ module Anthropic
41
41
  # @return [Integer, nil]
42
42
  optional :display_number, Integer, nil?: true
43
43
 
44
- # @!method initialize(display_height_px:, display_width_px:, cache_control: nil, display_number: nil, name: :computer, type: :computer_20241022)
44
+ # @!attribute strict
45
+ #
46
+ # @return [Boolean, nil]
47
+ optional :strict, Anthropic::Internal::Type::Boolean
48
+
49
+ # @!method initialize(display_height_px:, display_width_px:, cache_control: nil, display_number: nil, strict: nil, name: :computer, type: :computer_20241022)
45
50
  # Some parameter documentations has been truncated, see
46
51
  # {Anthropic::Models::Beta::BetaToolComputerUse20241022} for more details.
47
52
  #
@@ -53,6 +58,8 @@ module Anthropic
53
58
  #
54
59
  # @param display_number [Integer, nil] The X11 display number (e.g. 0, 1) for the display.
55
60
  #
61
+ # @param strict [Boolean]
62
+ #
56
63
  # @param name [Symbol, :computer] Name of the tool.
57
64
  #
58
65
  # @param type [Symbol, :computer_20241022]
@@ -41,7 +41,12 @@ module Anthropic
41
41
  # @return [Integer, nil]
42
42
  optional :display_number, Integer, nil?: true
43
43
 
44
- # @!method initialize(display_height_px:, display_width_px:, cache_control: nil, display_number: nil, name: :computer, type: :computer_20250124)
44
+ # @!attribute strict
45
+ #
46
+ # @return [Boolean, nil]
47
+ optional :strict, Anthropic::Internal::Type::Boolean
48
+
49
+ # @!method initialize(display_height_px:, display_width_px:, cache_control: nil, display_number: nil, strict: nil, name: :computer, type: :computer_20250124)
45
50
  # Some parameter documentations has been truncated, see
46
51
  # {Anthropic::Models::Beta::BetaToolComputerUse20250124} for more details.
47
52
  #
@@ -53,6 +58,8 @@ module Anthropic
53
58
  #
54
59
  # @param display_number [Integer, nil] The X11 display number (e.g. 0, 1) for the display.
55
60
  #
61
+ # @param strict [Boolean]
62
+ #
56
63
  # @param name [Symbol, :computer] Name of the tool.
57
64
  #
58
65
  # @param type [Symbol, :computer_20250124]
@@ -23,12 +23,19 @@ module Anthropic
23
23
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
24
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
25
 
26
- # @!method initialize(cache_control: nil, name: :str_replace_editor, type: :text_editor_20241022)
26
+ # @!attribute strict
27
+ #
28
+ # @return [Boolean, nil]
29
+ optional :strict, Anthropic::Internal::Type::Boolean
30
+
31
+ # @!method initialize(cache_control: nil, strict: nil, name: :str_replace_editor, type: :text_editor_20241022)
27
32
  # Some parameter documentations has been truncated, see
28
33
  # {Anthropic::Models::Beta::BetaToolTextEditor20241022} for more details.
29
34
  #
30
35
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
31
36
  #
37
+ # @param strict [Boolean]
38
+ #
32
39
  # @param name [Symbol, :str_replace_editor] Name of the tool.
33
40
  #
34
41
  # @param type [Symbol, :text_editor_20241022]
@@ -23,12 +23,19 @@ module Anthropic
23
23
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
24
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
25
 
26
- # @!method initialize(cache_control: nil, name: :str_replace_editor, type: :text_editor_20250124)
26
+ # @!attribute strict
27
+ #
28
+ # @return [Boolean, nil]
29
+ optional :strict, Anthropic::Internal::Type::Boolean
30
+
31
+ # @!method initialize(cache_control: nil, strict: nil, name: :str_replace_editor, type: :text_editor_20250124)
27
32
  # Some parameter documentations has been truncated, see
28
33
  # {Anthropic::Models::Beta::BetaToolTextEditor20250124} for more details.
29
34
  #
30
35
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
31
36
  #
37
+ # @param strict [Boolean]
38
+ #
32
39
  # @param name [Symbol, :str_replace_editor] Name of the tool.
33
40
  #
34
41
  # @param type [Symbol, :text_editor_20250124]
@@ -23,12 +23,19 @@ module Anthropic
23
23
  # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
24
24
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
25
25
 
26
- # @!method initialize(cache_control: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250429)
26
+ # @!attribute strict
27
+ #
28
+ # @return [Boolean, nil]
29
+ optional :strict, Anthropic::Internal::Type::Boolean
30
+
31
+ # @!method initialize(cache_control: nil, strict: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250429)
27
32
  # Some parameter documentations has been truncated, see
28
33
  # {Anthropic::Models::Beta::BetaToolTextEditor20250429} for more details.
29
34
  #
30
35
  # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
31
36
  #
37
+ # @param strict [Boolean]
38
+ #
32
39
  # @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
33
40
  #
34
41
  # @param type [Symbol, :text_editor_20250429]
@@ -30,7 +30,12 @@ module Anthropic
30
30
  # @return [Integer, nil]
31
31
  optional :max_characters, Integer, nil?: true
32
32
 
33
- # @!method initialize(cache_control: nil, max_characters: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250728)
33
+ # @!attribute strict
34
+ #
35
+ # @return [Boolean, nil]
36
+ optional :strict, Anthropic::Internal::Type::Boolean
37
+
38
+ # @!method initialize(cache_control: nil, max_characters: nil, strict: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250728)
34
39
  # Some parameter documentations has been truncated, see
35
40
  # {Anthropic::Models::Beta::BetaToolTextEditor20250728} for more details.
36
41
  #
@@ -38,6 +43,8 @@ module Anthropic
38
43
  #
39
44
  # @param max_characters [Integer, nil] Maximum number of characters to display when viewing a file. If not specified, d
40
45
  #
46
+ # @param strict [Boolean]
47
+ #
41
48
  # @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
42
49
  #
43
50
  # @param type [Symbol, :text_editor_20250728]
@@ -55,7 +55,12 @@ module Anthropic
55
55
  # @return [Integer, nil]
56
56
  optional :max_uses, Integer, nil?: true
57
57
 
58
- # @!method initialize(allowed_domains: nil, blocked_domains: nil, cache_control: nil, citations: nil, max_content_tokens: nil, max_uses: nil, name: :web_fetch, type: :web_fetch_20250910)
58
+ # @!attribute strict
59
+ #
60
+ # @return [Boolean, nil]
61
+ optional :strict, Anthropic::Internal::Type::Boolean
62
+
63
+ # @!method initialize(allowed_domains: nil, blocked_domains: nil, cache_control: nil, citations: nil, max_content_tokens: nil, max_uses: nil, strict: nil, name: :web_fetch, type: :web_fetch_20250910)
59
64
  # Some parameter documentations has been truncated, see
60
65
  # {Anthropic::Models::Beta::BetaWebFetchTool20250910} for more details.
61
66
  #
@@ -71,6 +76,8 @@ module Anthropic
71
76
  #
72
77
  # @param max_uses [Integer, nil] Maximum number of times the tool can be used in the API request.
73
78
  #
79
+ # @param strict [Boolean]
80
+ #
74
81
  # @param name [Symbol, :web_fetch] Name of the tool.
75
82
  #
76
83
  # @param type [Symbol, :web_fetch_20250910]
@@ -43,6 +43,11 @@ module Anthropic
43
43
  # @return [Integer, nil]
44
44
  optional :max_uses, Integer, nil?: true
45
45
 
46
+ # @!attribute strict
47
+ #
48
+ # @return [Boolean, nil]
49
+ optional :strict, Anthropic::Internal::Type::Boolean
50
+
46
51
  # @!attribute user_location
47
52
  # Parameters for the user's location. Used to provide more relevant search
48
53
  # results.
@@ -50,7 +55,7 @@ module Anthropic
50
55
  # @return [Anthropic::Models::Beta::BetaWebSearchTool20250305::UserLocation, nil]
51
56
  optional :user_location, -> { Anthropic::Beta::BetaWebSearchTool20250305::UserLocation }, nil?: true
52
57
 
53
- # @!method initialize(allowed_domains: nil, blocked_domains: nil, cache_control: nil, max_uses: nil, user_location: nil, name: :web_search, type: :web_search_20250305)
58
+ # @!method initialize(allowed_domains: nil, blocked_domains: nil, cache_control: nil, max_uses: nil, strict: nil, user_location: nil, name: :web_search, type: :web_search_20250305)
54
59
  # Some parameter documentations has been truncated, see
55
60
  # {Anthropic::Models::Beta::BetaWebSearchTool20250305} for more details.
56
61
  #
@@ -62,6 +67,8 @@ module Anthropic
62
67
  #
63
68
  # @param max_uses [Integer, nil] Maximum number of times the tool can be used in the API request.
64
69
  #
70
+ # @param strict [Boolean]
71
+ #
65
72
  # @param user_location [Anthropic::Models::Beta::BetaWebSearchTool20250305::UserLocation, nil] Parameters for the user's location. Used to provide more relevant search results
66
73
  #
67
74
  # @param name [Symbol, :web_search] Name of the tool.
@@ -102,6 +102,12 @@ module Anthropic
102
102
  optional :mcp_servers,
103
103
  -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaRequestMCPServerURLDefinition] }
104
104
 
105
+ # @!attribute output_format
106
+ # A schema to specify Claude's output format in responses.
107
+ #
108
+ # @return [Anthropic::Models::Beta::BetaJSONOutputFormat, nil]
109
+ optional :output_format, -> { Anthropic::Beta::BetaJSONOutputFormat }, nil?: true
110
+
105
111
  # @!attribute system_
106
112
  # System prompt.
107
113
  #
@@ -220,7 +226,7 @@ module Anthropic
220
226
  # @return [Array<String, Symbol, Anthropic::Models::AnthropicBeta>, nil]
221
227
  optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }
222
228
 
223
- # @!method initialize(messages:, model:, context_management: nil, mcp_servers: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
229
+ # @!method initialize(messages:, model:, context_management: nil, mcp_servers: nil, output_format: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, request_options: {})
224
230
  # Some parameter documentations has been truncated, see
225
231
  # {Anthropic::Models::Beta::MessageCountTokensParams} for more details.
226
232
  #
@@ -232,6 +238,8 @@ module Anthropic
232
238
  #
233
239
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] MCP servers to be utilized in this request
234
240
  #
241
+ # @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil]
242
+ #
235
243
  # @param system_ [String, Array<Anthropic::Models::Beta::BetaTextBlockParam>] System prompt.
236
244
  #
237
245
  # @param thinking [Anthropic::Models::Beta::BetaThinkingConfigEnabled, Anthropic::Models::Beta::BetaThinkingConfigDisabled] Configuration for enabling Claude's extended thinking.
@@ -128,6 +128,12 @@ module Anthropic
128
128
  # @return [Anthropic::Models::Beta::BetaMetadata, nil]
129
129
  optional :metadata, -> { Anthropic::Beta::BetaMetadata }
130
130
 
131
+ # @!attribute output_format
132
+ # A schema to specify Claude's output format in responses.
133
+ #
134
+ # @return [Anthropic::Models::Beta::BetaJSONOutputFormat, nil]
135
+ optional :output_format, -> { Anthropic::Beta::BetaJSONOutputFormat }, nil?: true
136
+
131
137
  # @!attribute service_tier
132
138
  # Determines whether to use priority capacity (if available) or standard capacity
133
139
  # for this request.
@@ -308,7 +314,7 @@ module Anthropic
308
314
  # @return [Array<String, Symbol, Anthropic::Models::AnthropicBeta>, nil]
309
315
  optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }
310
316
 
311
- # @!method initialize(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: {})
317
+ # @!method initialize(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: {})
312
318
  # Some parameter documentations has been truncated, see
313
319
  # {Anthropic::Models::Beta::MessageCreateParams} for more details.
314
320
  #
@@ -326,6 +332,8 @@ module Anthropic
326
332
  #
327
333
  # @param metadata [Anthropic::Models::Beta::BetaMetadata] An object describing metadata about the request.
328
334
  #
335
+ # @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil]
336
+ #
329
337
  # @param service_tier [Symbol, Anthropic::Models::Beta::MessageCreateParams::ServiceTier] Determines whether to use priority capacity (if available) or standard capacity
330
338
  #
331
339
  # @param stop_sequences [Array<String>] Custom text sequences that will cause the model to stop generating.
@@ -183,6 +183,12 @@ module Anthropic
183
183
  # @return [Anthropic::Models::Beta::BetaMetadata, nil]
184
184
  optional :metadata, -> { Anthropic::Beta::BetaMetadata }
185
185
 
186
+ # @!attribute output_format
187
+ # A schema to specify Claude's output format in responses.
188
+ #
189
+ # @return [Anthropic::Models::Beta::BetaJSONOutputFormat, nil]
190
+ optional :output_format, -> { Anthropic::Beta::BetaJSONOutputFormat }, nil?: true
191
+
186
192
  # @!attribute service_tier
187
193
  # Determines whether to use priority capacity (if available) or standard capacity
188
194
  # for this request.
@@ -368,7 +374,7 @@ module Anthropic
368
374
  # @return [Float, nil]
369
375
  optional :top_p, Float
370
376
 
371
- # @!method initialize(max_tokens:, messages:, model:, container: nil, context_management: nil, mcp_servers: nil, metadata: nil, service_tier: nil, stop_sequences: nil, stream: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil)
377
+ # @!method initialize(max_tokens:, messages:, model:, container: nil, context_management: nil, mcp_servers: nil, metadata: nil, output_format: nil, service_tier: nil, stop_sequences: nil, stream: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil)
372
378
  # Some parameter documentations has been truncated, see
373
379
  # {Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params} for more
374
380
  # details.
@@ -392,6 +398,8 @@ module Anthropic
392
398
  #
393
399
  # @param metadata [Anthropic::Models::Beta::BetaMetadata] An object describing metadata about the request.
394
400
  #
401
+ # @param output_format [Anthropic::Models::Beta::BetaJSONOutputFormat, nil]
402
+ #
395
403
  # @param service_tier [Symbol, Anthropic::Models::Beta::Messages::BatchCreateParams::Request::Params::ServiceTier] Determines whether to use priority capacity (if available) or standard capacity
396
404
  #
397
405
  # @param stop_sequences [Array<String>] Custom text sequences that will cause the model to stop generating.