anthropic 1.1.1 → 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 (331) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +170 -0
  3. data/README.md +32 -16
  4. data/lib/anthropic/client.rb +5 -2
  5. data/lib/anthropic/errors.rb +22 -0
  6. data/lib/anthropic/helpers/bedrock/client.rb +34 -4
  7. data/lib/anthropic/helpers/input_schema/array_of.rb +41 -0
  8. data/lib/anthropic/helpers/input_schema/base_model.rb +86 -0
  9. data/lib/anthropic/helpers/input_schema/boolean.rb +29 -0
  10. data/lib/anthropic/helpers/input_schema/enum_of.rb +63 -0
  11. data/lib/anthropic/helpers/input_schema/json_schema_converter.rb +199 -0
  12. data/lib/anthropic/helpers/input_schema/parsed_json.rb +39 -0
  13. data/lib/anthropic/helpers/input_schema/property_mapping.rb +47 -0
  14. data/lib/anthropic/helpers/input_schema/union_of.rb +56 -0
  15. data/lib/anthropic/helpers/input_schema.rb +16 -0
  16. data/lib/anthropic/helpers/streaming/events.rb +141 -0
  17. data/lib/anthropic/helpers/streaming/message_stream.rb +278 -0
  18. data/lib/anthropic/helpers/streaming.rb +37 -0
  19. data/lib/anthropic/helpers/vertex/client.rb +4 -1
  20. data/lib/anthropic/input_schema.rb +10 -0
  21. data/lib/anthropic/internal/stream.rb +6 -3
  22. data/lib/anthropic/internal/transport/base_client.rb +30 -5
  23. data/lib/anthropic/internal/transport/pooled_net_requester.rb +1 -9
  24. data/lib/anthropic/internal/type/array_of.rb +7 -1
  25. data/lib/anthropic/internal/type/base_model.rb +81 -32
  26. data/lib/anthropic/internal/type/base_stream.rb +3 -1
  27. data/lib/anthropic/internal/type/boolean.rb +7 -1
  28. data/lib/anthropic/internal/type/converter.rb +69 -34
  29. data/lib/anthropic/internal/type/enum.rb +16 -5
  30. data/lib/anthropic/internal/type/file_input.rb +6 -1
  31. data/lib/anthropic/internal/type/hash_of.rb +7 -1
  32. data/lib/anthropic/internal/type/union.rb +26 -16
  33. data/lib/anthropic/internal/type/unknown.rb +7 -1
  34. data/lib/anthropic/internal/util.rb +10 -11
  35. data/lib/anthropic/models/anthropic_beta.rb +3 -0
  36. data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +1 -65
  37. data/lib/anthropic/models/beta/beta_bash_code_execution_output_block.rb +25 -0
  38. data/lib/anthropic/models/beta/beta_bash_code_execution_output_block_param.rb +25 -0
  39. data/lib/anthropic/models/beta/beta_bash_code_execution_result_block.rb +44 -0
  40. data/lib/anthropic/models/beta/beta_bash_code_execution_result_block_param.rb +44 -0
  41. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rb +43 -0
  42. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rb +53 -0
  43. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rb +39 -0
  44. data/lib/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rb +39 -0
  45. data/lib/anthropic/models/beta/beta_citation_char_location.rb +7 -1
  46. data/lib/anthropic/models/beta/beta_citation_config.rb +19 -0
  47. data/lib/anthropic/models/beta/beta_citation_content_block_location.rb +7 -1
  48. data/lib/anthropic/models/beta/beta_citation_page_location.rb +7 -1
  49. data/lib/anthropic/models/beta/beta_citation_search_result_location.rb +55 -0
  50. data/lib/anthropic/models/beta/beta_citation_search_result_location_param.rb +55 -0
  51. data/lib/anthropic/models/beta/beta_citations_delta.rb +5 -3
  52. data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +40 -0
  53. data/lib/anthropic/models/beta/beta_content_block.rb +12 -5
  54. data/lib/anthropic/models/beta/beta_content_block_param.rb +28 -17
  55. data/lib/anthropic/models/beta/beta_document_block.rb +56 -0
  56. data/lib/anthropic/models/beta/beta_message.rb +6 -2
  57. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  58. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +14 -7
  59. data/lib/anthropic/models/beta/beta_request_document_block.rb +75 -0
  60. data/lib/anthropic/models/beta/beta_search_result_block_param.rb +55 -0
  61. data/lib/anthropic/models/beta/beta_server_tool_usage.rb +9 -1
  62. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +3 -0
  63. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +3 -0
  64. data/lib/anthropic/models/beta/beta_text_block.rb +2 -2
  65. data/lib/anthropic/models/beta/beta_text_block_param.rb +2 -2
  66. data/lib/anthropic/models/beta/beta_text_citation.rb +3 -1
  67. data/lib/anthropic/models/beta/beta_text_citation_param.rb +3 -1
  68. data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rb +25 -0
  69. data/lib/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rb +26 -0
  70. data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rb +49 -0
  71. data/lib/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rb +50 -0
  72. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rb +47 -0
  73. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rb +57 -0
  74. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rb +45 -0
  75. data/lib/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rb +46 -0
  76. data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rb +61 -0
  77. data/lib/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rb +62 -0
  78. data/lib/anthropic/models/beta/beta_tool.rb +7 -1
  79. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +8 -4
  80. data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +49 -0
  81. data/lib/anthropic/models/beta/beta_tool_union.rb +12 -6
  82. data/lib/anthropic/models/beta/beta_web_fetch_block.rb +42 -0
  83. data/lib/anthropic/models/beta/beta_web_fetch_block_param.rb +42 -0
  84. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +82 -0
  85. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block.rb +43 -0
  86. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rb +53 -0
  87. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rb +25 -0
  88. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rb +25 -0
  89. data/lib/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rb +25 -0
  90. data/lib/anthropic/models/beta/message_count_tokens_params.rb +23 -36
  91. data/lib/anthropic/models/beta/message_create_params.rb +10 -27
  92. data/lib/anthropic/models/beta/messages/batch_create_params.rb +13 -37
  93. data/lib/anthropic/models/beta/messages/beta_message_batch.rb +1 -4
  94. data/lib/anthropic/models/beta_error_response.rb +7 -1
  95. data/lib/anthropic/models/cache_control_ephemeral.rb +39 -1
  96. data/lib/anthropic/models/cache_creation.rb +24 -0
  97. data/lib/anthropic/models/citation_char_location.rb +7 -1
  98. data/lib/anthropic/models/citation_content_block_location.rb +7 -1
  99. data/lib/anthropic/models/citation_page_location.rb +7 -1
  100. data/lib/anthropic/models/citation_search_result_location_param.rb +51 -0
  101. data/lib/anthropic/models/citations_delta.rb +5 -3
  102. data/lib/anthropic/models/citations_search_result_location.rb +51 -0
  103. data/lib/anthropic/models/content_block.rb +5 -5
  104. data/lib/anthropic/models/content_block_param.rb +14 -11
  105. data/lib/anthropic/models/document_block_param.rb +2 -2
  106. data/lib/anthropic/models/error_response.rb +7 -1
  107. data/lib/anthropic/models/message.rb +6 -2
  108. data/lib/anthropic/models/message_count_tokens_params.rb +10 -27
  109. data/lib/anthropic/models/message_count_tokens_tool.rb +5 -1
  110. data/lib/anthropic/models/message_create_params.rb +10 -27
  111. data/lib/anthropic/models/message_param.rb +3 -3
  112. data/lib/anthropic/models/messages/batch_create_params.rb +11 -31
  113. data/lib/anthropic/models/model.rb +16 -21
  114. data/lib/anthropic/models/raw_content_block_start_event.rb +7 -7
  115. data/lib/anthropic/models/search_result_block_param.rb +51 -0
  116. data/lib/anthropic/models/text_block.rb +2 -2
  117. data/lib/anthropic/models/text_block_param.rb +2 -2
  118. data/lib/anthropic/models/text_citation.rb +3 -1
  119. data/lib/anthropic/models/text_citation_param.rb +3 -1
  120. data/lib/anthropic/models/tool.rb +7 -1
  121. data/lib/anthropic/models/tool_result_block_param.rb +8 -4
  122. data/lib/anthropic/models/tool_text_editor_20250429.rb +36 -0
  123. data/lib/anthropic/models/tool_text_editor_20250728.rb +45 -0
  124. data/lib/anthropic/models/tool_union.rb +5 -1
  125. data/lib/anthropic/models/tool_use_block.rb +14 -0
  126. data/lib/anthropic/models/usage.rb +9 -1
  127. data/lib/anthropic/models.rb +16 -4
  128. data/lib/anthropic/resources/beta/messages.rb +73 -6
  129. data/lib/anthropic/resources/messages.rb +152 -7
  130. data/lib/anthropic/streaming.rb +5 -0
  131. data/lib/anthropic/version.rb +1 -1
  132. data/lib/anthropic.rb +54 -0
  133. data/rbi/anthropic/errors.rbi +18 -2
  134. data/rbi/anthropic/helpers/bedrock/client.rbi +17 -6
  135. data/rbi/anthropic/helpers/input_schema/array_of.rbi +16 -0
  136. data/rbi/anthropic/helpers/input_schema/base_model.rbi +21 -0
  137. data/rbi/anthropic/helpers/input_schema/boolean.rbi +11 -0
  138. data/rbi/anthropic/helpers/input_schema/enum_of.rbi +30 -0
  139. data/rbi/anthropic/helpers/input_schema/json_schema_converter.rbi +89 -0
  140. data/rbi/anthropic/helpers/input_schema/union_of.rbi +23 -0
  141. data/rbi/anthropic/helpers/streaming/events.rbi +95 -0
  142. data/rbi/anthropic/helpers/streaming/message_stream.rbi +73 -0
  143. data/rbi/anthropic/helpers/structured_output.rbi +16 -0
  144. data/rbi/anthropic/helpers/vertex/client.rbi +17 -6
  145. data/rbi/anthropic/input_schema.rbi +12 -0
  146. data/rbi/anthropic/internal/transport/base_client.rbi +1 -1
  147. data/rbi/anthropic/internal/type/base_stream.rbi +8 -1
  148. data/rbi/anthropic/internal/type/boolean.rbi +2 -0
  149. data/rbi/anthropic/internal/type/converter.rbi +69 -15
  150. data/rbi/anthropic/internal/type/union.rbi +14 -2
  151. data/rbi/anthropic/internal/type/unknown.rbi +2 -0
  152. data/rbi/anthropic/internal/util.rbi +2 -0
  153. data/rbi/anthropic/models/anthropic_beta.rbi +2 -0
  154. data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +1 -128
  155. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block.rbi +33 -0
  156. data/rbi/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbi +34 -0
  157. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block.rbi +72 -0
  158. data/rbi/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbi +77 -0
  159. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbi +86 -0
  160. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbi +110 -0
  161. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbi +101 -0
  162. data/rbi/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbi +101 -0
  163. data/rbi/anthropic/models/beta/beta_citation_char_location.rbi +6 -0
  164. data/rbi/anthropic/models/beta/beta_citation_config.rbi +30 -0
  165. data/rbi/anthropic/models/beta/beta_citation_content_block_location.rbi +6 -0
  166. data/rbi/anthropic/models/beta/beta_citation_page_location.rbi +6 -0
  167. data/rbi/anthropic/models/beta/beta_citation_search_result_location.rbi +78 -0
  168. data/rbi/anthropic/models/beta/beta_citation_search_result_location_param.rbi +79 -0
  169. data/rbi/anthropic/models/beta/beta_citations_delta.rbi +4 -2
  170. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +72 -0
  171. data/rbi/anthropic/models/beta/beta_content_block.rbi +6 -3
  172. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +11 -7
  173. data/rbi/anthropic/models/beta/beta_document_block.rbi +95 -0
  174. data/rbi/anthropic/models/beta/beta_message.rbi +14 -3
  175. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +12 -6
  176. data/rbi/anthropic/models/beta/beta_request_document_block.rbi +142 -0
  177. data/rbi/anthropic/models/beta/beta_search_result_block_param.rbi +91 -0
  178. data/rbi/anthropic/models/beta/beta_server_tool_usage.rbi +17 -2
  179. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +15 -0
  180. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +15 -0
  181. data/rbi/anthropic/models/beta/beta_text_block.rbi +2 -1
  182. data/rbi/anthropic/models/beta/beta_text_block_param.rbi +6 -3
  183. data/rbi/anthropic/models/beta/beta_text_citation.rbi +2 -1
  184. data/rbi/anthropic/models/beta/beta_text_citation_param.rbi +2 -1
  185. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbi +41 -0
  186. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbi +41 -0
  187. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbi +73 -0
  188. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbi +73 -0
  189. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbi +90 -0
  190. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbi +118 -0
  191. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbi +110 -0
  192. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbi +110 -0
  193. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbi +118 -0
  194. data/rbi/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbi +118 -0
  195. data/rbi/anthropic/models/beta/beta_tool.rbi +14 -5
  196. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +3 -1
  197. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +82 -0
  198. data/rbi/anthropic/models/beta/beta_tool_union.rbi +7 -4
  199. data/rbi/anthropic/models/beta/beta_web_fetch_block.rbi +67 -0
  200. data/rbi/anthropic/models/beta/beta_web_fetch_block_param.rbi +71 -0
  201. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +125 -0
  202. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block.rbi +81 -0
  203. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbi +109 -0
  204. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbi +51 -0
  205. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbi +50 -0
  206. data/rbi/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbi +70 -0
  207. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +51 -70
  208. data/rbi/anthropic/models/beta/message_create_params.rbi +44 -66
  209. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +44 -66
  210. data/rbi/anthropic/models/beta_error_response.rbi +10 -2
  211. data/rbi/anthropic/models/cache_control_ephemeral.rbi +68 -3
  212. data/rbi/anthropic/models/cache_creation.rbi +45 -0
  213. data/rbi/anthropic/models/citation_char_location.rbi +6 -0
  214. data/rbi/anthropic/models/citation_content_block_location.rbi +6 -0
  215. data/rbi/anthropic/models/citation_page_location.rbi +6 -0
  216. data/rbi/anthropic/models/citation_search_result_location_param.rbi +74 -0
  217. data/rbi/anthropic/models/citations_delta.rbi +4 -2
  218. data/rbi/anthropic/models/citations_search_result_location.rbi +74 -0
  219. data/rbi/anthropic/models/content_block.rbi +3 -3
  220. data/rbi/anthropic/models/content_block_param.rbi +6 -5
  221. data/rbi/anthropic/models/document_block_param.rbi +7 -3
  222. data/rbi/anthropic/models/error_response.rbi +10 -2
  223. data/rbi/anthropic/models/message.rbi +11 -3
  224. data/rbi/anthropic/models/message_count_tokens_params.rbi +24 -50
  225. data/rbi/anthropic/models/message_count_tokens_tool.rbi +2 -0
  226. data/rbi/anthropic/models/message_create_params.rbi +24 -50
  227. data/rbi/anthropic/models/messages/batch_create_params.rbi +24 -50
  228. data/rbi/anthropic/models/model.rbi +4 -8
  229. data/rbi/anthropic/models/raw_content_block_start_event.rbi +6 -6
  230. data/rbi/anthropic/models/search_result_block_param.rbi +77 -0
  231. data/rbi/anthropic/models/text_block.rbi +2 -1
  232. data/rbi/anthropic/models/text_block_param.rbi +6 -3
  233. data/rbi/anthropic/models/text_citation.rbi +2 -1
  234. data/rbi/anthropic/models/text_citation_param.rbi +2 -1
  235. data/rbi/anthropic/models/tool.rbi +16 -5
  236. data/rbi/anthropic/models/tool_result_block_param.rbi +6 -1
  237. data/rbi/anthropic/models/tool_text_editor_20250429.rbi +62 -0
  238. data/rbi/anthropic/models/tool_text_editor_20250728.rbi +72 -0
  239. data/rbi/anthropic/models/tool_union.rbi +2 -0
  240. data/rbi/anthropic/models/usage.rbi +13 -0
  241. data/rbi/anthropic/models.rbi +14 -0
  242. data/rbi/anthropic/resources/beta/messages.rbi +45 -87
  243. data/rbi/anthropic/resources/messages.rbi +315 -69
  244. data/rbi/anthropic/streaming.rbi +5 -0
  245. data/sig/anthropic/errors.rbs +9 -0
  246. data/sig/anthropic/helpers/streaming/events.rbs +117 -0
  247. data/sig/anthropic/helpers/streaming/message_stream.rbs +57 -0
  248. data/sig/anthropic/internal/transport/base_client.rbs +1 -1
  249. data/sig/anthropic/internal/type/base_stream.rbs +4 -0
  250. data/sig/anthropic/internal/type/converter.rbs +24 -1
  251. data/sig/anthropic/internal/type/union.rbs +2 -2
  252. data/sig/anthropic/models/anthropic_beta.rbs +2 -0
  253. data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +1 -58
  254. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block.rbs +23 -0
  255. data/sig/anthropic/models/beta/beta_bash_code_execution_output_block_param.rbs +23 -0
  256. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block.rbs +44 -0
  257. data/sig/anthropic/models/beta/beta_bash_code_execution_result_block_param.rbs +44 -0
  258. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block.rbs +44 -0
  259. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_block_param.rbs +49 -0
  260. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error.rbs +48 -0
  261. data/sig/anthropic/models/beta/beta_bash_code_execution_tool_result_error_param.rbs +48 -0
  262. data/sig/anthropic/models/beta/beta_citation_char_location.rbs +5 -0
  263. data/sig/anthropic/models/beta/beta_citation_config.rbs +17 -0
  264. data/sig/anthropic/models/beta/beta_citation_content_block_location.rbs +5 -0
  265. data/sig/anthropic/models/beta/beta_citation_page_location.rbs +5 -0
  266. data/sig/anthropic/models/beta/beta_citation_search_result_location.rbs +54 -0
  267. data/sig/anthropic/models/beta/beta_citation_search_result_location_param.rbs +54 -0
  268. data/sig/anthropic/models/beta/beta_citations_delta.rbs +1 -0
  269. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +34 -0
  270. data/sig/anthropic/models/beta/beta_content_block.rbs +5 -2
  271. data/sig/anthropic/models/beta/beta_content_block_param.rbs +12 -8
  272. data/sig/anthropic/models/beta/beta_document_block.rbs +49 -0
  273. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +5 -2
  274. data/sig/anthropic/models/beta/beta_request_document_block.rbs +62 -0
  275. data/sig/anthropic/models/beta/beta_search_result_block_param.rbs +53 -0
  276. data/sig/anthropic/models/beta/beta_server_tool_usage.rbs +12 -3
  277. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +9 -1
  278. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +9 -1
  279. data/sig/anthropic/models/beta/beta_text_citation.rbs +1 -0
  280. data/sig/anthropic/models/beta/beta_text_citation_param.rbs +1 -0
  281. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block.rbs +29 -0
  282. data/sig/anthropic/models/beta/beta_text_editor_code_execution_create_result_block_param.rbs +29 -0
  283. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block.rbs +49 -0
  284. data/sig/anthropic/models/beta/beta_text_editor_code_execution_str_replace_result_block_param.rbs +49 -0
  285. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block.rbs +46 -0
  286. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_block_param.rbs +51 -0
  287. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error.rbs +53 -0
  288. data/sig/anthropic/models/beta/beta_text_editor_code_execution_tool_result_error_param.rbs +53 -0
  289. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block.rbs +61 -0
  290. data/sig/anthropic/models/beta/beta_text_editor_code_execution_view_result_block_param.rbs +61 -0
  291. data/sig/anthropic/models/beta/beta_tool.rbs +14 -3
  292. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +2 -0
  293. data/sig/anthropic/models/beta/beta_tool_text_editor_20250728.rbs +39 -0
  294. data/sig/anthropic/models/beta/beta_tool_union.rbs +7 -4
  295. data/sig/anthropic/models/beta/beta_web_fetch_block.rbs +39 -0
  296. data/sig/anthropic/models/beta/beta_web_fetch_block_param.rbs +39 -0
  297. data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +59 -0
  298. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block.rbs +44 -0
  299. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_block_param.rbs +49 -0
  300. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block.rbs +29 -0
  301. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_block_param.rbs +29 -0
  302. data/sig/anthropic/models/beta/beta_web_fetch_tool_result_error_code.rbs +32 -0
  303. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +7 -4
  304. data/sig/anthropic/models/beta_error_response.rbs +13 -2
  305. data/sig/anthropic/models/cache_control_ephemeral.rbs +27 -3
  306. data/sig/anthropic/models/cache_creation.rbs +25 -0
  307. data/sig/anthropic/models/citation_char_location.rbs +5 -0
  308. data/sig/anthropic/models/citation_content_block_location.rbs +5 -0
  309. data/sig/anthropic/models/citation_page_location.rbs +5 -0
  310. data/sig/anthropic/models/citation_search_result_location_param.rbs +50 -0
  311. data/sig/anthropic/models/citations_delta.rbs +1 -0
  312. data/sig/anthropic/models/citations_search_result_location.rbs +50 -0
  313. data/sig/anthropic/models/content_block.rbs +2 -2
  314. data/sig/anthropic/models/content_block_param.rbs +6 -5
  315. data/sig/anthropic/models/document_block_param.rbs +4 -8
  316. data/sig/anthropic/models/error_response.rbs +13 -2
  317. data/sig/anthropic/models/message_count_tokens_tool.rbs +2 -0
  318. data/sig/anthropic/models/model.rbs +4 -10
  319. data/sig/anthropic/models/raw_content_block_start_event.rbs +2 -2
  320. data/sig/anthropic/models/search_result_block_param.rbs +49 -0
  321. data/sig/anthropic/models/text_citation.rbs +1 -0
  322. data/sig/anthropic/models/text_citation_param.rbs +1 -0
  323. data/sig/anthropic/models/tool.rbs +14 -3
  324. data/sig/anthropic/models/tool_result_block_param.rbs +5 -1
  325. data/sig/anthropic/models/tool_text_editor_20250429.rbs +30 -0
  326. data/sig/anthropic/models/tool_text_editor_20250728.rbs +35 -0
  327. data/sig/anthropic/models/tool_union.rbs +2 -0
  328. data/sig/anthropic/models/usage.rbs +5 -0
  329. data/sig/anthropic/models.rbs +12 -0
  330. data/sig/anthropic/streaming.rbs +3 -0
  331. metadata +152 -3
