anthropic 1.7.0 → 1.9.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 (179) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/helpers/input_schema/array_of.rb +41 -0
  5. data/lib/anthropic/helpers/input_schema/base_model.rb +86 -0
  6. data/lib/anthropic/helpers/input_schema/boolean.rb +29 -0
  7. data/lib/anthropic/helpers/input_schema/enum_of.rb +63 -0
  8. data/lib/anthropic/helpers/input_schema/json_schema_converter.rb +199 -0
  9. data/lib/anthropic/helpers/input_schema/parsed_json.rb +39 -0
  10. data/lib/anthropic/helpers/input_schema/property_mapping.rb +47 -0
  11. data/lib/anthropic/helpers/input_schema/union_of.rb +56 -0
  12. data/lib/anthropic/helpers/input_schema.rb +16 -0
  13. data/lib/anthropic/helpers/streaming/message_stream.rb +41 -1
  14. data/lib/anthropic/input_schema.rb +10 -0
  15. data/lib/anthropic/internal/stream.rb +2 -1
  16. data/lib/anthropic/internal/transport/base_client.rb +1 -2
  17. data/lib/anthropic/internal/transport/pooled_net_requester.rb +1 -9
  18. data/lib/anthropic/internal/type/base_model.rb +2 -9
  19. data/lib/anthropic/internal/util.rb +2 -2
  20. data/lib/anthropic/models/beta/beta_bash_code_execution_output_block.rb +25 -0
  21. data/lib/anthropic/models/beta/beta_bash_code_execution_output_block_param.rb +25 -0
  22. data/lib/anthropic/models/beta/beta_bash_code_execution_result_block.rb +44 -0
  23. data/lib/anthropic/models/beta/beta_bash_code_execution_result_block_param.rb +44 -0
  24. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rb +43 -0
  25. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rb +53 -0
  26. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rb +39 -0
  27. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rb +39 -0
  28. data/lib/anthropic/models/beta/beta_citation_config.rb +19 -0
  29. data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +40 -0
  30. data/lib/anthropic/models/beta/beta_content_block.rb +8 -1
  31. data/lib/anthropic/models/beta/beta_content_block_param.rb +9 -1
  32. data/lib/anthropic/models/beta/beta_document_block.rb +56 -0
  33. data/lib/anthropic/models/beta/beta_message.rb +2 -2
  34. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  35. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +10 -3
  36. data/lib/anthropic/models/beta/beta_request_document_block.rb +2 -2
  37. data/lib/anthropic/models/beta/beta_server_tool_usage.rb +9 -1
  38. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +3 -0
  39. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +3 -0
  40. data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rb +25 -0
  41. data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rb +26 -0
  42. data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rb +49 -0
  43. data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rb +50 -0
  44. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rb +47 -0
  45. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rb +57 -0
  46. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rb +45 -0
  47. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rb +46 -0
  48. data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rb +61 -0
  49. data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rb +62 -0
  50. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +6 -4
  51. data/lib/anthropic/models/beta/beta_tool_union.rb +5 -1
  52. data/lib/anthropic/models/beta/beta_web_fetch_block.rb +42 -0
  53. data/lib/anthropic/models/beta/beta_web_fetch_block_param.rb +42 -0
  54. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +82 -0
  55. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block.rb +43 -0
  56. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rb +53 -0
  57. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rb +25 -0
  58. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rb +25 -0
  59. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rb +25 -0
  60. data/lib/anthropic/models/beta/message_count_tokens_params.rb +9 -30
  61. data/lib/anthropic/models/beta/message_create_params.rb +3 -26
  62. data/lib/anthropic/models/beta/messages/batch_create_params.rb +6 -36
  63. data/lib/anthropic/models/beta/messages/beta_message_batch.rb +1 -4
  64. data/lib/anthropic/models/beta_error_response.rb +7 -1
  65. data/lib/anthropic/models/document_block_param.rb +2 -2
  66. data/lib/anthropic/models/error_response.rb +7 -1
  67. data/lib/anthropic/models/message_count_tokens_params.rb +1 -24
  68. data/lib/anthropic/models/message_create_params.rb +1 -24
  69. data/lib/anthropic/models/messages/batch_create_params.rb +2 -28
  70. data/lib/anthropic/models/tool_result_block_param.rb +6 -4
  71. data/lib/anthropic/models/tool_use_block.rb +8 -0
  72. data/lib/anthropic/resources/beta/messages.rb +3 -3
  73. data/lib/anthropic/resources/messages.rb +85 -1
  74. data/lib/anthropic/version.rb +1 -1
  75. data/lib/anthropic.rb +39 -0
  76. data/rbi/anthropic/errors.rbi +2 -2
  77. data/rbi/anthropic/helpers/input_schema/array_of.rbi +16 -0
  78. data/rbi/anthropic/helpers/input_schema/base_model.rbi +21 -0
  79. data/rbi/anthropic/helpers/input_schema/boolean.rbi +11 -0
  80. data/rbi/anthropic/helpers/input_schema/enum_of.rbi +30 -0
  81. data/rbi/anthropic/helpers/input_schema/json_schema_converter.rbi +89 -0
  82. data/rbi/anthropic/helpers/input_schema/union_of.rbi +23 -0
  83. data/rbi/anthropic/helpers/structured_output.rbi +16 -0
  84. data/rbi/anthropic/input_schema.rbi +12 -0
  85. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block.rbi +33 -0
  86. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbi +34 -0
  87. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block.rbi +72 -0
  88. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbi +77 -0
  89. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbi +86 -0
  90. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbi +110 -0
  91. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbi +101 -0
  92. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbi +101 -0
  93. data/rbi/anthropic/models/beta/beta_citation_config.rbi +30 -0
  94. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +72 -0
  95. data/rbi/anthropic/models/beta/beta_content_block.rbi +3 -0
  96. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +3 -0
  97. data/rbi/anthropic/models/beta/beta_document_block.rbi +95 -0
  98. data/rbi/anthropic/models/beta/beta_message.rbi +3 -0
  99. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +6 -0
  100. data/rbi/anthropic/models/beta/beta_request_document_block.rbi +5 -3
  101. data/rbi/anthropic/models/beta/beta_server_tool_usage.rbi +17 -2
  102. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +15 -0
  103. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +15 -0
  104. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbi +41 -0
  105. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbi +41 -0
  106. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbi +73 -0
  107. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbi +73 -0
  108. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbi +90 -0
  109. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbi +118 -0
  110. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbi +110 -0
  111. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbi +110 -0
  112. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbi +118 -0
  113. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbi +118 -0
  114. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +2 -1
  115. data/rbi/anthropic/models/beta/beta_tool_union.rbi +3 -1
  116. data/rbi/anthropic/models/beta/beta_web_fetch_block.rbi +67 -0
  117. data/rbi/anthropic/models/beta/beta_web_fetch_block_param.rbi +71 -0
  118. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +125 -0
  119. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block.rbi +81 -0
  120. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbi +109 -0
  121. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbi +51 -0
  122. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbi +50 -0
  123. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbi +70 -0
  124. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +17 -53
  125. data/rbi/anthropic/models/beta/message_create_params.rbi +14 -52
  126. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +14 -52
  127. data/rbi/anthropic/models/beta_error_response.rbi +10 -2
  128. data/rbi/anthropic/models/document_block_param.rbi +7 -3
  129. data/rbi/anthropic/models/error_response.rbi +10 -2
  130. data/rbi/anthropic/models/message_count_tokens_params.rbi +2 -48
  131. data/rbi/anthropic/models/message_create_params.rbi +2 -48
  132. data/rbi/anthropic/models/messages/batch_create_params.rbi +2 -48
  133. data/rbi/anthropic/models/tool_result_block_param.rbi +2 -1
  134. data/rbi/anthropic/resources/beta/messages.rbi +12 -75
  135. data/rbi/anthropic/resources/messages.rbi +3 -72
  136. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block.rbs +23 -0
  137. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbs +23 -0
  138. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block.rbs +44 -0
  139. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbs +44 -0
  140. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbs +44 -0
  141. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbs +49 -0
  142. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbs +48 -0
  143. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbs +48 -0
  144. data/sig/anthropic/models/beta/beta_citation_config.rbs +17 -0
  145. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +34 -0
  146. data/sig/anthropic/models/beta/beta_content_block.rbs +3 -0
  147. data/sig/anthropic/models/beta/beta_content_block_param.rbs +3 -0
  148. data/sig/anthropic/models/beta/beta_document_block.rbs +49 -0
  149. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +3 -0
  150. data/sig/anthropic/models/beta/beta_request_document_block.rbs +4 -8
  151. data/sig/anthropic/models/beta/beta_server_tool_usage.rbs +12 -3
  152. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +9 -1
  153. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +9 -1
  154. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbs +29 -0
  155. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbs +29 -0
  156. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbs +49 -0
  157. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbs +49 -0
  158. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbs +46 -0
  159. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbs +51 -0
  160. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbs +53 -0
  161. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbs +53 -0
  162. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbs +61 -0
  163. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbs +61 -0
  164. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
  165. data/sig/anthropic/models/beta/beta_tool_union.rbs +2 -0
  166. data/sig/anthropic/models/beta/beta_web_fetch_block.rbs +39 -0
  167. data/sig/anthropic/models/beta/beta_web_fetch_block_param.rbs +39 -0
  168. data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +59 -0
  169. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block.rbs +44 -0
  170. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbs +49 -0
  171. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbs +29 -0
  172. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbs +29 -0
  173. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbs +32 -0
  174. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +2 -0
  175. data/sig/anthropic/models/beta_error_response.rbs +13 -2
  176. data/sig/anthropic/models/document_block_param.rbs +4 -8
  177. data/sig/anthropic/models/error_response.rbs +13 -2
  178. data/sig/anthropic/models/tool_result_block_param.rbs +1 -0
  179. metadata +107 -2
