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
@@ -78,37 +78,14 @@ 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
108
85
  # the top-level `system` parameter — there is no `"system"` role for input
109
86
  # messages in the Messages API.
110
87
  #
111
- # There is a limit of 100000 messages in a single request.
88
+ # There is a limit of 100,000 messages in a single request.
112
89
  sig { returns(T::Array[Anthropic::MessageParam]) }
113
90
  attr_accessor :messages
114
91
 
@@ -256,6 +233,12 @@ module Anthropic
256
233
  # those tools using the tool input generated by the model and then optionally
257
234
  # return results back to the model using `tool_result` content blocks.
258
235
  #
236
+ # There are two types of tools: **client tools** and **server tools**. The
237
+ # behavior described below applies to client tools. For
238
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
239
+ # see their individual documentation as each has its own behavior (e.g., the
240
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
241
+ #
259
242
  # Each tool definition includes:
260
243
  #
261
244
  # - `name`: Name of the tool.
@@ -326,6 +309,8 @@ module Anthropic
326
309
  Anthropic::Tool,
327
310
  Anthropic::ToolBash20250124,
328
311
  Anthropic::ToolTextEditor20250124,
312
+ Anthropic::ToolTextEditor20250429,
313
+ Anthropic::ToolTextEditor20250728,
329
314
  Anthropic::WebSearchTool20250305
330
315
  )
331
316
  ]
@@ -342,6 +327,8 @@ module Anthropic
342
327
  Anthropic::Tool::OrHash,
343
328
  Anthropic::ToolBash20250124::OrHash,
344
329
  Anthropic::ToolTextEditor20250124::OrHash,
330
+ Anthropic::ToolTextEditor20250429::OrHash,
331
+ Anthropic::ToolTextEditor20250728::OrHash,
345
332
  Anthropic::WebSearchTool20250305::OrHash
346
333
  )
347
334
  ]
@@ -405,6 +392,8 @@ module Anthropic
405
392
  Anthropic::Tool::OrHash,
406
393
  Anthropic::ToolBash20250124::OrHash,
407
394
  Anthropic::ToolTextEditor20250124::OrHash,
395
+ Anthropic::ToolTextEditor20250429::OrHash,
396
+ Anthropic::ToolTextEditor20250728::OrHash,
408
397
  Anthropic::WebSearchTool20250305::OrHash
409
398
  )
410
399
  ],
@@ -479,37 +468,14 @@ module Anthropic
479
468
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
480
469
  # ```
481
470
  #
482
- # Starting with Claude 3 models, you can also send image content blocks:
483
- #
484
- # ```json
485
- # {
486
- # "role": "user",
487
- # "content": [
488
- # {
489
- # "type": "image",
490
- # "source": {
491
- # "type": "base64",
492
- # "media_type": "image/jpeg",
493
- # "data": "/9j/4AAQSkZJRg..."
494
- # }
495
- # },
496
- # { "type": "text", "text": "What is in this image?" }
497
- # ]
498
- # }
499
- # ```
500
- #
501
- # We currently support the `base64` source type for images, and the `image/jpeg`,
502
- # `image/png`, `image/gif`, and `image/webp` media types.
503
- #
504
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
505
- # more input examples.
471
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
506
472
  #
507
473
  # Note that if you want to include a
508
474
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
509
475
  # the top-level `system` parameter — there is no `"system"` role for input
510
476
  # messages in the Messages API.
511
477
  #
512
- # There is a limit of 100000 messages in a single request.
478
+ # There is a limit of 100,000 messages in a single request.
513
479
  messages:,
514
480
  # The model that will complete your prompt.\n\nSee
515
481
  # [models](https://docs.anthropic.com/en/docs/models-overview) for additional
@@ -568,6 +534,12 @@ module Anthropic
568
534
  # those tools using the tool input generated by the model and then optionally
569
535
  # return results back to the model using `tool_result` content blocks.
570
536
  #
537
+ # There are two types of tools: **client tools** and **server tools**. The
538
+ # behavior described below applies to client tools. For
539
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
540
+ # see their individual documentation as each has its own behavior (e.g., the
541
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
542
+ #
571
543
  # Each tool definition includes:
572
544
  #
573
545
  # - `name`: Name of the tool.
@@ -682,6 +654,8 @@ module Anthropic
682
654
  Anthropic::Tool,
683
655
  Anthropic::ToolBash20250124,
684
656
  Anthropic::ToolTextEditor20250124,
657
+ Anthropic::ToolTextEditor20250429,
658
+ Anthropic::ToolTextEditor20250728,
685
659
  Anthropic::WebSearchTool20250305
686
660
  )
687
661
  ],
@@ -190,37 +190,14 @@ module Anthropic
190
190
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
191
191
  # ```
192
192
  #
193
- # Starting with Claude 3 models, you can also send image content blocks:
194
- #
195
- # ```json
196
- # {
197
- # "role": "user",
198
- # "content": [
199
- # {
200
- # "type": "image",
201
- # "source": {
202
- # "type": "base64",
203
- # "media_type": "image/jpeg",
204
- # "data": "/9j/4AAQSkZJRg..."
205
- # }
206
- # },
207
- # { "type": "text", "text": "What is in this image?" }
208
- # ]
209
- # }
210
- # ```
211
- #
212
- # We currently support the `base64` source type for images, and the `image/jpeg`,
213
- # `image/png`, `image/gif`, and `image/webp` media types.
214
- #
215
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
216
- # more input examples.
193
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
217
194
  #
218
195
  # Note that if you want to include a
219
196
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
220
197
  # the top-level `system` parameter — there is no `"system"` role for input
221
198
  # messages in the Messages API.
222
199
  #
223
- # There is a limit of 100000 messages in a single request.
200
+ # There is a limit of 100,000 messages in a single request.
224
201
  sig { returns(T::Array[Anthropic::MessageParam]) }
225
202
  attr_accessor :messages
226
203
 
@@ -388,6 +365,12 @@ module Anthropic
388
365
  # those tools using the tool input generated by the model and then optionally
389
366
  # return results back to the model using `tool_result` content blocks.
390
367
  #
368
+ # There are two types of tools: **client tools** and **server tools**. The
369
+ # behavior described below applies to client tools. For
370
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
371
+ # see their individual documentation as each has its own behavior (e.g., the
372
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
373
+ #
391
374
  # Each tool definition includes:
392
375
  #
393
376
  # - `name`: Name of the tool.
@@ -458,6 +441,8 @@ module Anthropic
458
441
  Anthropic::Tool,
459
442
  Anthropic::ToolBash20250124,
460
443
  Anthropic::ToolTextEditor20250124,
444
+ Anthropic::ToolTextEditor20250429,
445
+ Anthropic::ToolTextEditor20250728,
461
446
  Anthropic::WebSearchTool20250305
462
447
  )
463
448
  ]
@@ -474,6 +459,8 @@ module Anthropic
474
459
  Anthropic::Tool::OrHash,
475
460
  Anthropic::ToolBash20250124::OrHash,
476
461
  Anthropic::ToolTextEditor20250124::OrHash,
462
+ Anthropic::ToolTextEditor20250429::OrHash,
463
+ Anthropic::ToolTextEditor20250728::OrHash,
477
464
  Anthropic::WebSearchTool20250305::OrHash
478
465
  )
479
466
  ]
@@ -544,6 +531,8 @@ module Anthropic
544
531
  Anthropic::Tool::OrHash,
545
532
  Anthropic::ToolBash20250124::OrHash,
546
533
  Anthropic::ToolTextEditor20250124::OrHash,
534
+ Anthropic::ToolTextEditor20250429::OrHash,
535
+ Anthropic::ToolTextEditor20250728::OrHash,
547
536
  Anthropic::WebSearchTool20250305::OrHash
548
537
  )
549
538
  ],
@@ -617,37 +606,14 @@ module Anthropic
617
606
  # { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
618
607
  # ```
619
608
  #