@@ -72,37 +72,14 @@ 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
102
79
  # the top-level `system` parameter — there is no `"system"` role for input
103
80
  # messages in the Messages API.
104
81
  #
105
- # There is a limit of 100000 messages in a single request.
82
+ # There is a limit of 100,000 messages in a single request.
106
83
  sig { returns(T::Array[Anthropic::Beta::BetaMessageParam]) }
107
84
  attr_accessor :messages
108
85
 
@@ -221,6 +198,12 @@ module Anthropic
221
198
  # those tools using the tool input generated by the model and then optionally
222
199
  # return results back to the model using `tool_result` content blocks.
223
200
  #
201
+ # There are two types of tools: **client tools** and **server tools**. The
202
+ # behavior described below applies to client tools. For
203
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
204
+ # see their individual documentation as each has its own behavior (e.g., the
205
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
206
+ #
224
207
  # Each tool definition includes:
225
208
  #
226
209
  # - `name`: Name of the tool.
@@ -289,15 +272,18 @@ module Anthropic
289
272
  T::Array[
290
273
  T.any(
291
274
  Anthropic::Beta::BetaTool,
292
- Anthropic::Beta::BetaToolComputerUse20241022,
293
275
  Anthropic::Beta::BetaToolBash20241022,
294
- Anthropic::Beta::BetaToolTextEditor20241022,
295
- Anthropic::Beta::BetaToolComputerUse20250124,
296
276
  Anthropic::Beta::BetaToolBash20250124,
277
+ Anthropic::Beta::BetaCodeExecutionTool20250522,
278
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
279
+ Anthropic::Beta::BetaToolComputerUse20241022,
280
+ Anthropic::Beta::BetaToolComputerUse20250124,
281
+ Anthropic::Beta::BetaToolTextEditor20241022,
297
282
  Anthropic::Beta::BetaToolTextEditor20250124,
298
283
  Anthropic::Beta::BetaToolTextEditor20250429,
284
+ Anthropic::Beta::BetaToolTextEditor20250728,
299
285
  Anthropic::Beta::BetaWebSearchTool20250305,
300
- Anthropic::Beta::BetaCodeExecutionTool20250522
286
+ Anthropic::Beta::BetaWebFetchTool20250910
301
287
  )
302
288
  ]