@@ -72,30 +72,7 @@ module Anthropic
72
72
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
73
73
  # ```
74
74
  #
75
- # Starting with Claude 3 models, you can also send image content blocks:
76
- #
77
- # ```json
78
- # {
79
- # "role": "user",
80
- # "content": [
81
- # {
82
- # "type": "image",
83
- # "source": {
84
- # "type": "base64",
85
- # "media_type": "image/jpeg",
86
- # "data": "/9j/4AAQSkZJRg..."
87
- # }
88
- # },
89
- # { "type": "text", "text": "What is in this image?" }
90
- # ]
91
- # }
92
- # ```
93
- #
94
- # We currently support the `base64` source type for images, and the `image/jpeg`,
95
- # `image/png`, `image/gif`, and `image/webp` media types.
96
- #
97
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
98
- # more input examples.
75
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
99
76
  #
100
77
  # Note that if you want to include a
101
78
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -298,13 +275,15 @@ module Anthropic
298
275
  Anthropic::Beta::BetaToolBash20241022,
299
276
  Anthropic::Beta::BetaToolBash20250124,
300
277
  Anthropic::Beta::BetaCodeExecutionTool20250522,
278
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
301
279
  Anthropic::Beta::BetaToolComputerUse20241022,
302
280
  Anthropic::Beta::BetaToolComputerUse20250124,