620
- # Starting with Claude 3 models, you can also send image content blocks:
621
- #
622
- # ```json
623
- # {
624
- # "role": "user",
625
- # "content": [
626
- # {
627
- # "type": "image",
628
- # "source": {
629
- # "type": "base64",
630
- # "media_type": "image/jpeg",
631
- # "data": "/9j/4AAQSkZJRg..."
632
- # }
633
- # },
634
- # { "type": "text", "text": "What is in this image?" }
635
- # ]
636
- # }
637
- # ```
638
- #
639
- # We currently support the `base64` source type for images, and the `image/jpeg`,
640
- # `image/png`, `image/gif`, and `image/webp` media types.
641
- #
642
- # See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
643
- # more input examples.
609
+ # See [input examples](https://docs.anthropic.com/en/api/messages-examples).
644
610
  #
645
611
  # Note that if you want to include a
646
612
  # [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
647
613
  # the top-level `system` parameter — there is no `"system"` role for input
648
614
  # messages in the Messages API.
649
615
  #
650
- # There is a limit of 100000 messages in a single request.
616
+ # There is a limit of 100,000 messages in a single request.
651
617
  messages:,
652
618
  # The model that will complete your prompt.\n\nSee
653
619
  # [models](https://docs.anthropic.com/en/docs/models-overview) for additional
@@ -711,6 +677,12 @@ module Anthropic
711
677
  # those tools using the tool input generated by the model and then optionally
712
678
  # return results back to the model using `tool_result` content blocks.
713
679
  #
680
+ # There are two types of tools: **client tools** and **server tools**. The
681
+ # behavior described below applies to client tools. For
682
+ # [server tools](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview#server-tools),
683
+ # see their individual documentation as each has its own behavior (e.g., the
684
+ # [web search tool](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/web-search-tool)).
685
+ #
714
686
  # Each tool definition includes:
715
687
  #
716
688
  # - `name`: Name of the tool.
@@ -827,6 +799,8 @@ module Anthropic
827
799
  Anthropic::Tool,
828
800
  Anthropic::ToolBash20250124,
829
801
  Anthropic::ToolTextEditor20250124,
802
+ Anthropic::ToolTextEditor20250429,
803
+ Anthropic::ToolTextEditor20250728,
830
804
  Anthropic::WebSearchTool20250305
831
805
  )
832
806
  ],
@@ -68,6 +68,10 @@ module Anthropic
68
68
  CLAUDE_4_OPUS_20250514 =
69
69
  T.let(:"claude-4-opus-20250514", Anthropic::Model::TaggedSymbol)
70
70
 
71
+ # Our most capable model
72
+ CLAUDE_OPUS_4_1_20250805 =
73
+ T.let(:"claude-opus-4-1-20250805", Anthropic::Model::TaggedSymbol)
74
+
71
75
  # Excels at writing and complex tasks
72
76
  CLAUDE_3_OPUS_LATEST =
73
77
  T.let(:"claude-3-opus-latest", Anthropic::Model::TaggedSymbol)
@@ -76,17 +80,9 @@ module Anthropic
76
80
  CLAUDE_3_OPUS_20240229 =
77
81
  T.let(:"claude-3-opus-20240229", Anthropic::Model::TaggedSymbol)
78
82
 
79
- # Balance of speed and intelligence
80
- CLAUDE_3_SONNET_20240229 =
81
- T.let(:"claude-3-sonnet-20240229", Anthropic::Model::TaggedSymbol)
82
-
83
83
  # Our previous most fast and cost-effective
84
84
  CLAUDE_3_HAIKU_20240307 =
85
85
  T.let(:"claude-3-haiku-20240307", Anthropic::Model::TaggedSymbol)
86
-
87
- CLAUDE_2_1 = T.let(:"claude-2.1", Anthropic::Model::TaggedSymbol)
88
-
89
- CLAUDE_2_0 = T.let(:"claude-2.0", Anthropic::Model::TaggedSymbol)
90
86
  end
91
87
  end
92
88
  end
@@ -27,11 +27,11 @@ module Anthropic
27
27
  content_block:
28
28
  T.any(
29
29
  Anthropic::TextBlock::OrHash,
30
+ Anthropic::ThinkingBlock::OrHash,
31
+ Anthropic::RedactedThinkingBlock::OrHash,
30
32
  Anthropic::ToolUseBlock::OrHash,
31
33
  Anthropic::ServerToolUseBlock::OrHash,
32
- Anthropic::WebSearchToolResultBlock::OrHash,
33
- Anthropic::ThinkingBlock::OrHash,
34
- Anthropic::RedactedThinkingBlock::OrHash
34
+ Anthropic::WebSearchToolResultBlock::OrHash
35
35
  ),
36
36
  index: Integer,
37
37
  type: Symbol
@@ -60,11 +60,11 @@ module Anthropic
60
60
  T.type_alias do
61
61
  T.any(
62
62
  Anthropic::TextBlock,
63
+ Anthropic::ThinkingBlock,
64
+ Anthropic::RedactedThinkingBlock,
63
65
  Anthropic::ToolUseBlock,
64
66
  Anthropic::ServerToolUseBlock,
65
- Anthropic::WebSearchToolResultBlock,
66
- Anthropic::ThinkingBlock,
67
- Anthropic::RedactedThinkingBlock
67
+ Anthropic::WebSearchToolResultBlock
68
68
  )
69
69
  end
70
70
 
@@ -0,0 +1,77 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ class SearchResultBlockParam < Anthropic::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Anthropic::SearchResultBlockParam, Anthropic::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T::Array[Anthropic::TextBlockParam]) }
12
+ attr_accessor :content
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :source
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :title
19
+
20
+ sig { returns(Symbol) }
21
+ attr_accessor :type
22
+
23
+ # Create a cache control breakpoint at this content block.
24
+ sig { returns(T.nilable(Anthropic::CacheControlEphemeral)) }
25
+ attr_reader :cache_control
26
+
27
+ sig do
28
+ params(
29
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash)
30
+ ).void
31
+ end
32
+ attr_writer :cache_control
33
+
34
+ sig { returns(T.nilable(Anthropic::CitationsConfigParam)) }
35
+ attr_reader :citations
36
+
37
+ sig { params(citations: Anthropic::CitationsConfigParam::OrHash).void }
38
+ attr_writer :citations
39
+
40
+ sig do
41
+ params(
42
+ content: T::Array[Anthropic::TextBlockParam::OrHash],
43
+ source: String,
44
+ title: String,
45
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash),
46
+ citations: Anthropic::CitationsConfigParam::OrHash,
47
+ type: Symbol
48
+ ).returns(T.attached_class)
49
+ end
50
+ def self.new(
51
+ content:,
52
+ source:,
53
+ title:,
54
+ # Create a cache control breakpoint at this content block.
55
+ cache_control: nil,
56
+ citations: nil,
57
+ type: :search_result
58
+ )
59
+ end
60
+
61
+ sig do
62
+ override.returns(
63
+ {
64
+ content: T::Array[Anthropic::TextBlockParam],
65
+ source: String,
66
+ title: String,
67
+ type: Symbol,
68
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral),
69
+ citations: Anthropic::CitationsConfigParam
70
+ }
71
+ )
72
+ end
73
+ def to_hash
74
+ end
75
+ end
76
+ end
77
+ end
@@ -31,7 +31,8 @@ module Anthropic
31
31
  Anthropic::CitationCharLocation::OrHash,
32
32
  Anthropic::CitationPageLocation::OrHash,
33
33
  Anthropic::CitationContentBlockLocation::OrHash,
34
- Anthropic::CitationsWebSearchResultLocation::OrHash
34
+ Anthropic::CitationsWebSearchResultLocation::OrHash,
35
+ Anthropic::CitationsSearchResultLocation::OrHash
35
36
  )
36
37
  ]
37
38
  ),
@@ -33,7 +33,8 @@ module Anthropic
33
33
  Anthropic::CitationCharLocationParam,
34
34
  Anthropic::CitationPageLocationParam,
35
35
  Anthropic::CitationContentBlockLocationParam,