303
289
  )
@@ -311,15 +297,18 @@ module Anthropic
311
297
  T::Array[
312
298
  T.any(
313
299
  Anthropic::Beta::BetaTool::OrHash,
314
- Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
315
300
  Anthropic::Beta::BetaToolBash20241022::OrHash,
316
- Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
317
- Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
318
301
  Anthropic::Beta::BetaToolBash20250124::OrHash,
302
+ Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
303
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
304
+ Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
305
+ Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
306
+ Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
319
307
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
320
308
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
309
+ Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
321
310
  Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
322
- Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash
311
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
323
312
  )
324
313
  ]
325
314
  ).void
@@ -369,15 +358,18 @@ module Anthropic
369
358
  T::Array[
370
359
  T.any(
371
360
  Anthropic::Beta::BetaTool::OrHash,
372
- Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
373
361
  Anthropic::Beta::BetaToolBash20241022::OrHash,
374
- Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
375
- Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
376
362
  Anthropic::Beta::BetaToolBash20250124::OrHash,
363
+ Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
364
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
365
+ Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
366
+ Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
367
+ Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
377
368
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
378
369
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
370
+ Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
379
371
  Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
380
- Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash
372
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
381
373
  )
382
374
  ],
383
375
  betas: T::Array[T.any(String, Anthropic::AnthropicBeta::OrSymbol)],
@@ -442,37 +434,14 @@ module Anthropic
442
434
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
443
435
  # ```