303
281
  Anthropic::Beta::BetaToolTextEditor20241022,
304
282
  Anthropic::Beta::BetaToolTextEditor20250124,
305
283
  Anthropic::Beta::BetaToolTextEditor20250429,
306
284
  Anthropic::Beta::BetaToolTextEditor20250728,
307
- Anthropic::Beta::BetaWebSearchTool20250305
285
+ Anthropic::Beta::BetaWebSearchTool20250305,
286
+ Anthropic::Beta::BetaWebFetchTool20250910
308
287
  )
309
288
  ]
310
289
  )
@@ -321,13 +300,15 @@ module Anthropic
321
300
  Anthropic::Beta::BetaToolBash20241022::OrHash,
322
301
  Anthropic::Beta::BetaToolBash20250124::OrHash,
323
302
  Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
303
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
324
304
  Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
325
305
  Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
326
306
  Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
327
307
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
328
308
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
329
309
  Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
330
- Anthropic::Beta::BetaWebSearchTool20250305::OrHash
310
+ Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
311
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
331
312
  )
332
313
  ]
333
314
  ).void
@@ -380,13 +361,15 @@ module Anthropic
380
361
  Anthropic::Beta::BetaToolBash20241022::OrHash,
381
362
  Anthropic::Beta::BetaToolBash20250124::OrHash,