36
- Anthropic::CitationWebSearchResultLocationParam
36
+ Anthropic::CitationWebSearchResultLocationParam,
37
+ Anthropic::CitationSearchResultLocationParam
37
38
  )
38
39
  ]
39
40
  )
@@ -52,7 +53,8 @@ module Anthropic
52
53
  Anthropic::CitationCharLocationParam::OrHash,
53
54
  Anthropic::CitationPageLocationParam::OrHash,
54
55
  Anthropic::CitationContentBlockLocationParam::OrHash,
55
- Anthropic::CitationWebSearchResultLocationParam::OrHash
56
+ Anthropic::CitationWebSearchResultLocationParam::OrHash,
57
+ Anthropic::CitationSearchResultLocationParam::OrHash
56
58
  )
57
59
  ]
58
60
  ),
@@ -81,7 +83,8 @@ module Anthropic
81
83
  Anthropic::CitationCharLocationParam,
82
84
  Anthropic::CitationPageLocationParam,
83
85
  Anthropic::CitationContentBlockLocationParam,
84
- Anthropic::CitationWebSearchResultLocationParam
86
+ Anthropic::CitationWebSearchResultLocationParam,
87
+ Anthropic::CitationSearchResultLocationParam
85
88
  )
86
89
  ]
87
90
  )
@@ -11,7 +11,8 @@ module Anthropic
11
11
  Anthropic::CitationCharLocation,
12
12
  Anthropic::CitationPageLocation,
13
13
  Anthropic::CitationContentBlockLocation,
14
- Anthropic::CitationsWebSearchResultLocation
14
+ Anthropic::CitationsWebSearchResultLocation,
15
+ Anthropic::CitationsSearchResultLocation
15
16
  )
16
17
  end
17
18
 
@@ -11,7 +11,8 @@ module Anthropic
11
11
  Anthropic::CitationCharLocationParam,
12
12
  Anthropic::CitationPageLocationParam,
13
13
  Anthropic::CitationContentBlockLocationParam,
14
- Anthropic::CitationWebSearchResultLocationParam
14
+ Anthropic::CitationWebSearchResultLocationParam,
15
+ Anthropic::CitationSearchResultLocationParam
15
16
  )
16
17
  end
17
18
 
@@ -106,20 +106,31 @@ module Anthropic
106
106
  sig { returns(T.nilable(T.anything)) }
107
107
  attr_accessor :properties
108
108
 
109
+ sig { returns(T.nilable(T::Array[String])) }
110
+ attr_accessor :required
111
+
109
112
  # [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
110
113
  #
111
114
  # This defines the shape of the `input` that your tool accepts and that the model
112
115
  # will produce.
113
116
  sig do
114
- params(properties: T.nilable(T.anything), type: Symbol).returns(
115
- T.attached_class
116
- )
117
+ params(
118
+ properties: T.nilable(T.anything),
119
+ required: T.nilable(T::Array[String]),
120
+ type: Symbol
121
+ ).returns(T.attached_class)
117
122
  end
118
- def self.new(properties: nil, type: :object)
123
+ def self.new(properties: nil, required: nil, type: :object)
119
124
  end
120
125
 
121
126
  sig do
122
- override.returns({ type: Symbol, properties: T.nilable(T.anything) })
127
+ override.returns(
128
+ {
129
+ type: Symbol,
130
+ properties: T.nilable(T.anything),
131
+ required: T.nilable(T::Array[String])
132
+ }
133
+ )
123
134
  end
124
135
  def to_hash
125
136
  end
@@ -92,7 +92,12 @@ module Anthropic
92
92
 
93
93
  Variants =
94
94
  T.type_alias do
95
- T.any(Anthropic::TextBlockParam, Anthropic::ImageBlockParam)
95
+ T.any(
96
+ Anthropic::TextBlockParam,
97
+ Anthropic::ImageBlockParam,
98
+ Anthropic::SearchResultBlockParam,
99
+ Anthropic::DocumentBlockParam
100
+ )
96
101
  end
97
102
 
98
103
  sig do