444
436
  #
445
- # Starting with Claude 3 models, you can also send image content blocks:
446
- #
447
- # ```json
448
- # {
449
- # "role": "user",
450
- # "content": [
451
- # {
452
- # "type": "image",
453
- # "source": {
454
- # "type": "base64",
455
- # "media_type": "image/jpeg",
456
- # "data": "/9j/4AAQSkZJRg..."
457
- # }
458
- # },
459
- # { "type": "text", "text": "What is in this image?" }
460
- # ]
461
- # }
462
- # ```
463
- #
464
- # We currently support the `base64` source type for images, and the `image/jpeg`,
465
- # `image/png`, `image/gif`, and `image/webp` media types.
466
- #
467
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
468
- # more input examples.
437
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
469
438
  #
470
439
  # Note that if you want to include a
471
440
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
472
441
  # the top-level `system` parameter — there is no `"system"` role for input
473
442
  # messages in the Messages API.
474
443
  #
475
- # There is a limit of 100000 messages in a single request.
444
+ # There is a limit of 100,000 messages in a single request.
476
445
  messages:,
477
446
  # The model that will complete your prompt.\n\nSee
478
447
  # [models](https://docs.anthropic.com/en/docs/models-overview) for additional
@@ -506,6 +475,12 @@ module Anthropic
506
475
  # those tools using the tool input generated by the model and then optionally