382
363
  Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
364
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
383
365
  Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
384
366
  Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
385
367
  Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
386
368
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
387
369
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
388
370
  Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
389
- Anthropic::Beta::BetaWebSearchTool20250305::OrHash
371
+ Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
372
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
390
373
  )
391
374
  ],
392
375
  betas: T::Array[T.any(String, Anthropic::AnthropicBeta::OrSymbol)],
@@ -451,30 +434,7 @@ module Anthropic
451
434
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
452
435
  # ```
453
436
  #
454
- # Starting with Claude 3 models, you can also send image content blocks:
455
- #
456
- # ```json
457
- # {
458
- # "role": "user",
459
- # "content": [
460
- # {
461
- # "type": "image",
462
- # "source": {
463
- # "type": "base64",
464
- # "media_type": "image/jpeg",
465
- # "data": "/9j/4AAQSkZJRg..."
466
- # }
467
- # },
468
- # { "type": "text", "text": "What is in this image?" }
469
- # ]
470
- # }
471
- # ```
472
- #
473
- # We currently support the `base64` source type for images, and the `image/jpeg`,
474
- # `image/png`, `image/gif`, and `image/webp` media types.
475
- #
476
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
477
- # more input examples.
437
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
478
438
  #
479
439
  # Note that if you want to include a
480
440
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -618,13 +578,15 @@ module Anthropic
618
578
  Anthropic::Beta::BetaToolBash20241022,
619
579
  Anthropic::Beta::BetaToolBash20250124,
620
580
  Anthropic::Beta::BetaCodeExecutionTool20250522,
581
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
621
582
  Anthropic::Beta::BetaToolComputerUse20241022,
622
583
  Anthropic::Beta::BetaToolComputerUse20250124,
623
584
  Anthropic::Beta::BetaToolTextEditor20241022,
624
585
  Anthropic::Beta::BetaToolTextEditor20250124,
625
586
  Anthropic::Beta::BetaToolTextEditor20250429,
626
587
  Anthropic::Beta::BetaToolTextEditor20250728,
627
- Anthropic::Beta::BetaWebSearchTool20250305
588
+ Anthropic::Beta::BetaWebSearchTool20250305,
589
+ Anthropic::Beta::BetaWebFetchTool20250910
628
590
  )
629
591
  ],
630
592
  betas:
@@ -678,13 +640,15 @@ module Anthropic
678
640
  Anthropic::Beta::BetaToolBash20241022,
679
641
  Anthropic::Beta::BetaToolBash20250124,
680
642
  Anthropic::Beta::BetaCodeExecutionTool20250522,
643
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
681
644
  Anthropic::Beta::BetaToolComputerUse20241022,
682
645
  Anthropic::Beta::BetaToolComputerUse20250124,
683
646
  Anthropic::Beta::BetaToolTextEditor20241022,
684
647
  Anthropic::Beta::BetaToolTextEditor20250124,
685
648
  Anthropic::Beta::BetaToolTextEditor20250429,
686
649
  Anthropic::Beta::BetaToolTextEditor20250728,
687
- Anthropic::Beta::BetaWebSearchTool20250305
650
+ Anthropic::Beta::BetaWebSearchTool20250305,
651
+ Anthropic::Beta::BetaWebFetchTool20250910
688
652
  )
689
653
  end
690
654
 
@@ -82,30 +82,7 @@ module Anthropic
82
82
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
83
83
  # ```
84
84
  #
85
- # Starting with Claude 3 models, you can also send image content blocks:
86
- #
87
- # ```json
88
- # {
89
- # "role": "user",
90
- # "content": [
91
- # {
92
- # "type": "image",
93
- # "source": {
94
- # "type": "base64",
95
- # "media_type": "image/jpeg",
96
- # "data": "/9j/4AAQSkZJRg..."
97
- # }
98
- # },
99
- # { "type": "text", "text": "What is in this image?" }
100
- # ]
101
- # }
102
- # ```
103
- #
104
- # We currently support the `base64` source type for images, and the `image/jpeg`,
105
- # `image/png`, `image/gif`, and `image/webp` media types.
106
- #
107
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
108
- # more input examples.
85
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
109
86
  #