@@ -0,0 +1,62 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ class ToolTextEditor20250429 < Anthropic::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Anthropic::ToolTextEditor20250429, Anthropic::Internal::AnyHash)
9
+ end
10
+
11
+ # Name of the tool.
12
+ #
13
+ # This is how the tool will be called by the model and in `tool_use` blocks.
14
+ sig { returns(Symbol) }
15
+ attr_accessor :name
16
+
17
+ sig { returns(Symbol) }
18
+ attr_accessor :type
19
+
20
+ # Create a cache control breakpoint at this content block.
21
+ sig { returns(T.nilable(Anthropic::CacheControlEphemeral)) }
22
+ attr_reader :cache_control
23
+
24
+ sig do
25
+ params(
26
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash)
27
+ ).void
28
+ end
29
+ attr_writer :cache_control
30
+
31
+ sig do
32
+ params(
33
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash),
34
+ name: Symbol,
35
+ type: Symbol
36
+ ).returns(T.attached_class)
37
+ end
38
+ def self.new(
39
+ # Create a cache control breakpoint at this content block.
40
+ cache_control: nil,
41
+ # Name of the tool.
42
+ #
43
+ # This is how the tool will be called by the model and in `tool_use` blocks.
44
+ name: :str_replace_based_edit_tool,
45
+ type: :text_editor_20250429
46
+ )
47
+ end
48
+
49
+ sig do
50
+ override.returns(
51
+ {
52
+ name: Symbol,
53
+ type: Symbol,
54
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral)
55
+ }
56
+ )
57
+ end
58
+ def to_hash
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,72 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ class ToolTextEditor20250728 < Anthropic::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Anthropic::ToolTextEditor20250728, Anthropic::Internal::AnyHash)
9
+ end
10
+
11
+ # Name of the tool.
12
+ #
13
+ # This is how the tool will be called by the model and in `tool_use` blocks.
14
+ sig { returns(Symbol) }
15
+ attr_accessor :name
16
+
17
+ sig { returns(Symbol) }
18
+ attr_accessor :type
19
+
20
+ # Create a cache control breakpoint at this content block.
21
+ sig { returns(T.nilable(Anthropic::CacheControlEphemeral)) }
22
+ attr_reader :cache_control
23
+
24
+ sig do
25
+ params(
26
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash)
27
+ ).void
28
+ end
29
+ attr_writer :cache_control
30
+
31
+ # Maximum number of characters to display when viewing a file. If not specified,
32
+ # defaults to displaying the full file.
33
+ sig { returns(T.nilable(Integer)) }
34
+ attr_accessor :max_characters
35
+
36
+ sig do
37
+ params(
38
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral::OrHash),
39
+ max_characters: T.nilable(Integer),
40
+ name: Symbol,
41
+ type: Symbol
42
+ ).returns(T.attached_class)
43
+ end
44
+ def self.new(
45
+ # Create a cache control breakpoint at this content block.
46
+ cache_control: nil,
47
+ # Maximum number of characters to display when viewing a file. If not specified,
48
+ # defaults to displaying the full file.
49
+ max_characters: nil,
50
+ # Name of the tool.
51
+ #
52
+ # This is how the tool will be called by the model and in `tool_use` blocks.
53
+ name: :str_replace_based_edit_tool,
54
+ type: :text_editor_20250728
55
+ )
56
+ end
57
+
58
+ sig do
59
+ override.returns(
60
+ {
61
+ name: Symbol,
62
+ type: Symbol,
63
+ cache_control: T.nilable(Anthropic::CacheControlEphemeral),
64
+ max_characters: T.nilable(Integer)
65
+ }
66
+ )
67
+ end
68
+ def to_hash
69
+ end
70
+ end
71
+ end
72
+ end
@@ -11,6 +11,8 @@ module Anthropic
11
11
  Anthropic::Tool,
12
12
  Anthropic::ToolBash20250124,
13
13
  Anthropic::ToolTextEditor20250124,
14
+ Anthropic::ToolTextEditor20250429,
15
+ Anthropic::ToolTextEditor20250728,
14
16
  Anthropic::WebSearchTool20250305
15
17
  )
16
18
  end