507
476
  # return results back to the model using `tool_result` content blocks.
508
477
  #
478
+ # There are two types of tools: **client tools** and **server tools**. The
479
+ # behavior described below applies to client tools. For
480
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
481
+ # see their individual documentation as each has its own behavior (e.g., the
482
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
483
+ #
509
484
  # Each tool definition includes:
510
485
  #
511
486
  # - `name`: Name of the tool.
@@ -600,15 +575,18 @@ module Anthropic
600
575
  T::Array[
601
576
  T.any(
602
577
  Anthropic::Beta::BetaTool,
603
- Anthropic::Beta::BetaToolComputerUse20241022,
604
578
  Anthropic::Beta::BetaToolBash20241022,
605
- Anthropic::Beta::BetaToolTextEditor20241022,
606
- Anthropic::Beta::BetaToolComputerUse20250124,
607
579
  Anthropic::Beta::BetaToolBash20250124,
580
+ Anthropic::Beta::BetaCodeExecutionTool20250522,
581
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
582
+ Anthropic::Beta::BetaToolComputerUse20241022,
583
+ Anthropic::Beta::BetaToolComputerUse20250124,
584
+ Anthropic::Beta::BetaToolTextEditor20241022,
608
585
  Anthropic::Beta::BetaToolTextEditor20250124,
609
586
  Anthropic::Beta::BetaToolTextEditor20250429,
587
+ Anthropic::Beta::BetaToolTextEditor20250728,
610
588
  Anthropic::Beta::BetaWebSearchTool20250305,
611
- Anthropic::Beta::BetaCodeExecutionTool20250522
589
+ Anthropic::Beta::BetaWebFetchTool20250910
612
590
  )
613
591
  ],