110
87
  # Note that if you want to include a
111
88
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -368,13 +345,15 @@ module Anthropic
368
345
  Anthropic::Beta::BetaToolBash20241022,
369
346
  Anthropic::Beta::BetaToolBash20250124,
370
347
  Anthropic::Beta::BetaCodeExecutionTool20250522,
348
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
371
349
  Anthropic::Beta::BetaToolComputerUse20241022,
372
350
  Anthropic::Beta::BetaToolComputerUse20250124,
373
351
  Anthropic::Beta::BetaToolTextEditor20241022,
374
352
  Anthropic::Beta::BetaToolTextEditor20250124,
375
353
  Anthropic::Beta::BetaToolTextEditor20250429,
376
354
  Anthropic::Beta::BetaToolTextEditor20250728,
377
- Anthropic::Beta::BetaWebSearchTool20250305
355
+ Anthropic::Beta::BetaWebSearchTool20250305,
356
+ Anthropic::Beta::BetaWebFetchTool20250910
378
357
  )
379
358
  ]
380
359
  )
@@ -391,13 +370,15 @@ module Anthropic
391
370
  Anthropic::Beta::BetaToolBash20241022::OrHash,
392
371
  Anthropic::Beta::BetaToolBash20250124::OrHash,
393
372
  Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
373
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
394
374
  Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
395
375
  Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
396
376
  Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
397
377
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
398
378
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
399
379
  Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
400
- Anthropic::Beta::BetaWebSearchTool20250305::OrHash
380
+ Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
381
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
401
382
  )
402
383
  ]
403
384
  ).void
@@ -484,13 +465,15 @@ module Anthropic
484
465
  Anthropic::Beta::BetaToolBash20241022::OrHash,
485
466
  Anthropic::Beta::BetaToolBash20250124::OrHash,
486
467
  Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
468
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
487
469
  Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
488
470
  Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
489
471
  Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
490
472
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
491
473
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
492
474
  Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
493
- Anthropic::Beta::BetaWebSearchTool20250305::OrHash
475
+ Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
476
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
494
477
  )
495
478
  ],
496
479
  top_k: Integer,
@@ -565,30 +548,7 @@ module Anthropic
565
548
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
566
549
  # ```
567
550
  #
568
- # Starting with Claude 3 models, you can also send image content blocks:
569
- #
570
- # ```json
571
- # {
572
- # "role": "user",
573
- # "content": [
574
- # {
575
- # "type": "image",
576
- # "source": {
577
- # "type": "base64",
578
- # "media_type": "image/jpeg",
579
- # "data": "/9j/4AAQSkZJRg..."
580
- # }
581
- # },
582
- # { "type": "text", "text": "What is in this image?" }
583
- # ]
584
- # }
585
- # ```
586
- #
587
- # We currently support the `base64` source type for images, and the `image/jpeg`,
588
- # `image/png`, `image/gif`, and `image/webp` media types.
589
- #
590
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
591
- # more input examples.
551
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
592
552
  #
593
553
  # Note that if you want to include a
594
554
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -785,13 +745,15 @@ module Anthropic
785
745
  Anthropic::Beta::BetaToolBash20241022,
786
746
  Anthropic::Beta::BetaToolBash20250124,
787
747
  Anthropic::Beta::BetaCodeExecutionTool20250522,
748
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
788
749
  Anthropic::Beta::BetaToolComputerUse20241022,
789
750
  Anthropic::Beta::BetaToolComputerUse20250124,
790
751
  Anthropic::Beta::BetaToolTextEditor20241022,
791
752
  Anthropic::Beta::BetaToolTextEditor20250124,
792
753
  Anthropic::Beta::BetaToolTextEditor20250429,
793
754
  Anthropic::Beta::BetaToolTextEditor20250728,
794
- Anthropic::Beta::BetaWebSearchTool20250305
755
+ Anthropic::Beta::BetaWebSearchTool20250305,
756
+ Anthropic::Beta::BetaWebFetchTool20250910
795
757
  )