614
592
  betas:
@@ -659,15 +637,18 @@ module Anthropic
659
637
  T.type_alias do
660
638
  T.any(
661
639
  Anthropic::Beta::BetaTool,
662
- Anthropic::Beta::BetaToolComputerUse20241022,
663
640
  Anthropic::Beta::BetaToolBash20241022,
664
- Anthropic::Beta::BetaToolTextEditor20241022,
665
- Anthropic::Beta::BetaToolComputerUse20250124,
666
641
  Anthropic::Beta::BetaToolBash20250124,
642
+ Anthropic::Beta::BetaCodeExecutionTool20250522,
643
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
644
+ Anthropic::Beta::BetaToolComputerUse20241022,
645
+ Anthropic::Beta::BetaToolComputerUse20250124,
646
+ Anthropic::Beta::BetaToolTextEditor20241022,
667
647
  Anthropic::Beta::BetaToolTextEditor20250124,
668
648
  Anthropic::Beta::BetaToolTextEditor20250429,
649
+ Anthropic::Beta::BetaToolTextEditor20250728,
669
650
  Anthropic::Beta::BetaWebSearchTool20250305,
670
- Anthropic::Beta::BetaCodeExecutionTool20250522
651
+ Anthropic::Beta::BetaWebFetchTool20250910
671
652
  )
672
653
  end
673
654
 
@@ -82,37 +82,14 @@ 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
112
89
  # the top-level `system` parameter — there is no `"system"` role for input
113
90
  # messages in the Messages API.
114
91
  #
115
- # There is a limit of 100000 messages in a single request.
92
+ # There is a limit of 100,000 messages in a single request.
116
93
  sig { returns(T::Array[Anthropic::Beta::BetaMessageParam]) }
117
94
  attr_accessor :messages
118
95
 
@@ -291,6 +268,12 @@ module Anthropic
291
268
  # those tools using the tool input generated by the model and then optionally
292
269
  # return results back to the model using `tool_result` content blocks.
293
270
  #
271
+ # There are two types of tools: **client tools** and **server tools**. The
272
+ # behavior described below applies to client tools. For
273
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
274
+ # see their individual documentation as each has its own behavior (e.g., the
275
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
276
+ #
294
277
  # Each tool definition includes:
295
278
  #
296
279
  # - `name`: Name of the tool.
@@ -359,15 +342,18 @@ module Anthropic
359
342
  T::Array[
360
343
  T.any(
361
344
  Anthropic::Beta::BetaTool,
362
- Anthropic::Beta::BetaToolComputerUse20241022,
363
345
  Anthropic::Beta::BetaToolBash20241022,
364
- Anthropic::Beta::BetaToolTextEditor20241022,
365
- Anthropic::Beta::BetaToolComputerUse20250124,
366
346
  Anthropic::Beta::BetaToolBash20250124,
347
+ Anthropic::Beta::BetaCodeExecutionTool20250522,
348
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
349
+ Anthropic::Beta::BetaToolComputerUse20241022,
350
+ Anthropic::Beta::BetaToolComputerUse20250124,
351
+ Anthropic::Beta::BetaToolTextEditor20241022,
367
352
  Anthropic::Beta::BetaToolTextEditor20250124,
368
353
  Anthropic::Beta::BetaToolTextEditor20250429,
354
+ Anthropic::Beta::BetaToolTextEditor20250728,
369
355
  Anthropic::Beta::BetaWebSearchTool20250305,
370
- Anthropic::Beta::BetaCodeExecutionTool20250522
356
+ Anthropic::Beta::BetaWebFetchTool20250910
371
357
  )
372
358
  ]
373
359
  )
@@ -381,15 +367,18 @@ module Anthropic
381
367
  T::Array[
382
368
  T.any(
383
369
  Anthropic::Beta::BetaTool::OrHash,
384
- Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
385
370
  Anthropic::Beta::BetaToolBash20241022::OrHash,
386
- Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
387
- Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
388
371
  Anthropic::Beta::BetaToolBash20250124::OrHash,
372
+ Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
373
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
374
+ Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
375
+ Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
376
+ Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
389
377
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
390
378
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
379
+ Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
391
380
  Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
392
- Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash
381
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
393
382
  )
394
383
  ]
395
384
  ).void
@@ -473,15 +462,18 @@ module Anthropic
473
462
  T::Array[
474
463
  T.any(
475
464
  Anthropic::Beta::BetaTool::OrHash,
476
- Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
477
465
  Anthropic::Beta::BetaToolBash20241022::OrHash,
478
- Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
479
- Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
480
466
  Anthropic::Beta::BetaToolBash20250124::OrHash,
467
+ Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
468
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
469
+ Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
470
+ Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
471
+ Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
481
472
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
482
473
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
474
+ Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
483
475
  Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
484
- Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash
476
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
485
477
  )
486
478
  ],
487
479
  top_k: Integer,
@@ -556,37 +548,14 @@ module Anthropic
556
548
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
557
549
  # ```
558
550
  #
559
- # Starting with Claude 3 models, you can also send image content blocks:
560
- #
561
- # ```json
562
- # {
563
- # "role": "user",
564
- # "content": [
565
- # {
566
- # "type": "image",
567
- # "source": {
568
- # "type": "base64",
569
- # "media_type": "image/jpeg",
570
- # "data": "/9j/4AAQSkZJRg..."
571
- # }
572
- # },
573
- # { "type": "text", "text": "What is in this image?" }
574
- # ]
575
- # }
576
- # ```
577
- #
578
- # We currently support the `base64` source type for images, and the `image/jpeg`,
579
- # `image/png`, `image/gif`, and `image/webp` media types.
580
- #
581
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
582
- # more input examples.
551
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
583
552
  #
584
553
  # Note that if you want to include a
585
554
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
586
555
  # the top-level `system` parameter — there is no `"system"` role for input
587
556
  # messages in the Messages API.
588
557
  #
589
- # There is a limit of 100000 messages in a single request.
558
+ # There is a limit of 100,000 messages in a single request.
590
559
  messages:,
591
560
  # The model that will complete your prompt.\n\nSee
592
561
  # [models](https://docs.anthropic.com/en/docs/models-overview) for additional
@@ -649,6 +618,12 @@ module Anthropic
649
618
  # those tools using the tool input generated by the model and then optionally
650
619
  # return results back to the model using `tool_result` content blocks.
651
620
  #
621
+ # There are two types of tools: **client tools** and **server tools**. The
622
+ # behavior described below applies to client tools. For
623
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
624
+ # see their individual documentation as each has its own behavior (e.g., the
625
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
626
+ #
652
627
  # Each tool definition includes:
653
628
  #
654
629
  # - `name`: Name of the tool.
@@ -767,15 +742,18 @@ module Anthropic
767
742
  T::Array[
768
743
  T.any(
769
744
  Anthropic::Beta::BetaTool,
770
- Anthropic::Beta::BetaToolComputerUse20241022,
771
745
  Anthropic::Beta::BetaToolBash20241022,
772
- Anthropic::Beta::BetaToolTextEditor20241022,
773
- Anthropic::Beta::BetaToolComputerUse20250124,
774
746
  Anthropic::Beta::BetaToolBash20250124,
747
+ Anthropic::Beta::BetaCodeExecutionTool20250522,
748
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
749
+ Anthropic::Beta::BetaToolComputerUse20241022,
750
+ Anthropic::Beta::BetaToolComputerUse20250124,
751
+ Anthropic::Beta::BetaToolTextEditor20241022,
775
752
  Anthropic::Beta::BetaToolTextEditor20250124,
776
753
  Anthropic::Beta::BetaToolTextEditor20250429,
754
+ Anthropic::Beta::BetaToolTextEditor20250728,
777
755
  Anthropic::Beta::BetaWebSearchTool20250305,
778
- Anthropic::Beta::BetaCodeExecutionTool20250522
756
+ Anthropic::Beta::BetaWebFetchTool20250910
779
757
  )
780
758
  ],
781
759
  top_k: Integer,
@@ -223,37 +223,14 @@ 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
253
230
  # the top-level `system` parameter — there is no `"system"` role for input
254
231
  # messages in the Messages API.
255
232
  #
256
- # There is a limit of 100000 messages in a single request.
233
+ # There is a limit of 100,000 messages in a single request.
257
234
  sig { returns(T::Array[Anthropic::Beta::BetaMessageParam]) }
258
235
  attr_accessor :messages
259
236
 
@@ -447,6 +424,12 @@ module Anthropic
447
424
  # those tools using the tool input generated by the model and then optionally
448
425
  # return results back to the model using `tool_result` content blocks.
449
426
  #
427
+ # There are two types of tools: **client tools** and **server tools**. The
428
+ # behavior described below applies to client tools. For
429
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
430
+ # see their individual documentation as each has its own behavior (e.g., the
431
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
432
+ #
450
433
  # Each tool definition includes:
451
434
  #
452
435
  # - `name`: Name of the tool.
@@ -515,15 +498,18 @@ module Anthropic
515
498
  T::Array[
516
499
  T.any(
517
500
  Anthropic::Beta::BetaTool,
518
- Anthropic::Beta::BetaToolComputerUse20241022,
519
501
  Anthropic::Beta::BetaToolBash20241022,
520
- Anthropic::Beta::BetaToolTextEditor20241022,
521
- Anthropic::Beta::BetaToolComputerUse20250124,
522
502
  Anthropic::Beta::BetaToolBash20250124,
503
+ Anthropic::Beta::BetaCodeExecutionTool20250522,
504
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
505
+ Anthropic::Beta::BetaToolComputerUse20241022,
506
+ Anthropic::Beta::BetaToolComputerUse20250124,
507
+ Anthropic::Beta::BetaToolTextEditor20241022,
523
508
  Anthropic::Beta::BetaToolTextEditor20250124,
524
509
  Anthropic::Beta::BetaToolTextEditor20250429,
510
+ Anthropic::Beta::BetaToolTextEditor20250728,
525
511
  Anthropic::Beta::BetaWebSearchTool20250305,
526
- Anthropic::Beta::BetaCodeExecutionTool20250522
512
+ Anthropic::Beta::BetaWebFetchTool20250910
527
513
  )
528
514
  ]