796
758
  ],
797
759
  top_k: Integer,
@@ -223,30 +223,7 @@ module Anthropic
223
223
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
224
224
  # ```
225
225
  #
226
- # Starting with Claude 3 models, you can also send image content blocks:
227
- #
228
- # ```json
229
- # {
230
- # "role": "user",
231
- # "content": [
232
- # {
233
- # "type": "image",
234
- # "source": {
235
- # "type": "base64",
236
- # "media_type": "image/jpeg",
237
- # "data": "/9j/4AAQSkZJRg..."
238
- # }
239
- # },
240
- # { "type": "text", "text": "What is in this image?" }
241
- # ]
242
- # }
243
- # ```
244
- #
245
- # We currently support the `base64` source type for images, and the `image/jpeg`,
246
- # `image/png`, `image/gif`, and `image/webp` media types.
247
- #
248
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
249
- # more input examples.
226
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
250
227
  #
251
228
  # Note that if you want to include a
252
229
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -524,13 +501,15 @@ module Anthropic
524
501
  Anthropic::Beta::BetaToolBash20241022,
525
502
  Anthropic::Beta::BetaToolBash20250124,
526
503
  Anthropic::Beta::BetaCodeExecutionTool20250522,
504
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
527
505
  Anthropic::Beta::BetaToolComputerUse20241022,
528
506
  Anthropic::Beta::BetaToolComputerUse20250124,
529
507
  Anthropic::Beta::BetaToolTextEditor20241022,
530
508
  Anthropic::Beta::BetaToolTextEditor20250124,
531
509
  Anthropic::Beta::BetaToolTextEditor20250429,
532
510
  Anthropic::Beta::BetaToolTextEditor20250728,
533
- Anthropic::Beta::BetaWebSearchTool20250305
511
+ Anthropic::Beta::BetaWebSearchTool20250305,
512
+ Anthropic::Beta::BetaWebFetchTool20250910
534
513
  )
535
514
  ]
536
515
  )
@@ -547,13 +526,15 @@ module Anthropic
547
526
  Anthropic::Beta::BetaToolBash20241022::OrHash,
548
527
  Anthropic::Beta::BetaToolBash20250124::OrHash,
549
528
  Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
529
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
550
530
  Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
551
531
  Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
552
532
  Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
553
533
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
554
534
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
555
535
  Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
556
- Anthropic::Beta::BetaWebSearchTool20250305::OrHash
536
+ Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
537
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
557
538
  )
558
539
  ]
559
540
  ).void
@@ -629,13 +610,15 @@ module Anthropic
629
610
  Anthropic::Beta::BetaToolBash20241022::OrHash,
630
611
  Anthropic::Beta::BetaToolBash20250124::OrHash,
631
612
  Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
613
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
632
614
  Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
633
615
  Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
634
616
  Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
635
617
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
636
618
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
637
619
  Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
638
- Anthropic::Beta::BetaWebSearchTool20250305::OrHash
620
+ Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
621
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
639
622
  )
640
623
  ],
641
624
  top_k: Integer,
@@ -708,30 +691,7 @@ module Anthropic
708
691
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
709
692
  # ```
710
693
  #
711
- # Starting with Claude 3 models, you can also send image content blocks:
712
- #
713
- # ```json
714
- # {
715
- # "role": "user",
716
- # "content": [
717
- # {
718
- # "type": "image",
719
- # "source": {
720
- # "type": "base64",
721
- # "media_type": "image/jpeg",
722
- # "data": "/9j/4AAQSkZJRg..."
723
- # }
724
- # },
725
- # { "type": "text", "text": "What is in this image?" }
726
- # ]
727
- # }
728
- # ```
729
- #
730
- # We currently support the `base64` source type for images, and the `image/jpeg`,
731
- # `image/png`, `image/gif`, and `image/webp` media types.
732
- #
733
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
734
- # more input examples.
694
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
735
695
  #
736
696
  # Note that if you want to include a
737
697
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -934,13 +894,15 @@ module Anthropic
934
894
  Anthropic::Beta::BetaToolBash20241022,
935
895
  Anthropic::Beta::BetaToolBash20250124,
936
896
  Anthropic::Beta::BetaCodeExecutionTool20250522,
897
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
937
898
  Anthropic::Beta::BetaToolComputerUse20241022,
938
899
  Anthropic::Beta::BetaToolComputerUse20250124,
939
900
  Anthropic::Beta::BetaToolTextEditor20241022,
940
901
  Anthropic::Beta::BetaToolTextEditor20250124,
941
902
  Anthropic::Beta::BetaToolTextEditor20250429,
942
903
  Anthropic::Beta::BetaToolTextEditor20250728,
943
- Anthropic::Beta::BetaWebSearchTool20250305
904
+ Anthropic::Beta::BetaWebSearchTool20250305,
905
+ Anthropic::Beta::BetaWebFetchTool20250910
944
906
  )
945
907
  ],
946
908
  top_k: Integer,
@@ -11,6 +11,9 @@ module Anthropic
11
11
  sig { returns(Anthropic::BetaError::Variants) }
12
12
  attr_accessor :error
13
13
 
14
+ sig { returns(T.nilable(String)) }
15
+ attr_accessor :request_id
16
+
14
17
  sig { returns(Symbol) }
15
18
  attr_accessor :type
16
19
 
@@ -28,15 +31,20 @@ module Anthropic
28
31
  Anthropic::BetaAPIError::OrHash,
29
32
  Anthropic::BetaOverloadedError::OrHash
30
33
  ),
34
+ request_id: T.nilable(String),
31
35
  type: Symbol
32
36
  ).returns(T.attached_class)
33
37
  end
34
- def self.new(error:, type: :error)
38
+ def self.new(error:, request_id:, type: :error)
35
39
  end
36
40
 
37
41
  sig do
38
42
  override.returns(
39
- { error: Anthropic::BetaError::Variants, type: Symbol }
43
+ {
44
+ error: Anthropic::BetaError::Variants,
45
+ request_id: T.nilable(String),
46
+ type: Symbol
47
+ }
40
48
  )
41
49
  end
42
50
  def to_hash
@@ -37,7 +37,11 @@ module Anthropic
37
37
  sig { returns(T.nilable(Anthropic::CitationsConfigParam)) }
38
38
  attr_reader :citations
39
39
 
40
- sig { params(citations: Anthropic::CitationsConfigParam::OrHash).void }
40
+ sig do
41
+ params(
42
+ citations: T.nilable(Anthropic::CitationsConfigParam::OrHash)
43
+ ).void
44
+ end
41
45
  attr_writer :citations
42
46
 
43
47
  sig { returns(T.nilable(String)) }
@@ -56,7 +60,7 @@ module Anthropic
56
60
  Anthropic::URLPDFSource::OrHash
57
61
  ),
58
62
  cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash),
59
- citations: Anthropic::CitationsConfigParam::OrHash,
63
+ citations: T.nilable(Anthropic::CitationsConfigParam::OrHash),
60
64
  context: T.nilable(String),
61
65
  title: T.nilable(String),
62
66
  type: Symbol
@@ -85,7 +89,7 @@ module Anthropic
85
89
  ),
86
90
  type: Symbol,
87
91
  cache_control: T.nilable(Anthropic::CacheControlEphemeral),
88
- citations: Anthropic::CitationsConfigParam,
92
+ citations: T.nilable(Anthropic::CitationsConfigParam),
89
93
  context: T.nilable(String),
90
94
  title: T.nilable(String)
91
95
  }
@@ -11,6 +11,9 @@ module Anthropic
11
11
  sig { returns(Anthropic::ErrorObject::Variants) }
12
12
  attr_accessor :error
13
13
 
14
+ sig { returns(T.nilable(String)) }
15
+ attr_accessor :request_id
16
+
14
17
  sig { returns(Symbol) }
15
18
  attr_accessor :type
16
19
 
@@ -28,15 +31,20 @@ module Anthropic
28
31
  Anthropic::APIErrorObject::OrHash,
29
32
  Anthropic::OverloadedError::OrHash
30
33
  ),
34
+ request_id: T.nilable(String),
31
35
  type: Symbol
32
36
  ).returns(T.attached_class)