529
515
  )
@@ -537,15 +523,18 @@ module Anthropic
537
523
  T::Array[
538
524
  T.any(
539
525
  Anthropic::Beta::BetaTool::OrHash,
540
- Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
541
526
  Anthropic::Beta::BetaToolBash20241022::OrHash,
542
- Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
543
- Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
544
527
  Anthropic::Beta::BetaToolBash20250124::OrHash,
528
+ Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
529
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
530
+ Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
531
+ Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
532
+ Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
545
533
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
546
534
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
535
+ Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
547
536
  Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
548
- Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash
537
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
549
538
  )
550
539
  ]
551
540
  ).void
@@ -618,15 +607,18 @@ module Anthropic
618
607
  T::Array[
619
608
  T.any(
620
609
  Anthropic::Beta::BetaTool::OrHash,
621
- Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
622
610
  Anthropic::Beta::BetaToolBash20241022::OrHash,
623
- Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
624
- Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
625
611
  Anthropic::Beta::BetaToolBash20250124::OrHash,
612
+ Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash,
613
+ Anthropic::Beta::BetaCodeExecutionTool20250825::OrHash,
614
+ Anthropic::Beta::BetaToolComputerUse20241022::OrHash,
615
+ Anthropic::Beta::BetaToolComputerUse20250124::OrHash,
616
+ Anthropic::Beta::BetaToolTextEditor20241022::OrHash,
626
617
  Anthropic::Beta::BetaToolTextEditor20250124::OrHash,
627
618
  Anthropic::Beta::BetaToolTextEditor20250429::OrHash,
619
+ Anthropic::Beta::BetaToolTextEditor20250728::OrHash,
628
620
  Anthropic::Beta::BetaWebSearchTool20250305::OrHash,
629
- Anthropic::Beta::BetaCodeExecutionTool20250522::OrHash
621
+ Anthropic::Beta::BetaWebFetchTool20250910::OrHash
630
622
  )
631
623
  ],
632
624
  top_k: Integer,
@@ -699,37 +691,14 @@ module Anthropic
699
691
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
700
692
  # ```
701
693
  #
702
- # Starting with Claude 3 models, you can also send image content blocks:
703
- #
704
- # ```json
705
- # {
706
- # "role": "user",
707
- # "content": [
708
- # {
709
- # "type": "image",
710
- # "source": {
711
- # "type": "base64",
712
- # "media_type": "image/jpeg",
713
- # "data": "/9j/4AAQSkZJRg..."
714
- # }
715
- # },
716
- # { "type": "text", "text": "What is in this image?" }
717
- # ]
718
- # }
719
- # ```
720
- #
721
- # We currently support the `base64` source type for images, and the `image/jpeg`,
722
- # `image/png`, `image/gif`, and `image/webp` media types.
723
- #
724
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
725
- # more input examples.
694
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
726
695
  #
727
696
  # Note that if you want to include a
728
697
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
729
698
  # the top-level `system` parameter — there is no `"system"` role for input
730
699
  # messages in the Messages API.
731
700
  #
732
- # There is a limit of 100000 messages in a single request.
701
+ # There is a limit of 100,000 messages in a single request.
733
702
  messages:,
734
703
  # The model that will complete your prompt.\n\nSee
735
704
  # [models](https://docs.anthropic.com/en/docs/models-overview) for additional
@@ -797,6 +766,12 @@ module Anthropic
797
766
  # those tools using the tool input generated by the model and then optionally
798
767
  # return results back to the model using `tool_result` content blocks.
799
768
  #
769
+ # There are two types of tools: **client tools** and **server tools**. The
770
+ # behavior described below applies to client tools. For
771
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
772
+ # see their individual documentation as each has its own behavior (e.g., the
773
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
774
+ #
800
775
  # Each tool definition includes:
801
776
  #
802
777
  # - `name`: Name of the tool.
@@ -916,15 +891,18 @@ module Anthropic
916
891
  T::Array[
917
892
  T.any(
918
893
  Anthropic::Beta::BetaTool,
919
- Anthropic::Beta::BetaToolComputerUse20241022,
920
894
  Anthropic::Beta::BetaToolBash20241022,
921
- Anthropic::Beta::BetaToolTextEditor20241022,
922
- Anthropic::Beta::BetaToolComputerUse20250124,
923
895
  Anthropic::Beta::BetaToolBash20250124,
896
+ Anthropic::Beta::BetaCodeExecutionTool20250522,
897
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
898
+ Anthropic::Beta::BetaToolComputerUse20241022,
899
+ Anthropic::Beta::BetaToolComputerUse20250124,
900
+ Anthropic::Beta::BetaToolTextEditor20241022,
924
901
  Anthropic::Beta::BetaToolTextEditor20250124,
925
902
  Anthropic::Beta::BetaToolTextEditor20250429,
903
+ Anthropic::Beta::BetaToolTextEditor20250728,
926
904
  Anthropic::Beta::BetaWebSearchTool20250305,
927
- Anthropic::Beta::BetaCodeExecutionTool20250522
905
+ Anthropic::Beta::BetaWebFetchTool20250910
928
906
  )
929
907
  ],
930
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