33
37
  end
34
- def self.new(error:, type: :error)
38
+ def self.new(error:, request_id:, type: :error)
35
39
  end
36
40
 
37
41
  sig do
38
42
  override.returns(
39
- { error: Anthropic::ErrorObject::Variants, type: Symbol }
43
+ {
44
+ error: Anthropic::ErrorObject::Variants,
45
+ request_id: T.nilable(String),
46
+ type: Symbol
47
+ }
40
48
  )
41
49
  end
42
50
  def to_hash
@@ -71,30 +71,7 @@ module Anthropic
71
71
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
72
72
  # ```
73
73
  #
74
- # Starting with Claude 3 models, you can also send image content blocks:
75
- #
76
- # ```json
77
- # {
78
- # "role": "user",
79
- # "content": [
80
- # {
81
- # "type": "image",
82
- # "source": {
83
- # "type": "base64",
84
- # "media_type": "image/jpeg",
85
- # "data": "/9j/4AAQSkZJRg..."
86
- # }
87
- # },
88
- # { "type": "text", "text": "What is in this image?" }
89
- # ]
90
- # }
91
- # ```
92
- #
93
- # We currently support the `base64` source type for images, and the `image/jpeg`,
94
- # `image/png`, `image/gif`, and `image/webp` media types.
95
- #
96
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
97
- # more input examples.
74
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
98
75
  #
99
76
  # Note that if you want to include a
100
77
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -390,30 +367,7 @@ module Anthropic
390
367
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
391
368
  # ```
392
369
  #
393
- # Starting with Claude 3 models, you can also send image content blocks:
394
- #
395
- # ```json
396
- # {
397
- # "role": "user",
398
- # "content": [
399
- # {
400
- # "type": "image",
401
- # "source": {
402
- # "type": "base64",
403
- # "media_type": "image/jpeg",
404
- # "data": "/9j/4AAQSkZJRg..."
405
- # }
406
- # },
407
- # { "type": "text", "text": "What is in this image?" }
408
- # ]
409
- # }
410
- # ```
411
- #
412
- # We currently support the `base64` source type for images, and the `image/jpeg`,
413
- # `image/png`, `image/gif`, and `image/webp` media types.
414
- #
415
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
416
- # more input examples.
370
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
417
371
  #
418
372
  # Note that if you want to include a
419
373
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -78,30 +78,7 @@ module Anthropic
78
78
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
79
79
  # ```
80
80
  #
81
- # Starting with Claude 3 models, you can also send image content blocks:
82
- #
83
- # ```json
84
- # {
85
- # "role": "user",
86
- # "content": [
87
- # {
88
- # "type": "image",
89
- # "source": {
90
- # "type": "base64",
91
- # "media_type": "image/jpeg",
92
- # "data": "/9j/4AAQSkZJRg..."
93
- # }
94
- # },
95
- # { "type": "text", "text": "What is in this image?" }
96
- # ]
97
- # }
98
- # ```
99
- #
100
- # We currently support the `base64` source type for images, and the `image/jpeg`,
101
- # `image/png`, `image/gif`, and `image/webp` media types.
102
- #
103
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
104
- # more input examples.
81
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
105
82
  #
106
83
  # Note that if you want to include a
107
84
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
@@ -491,30 +468,7 @@ module Anthropic
491
468
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
492
469
  # ```
493
470
  #
494
- # Starting with Claude 3 models, you can also send image content blocks:
495
- #
496
- # ```json
497
- # {
498
- # "role": "user",
499
- # "content": [
500
- # {
501
- # "type": "image",
502
- # "source": {
503
- # "type": "base64",
504
- # "media_type": "image/jpeg",
505
- # "data": "/9j/4AAQSkZJRg..."
506
- # }
507
- # },
508
- # { "type": "text", "text": "What is in this image?" }
509
- # ]
510
- # }
511
- # ```
512
- #
513
- # We currently support the `base64` source type for images, and the `image/jpeg`,
514
- # `image/png`, `image/gif`, and `image/webp` media types.
515
- #
516
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
517
- # more input examples.
471
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
518
472
  #
519
473
  # Note that if you want to include a
520
474
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use