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
@@ -34,18 +34,14 @@ module Anthropic
34
34
 
35
35
  variant const: -> { Anthropic::Models::Model::CLAUDE_4_OPUS_20250514 }
36
36
 
37
+ variant const: -> { Anthropic::Models::Model::CLAUDE_OPUS_4_1_20250805 }
38
+
37
39
  variant const: -> { Anthropic::Models::Model::CLAUDE_3_OPUS_LATEST }
38
40
 
39
41
  variant const: -> { Anthropic::Models::Model::CLAUDE_3_OPUS_20240229 }
40
42
 
41
- variant const: -> { Anthropic::Models::Model::CLAUDE_3_SONNET_20240229 }
42
-
43
43
  variant const: -> { Anthropic::Models::Model::CLAUDE_3_HAIKU_20240307 }
44
44
 
45
- variant const: -> { Anthropic::Models::Model::CLAUDE_2_1 }
46
-
47
- variant const: -> { Anthropic::Models::Model::CLAUDE_2_0 }
48
-
49
45
  variant String
50
46
 
51
47
  # @!method self.variants
@@ -82,8 +78,14 @@ module Anthropic
82
78
  CLAUDE_3_5_SONNET_LATEST = :"claude-3-5-sonnet-latest"
83
79
 
84
80
  # Our previous most intelligent model
81
+ # @deprecated Will reach end-of-life on October 22, 2025. Please migrate to a newer model.
82
+ # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
83
+ # information.
85
84
  CLAUDE_3_5_SONNET_20241022 = :"claude-3-5-sonnet-20241022"
86
85
 
86
+ # @deprecated Will reach end-of-life on October 22, 2025. Please migrate to a newer model.
87
+ # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
88
+ # information.
87
89
  CLAUDE_3_5_SONNET_20240620 = :"claude-3-5-sonnet-20240620"
88
90
 
89
91
  # Our most capable model
@@ -95,31 +97,24 @@ module Anthropic
95
97
  # Our most capable model
96
98
  CLAUDE_4_OPUS_20250514 = :"claude-4-opus-20250514"
97
99
 
100
+ # Our most capable model
101
+ CLAUDE_OPUS_4_1_20250805 = :"claude-opus-4-1-20250805"
102
+
98
103
  # Excels at writing and complex tasks
104
+ # @deprecated Will reach end-of-life on January 5th, 2026. Please migrate to a newer model.
105
+ # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
106
+ # information.
99
107
  CLAUDE_3_OPUS_LATEST = :"claude-3-opus-latest"
100
108
 
101
109
  # Excels at writing and complex tasks
102
- CLAUDE_3_OPUS_20240229 = :"claude-3-opus-20240229"
103
-
104
- # Balance of speed and intelligence
105
- # @deprecated Will reach end-of-life on July 21st, 2025. Please migrate to a newer model.
110
+ # @deprecated Will reach end-of-life on January 5th, 2026. Please migrate to a newer model.
106
111
  # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
107
112
  # information.
108
- CLAUDE_3_SONNET_20240229 = :"claude-3-sonnet-20240229"
113
+ CLAUDE_3_OPUS_20240229 = :"claude-3-opus-20240229"
109
114
 
110
115
  # Our previous most fast and cost-effective
111
116
  CLAUDE_3_HAIKU_20240307 = :"claude-3-haiku-20240307"
112
117
 
113
- # @deprecated Will reach end-of-life on July 21st, 2025. Please migrate to a newer model.
114
- # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
115
- # information.
116
- CLAUDE_2_1 = :"claude-2.1"
117
-
118
- # @deprecated Will reach end-of-life on July 21st, 2025. Please migrate to a newer model.
119
- # Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more
120
- # information.
121
- CLAUDE_2_0 = :"claude-2.0"
122
-
123
118
  # @!endgroup
124
119
  end
125
120
  end
@@ -5,7 +5,7 @@ module Anthropic
5
5
  class RawContentBlockStartEvent < Anthropic::Internal::Type::BaseModel
6
6
  # @!attribute content_block
7
7
  #
8
- # @return [Anthropic::Models::TextBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock]
8
+ # @return [Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock]
9
9
  required :content_block, union: -> { Anthropic::RawContentBlockStartEvent::ContentBlock }
10
10
 
11
11
  # @!attribute index
@@ -19,7 +19,7 @@ module Anthropic
19
19
  required :type, const: :content_block_start
20
20
 
21
21
  # @!method initialize(content_block:, index:, type: :content_block_start)
22
- # @param content_block [Anthropic::Models::TextBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock]
22
+ # @param content_block [Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock]
23
23
  # @param index [Integer]
24
24
  # @param type [Symbol, :content_block_start]
25
25
 
@@ -31,18 +31,18 @@ module Anthropic
31
31
 
32
32
  variant :text, -> { Anthropic::TextBlock }
33
33
 
34
+ variant :thinking, -> { Anthropic::ThinkingBlock }
35
+
36
+ variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
37
+
34
38
  variant :tool_use, -> { Anthropic::ToolUseBlock }
35
39
 
36
40
  variant :server_tool_use, -> { Anthropic::ServerToolUseBlock }
37
41
 
38
42
  variant :web_search_tool_result, -> { Anthropic::WebSearchToolResultBlock }
39
43
 
40
- variant :thinking, -> { Anthropic::ThinkingBlock }
41
-
42
- variant :redacted_thinking, -> { Anthropic::RedactedThinkingBlock }
43
-
44
44
  # @!method self.variants
45
- # @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock)]
45
+ # @return [Array(Anthropic::Models::TextBlock, Anthropic::Models::ThinkingBlock, Anthropic::Models::RedactedThinkingBlock, Anthropic::Models::ToolUseBlock, Anthropic::Models::ServerToolUseBlock, Anthropic::Models::WebSearchToolResultBlock)]
46
46
  end
47
47
  end
48
48
  end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ class SearchResultBlockParam < Anthropic::Internal::Type::BaseModel
6
+ # @!attribute content
7
+ #
8
+ # @return [Array<Anthropic::Models::TextBlockParam>]
9
+ required :content, -> { Anthropic::Internal::Type::ArrayOf[Anthropic::TextBlockParam] }
10
+
11
+ # @!attribute source
12
+ #
13
+ # @return [String]
14
+ required :source, String
15
+
16
+ # @!attribute title
17
+ #
18
+ # @return [String]
19
+ required :title, String
20
+
21
+ # @!attribute type
22
+ #
23
+ # @return [Symbol, :search_result]
24
+ required :type, const: :search_result
25
+
26
+ # @!attribute cache_control
27
+ # Create a cache control breakpoint at this content block.
28
+ #
29
+ # @return [Anthropic::Models::CacheControlEphemeral, nil]
30
+ optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
31
+
32
+ # @!attribute citations
33
+ #
34
+ # @return [Anthropic::Models::CitationsConfigParam, nil]
35
+ optional :citations, -> { Anthropic::CitationsConfigParam }
36
+
37
+ # @!method initialize(content:, source:, title:, cache_control: nil, citations: nil, type: :search_result)
38
+ # @param content [Array<Anthropic::Models::TextBlockParam>]
39
+ #
40
+ # @param source [String]
41
+ #
42
+ # @param title [String]
43
+ #
44
+ # @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
45
+ #
46
+ # @param citations [Anthropic::Models::CitationsConfigParam]
47
+ #
48
+ # @param type [Symbol, :search_result]
49
+ end
50
+ end
51
+ end
@@ -10,7 +10,7 @@ module Anthropic
10
10
  # Citing a PDF results in `page_location`, plain text results in `char_location`,
11
11
  # and content document results in `content_block_location`.
12
12
  #
13
- # @return [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation>, nil]
13
+ # @return [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation>, nil]
14
14
  required :citations,
15
15
  -> {
16
16
  Anthropic::Internal::Type::ArrayOf[union: Anthropic::TextCitation]
@@ -31,7 +31,7 @@ module Anthropic
31
31
  # Some parameter documentations has been truncated, see
32
32
  # {Anthropic::Models::TextBlock} for more details.
33
33
  #
34
- # @param citations [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation>, nil] Citations supporting the text block.
34
+ # @param citations [Array<Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation>, nil] Citations supporting the text block.
35
35
  #
36
36
  # @param text [String]
37
37
  #
@@ -21,7 +21,7 @@ module Anthropic
21
21
 
22
22
  # @!attribute citations
23
23
  #
24
- # @return [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam>, nil]
24
+ # @return [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam, Anthropic::Models::CitationSearchResultLocationParam>, nil]
25
25
  optional :citations,
26
26
  -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::TextCitationParam] },
27
27
  nil?: true
@@ -31,7 +31,7 @@ module Anthropic
31
31
  #
32
32
  # @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
33
33
  #
34
- # @param citations [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam>, nil]
34
+ # @param citations [Array<Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam, Anthropic::Models::CitationSearchResultLocationParam>, nil]
35
35
  #
36
36
  # @param type [Symbol, :text]
37
37
  end
@@ -15,8 +15,10 @@ module Anthropic
15
15
 
16
16
  variant :web_search_result_location, -> { Anthropic::CitationsWebSearchResultLocation }
17
17
 
18
+ variant :search_result_location, -> { Anthropic::CitationsSearchResultLocation }
19
+
18
20
  # @!method self.variants
19
- # @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation)]
21
+ # @return [Array(Anthropic::Models::CitationCharLocation, Anthropic::Models::CitationPageLocation, Anthropic::Models::CitationContentBlockLocation, Anthropic::Models::CitationsWebSearchResultLocation, Anthropic::Models::CitationsSearchResultLocation)]
20
22
  end
21
23
  end
22
24
  end
@@ -15,8 +15,10 @@ module Anthropic
15
15
 
16
16
  variant :web_search_result_location, -> { Anthropic::CitationWebSearchResultLocationParam }
17
17
 
18
+ variant :search_result_location, -> { Anthropic::CitationSearchResultLocationParam }
19
+
18
20
  # @!method self.variants
19
- # @return [Array(Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam)]
21
+ # @return [Array(Anthropic::Models::CitationCharLocationParam, Anthropic::Models::CitationPageLocationParam, Anthropic::Models::CitationContentBlockLocationParam, Anthropic::Models::CitationWebSearchResultLocationParam, Anthropic::Models::CitationSearchResultLocationParam)]
20
22
  end
21
23
  end
22
24
  end
@@ -68,13 +68,19 @@ module Anthropic
68
68
  # @return [Object, nil]
69
69
  optional :properties, Anthropic::Internal::Type::Unknown, nil?: true
70
70
 
71
- # @!method initialize(properties: nil, type: :object)
71
+ # @!attribute required
72
+ #
73
+ # @return [Array<String>, nil]
74
+ optional :required, Anthropic::Internal::Type::ArrayOf[String], nil?: true
75
+
76
+ # @!method initialize(properties: nil, required: nil, type: :object)
72
77
  # [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
73
78
  #
74
79
  # This defines the shape of the `input` that your tool accepts and that the model
75
80
  # will produce.
76
81
  #
77
82
  # @param properties [Object, nil]
83
+ # @param required [Array<String>, nil]
78
84
  # @param type [Symbol, :object]
79
85
  end
80
86
 
@@ -21,7 +21,7 @@ module Anthropic
21
21
 
22
22
  # @!attribute content
23
23
  #
24
- # @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam>, nil]
24
+ # @return [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam>, nil]
25
25
  optional :content, union: -> { Anthropic::ToolResultBlockParam::Content }
26
26
 
27
27
  # @!attribute is_error
@@ -34,7 +34,7 @@ module Anthropic
34
34
  #
35
35
  # @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
36
36
  #
37
- # @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam>]
37
+ # @param content [String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam>]
38
38
  #
39
39
  # @param is_error [Boolean]
40
40
  #
@@ -57,12 +57,16 @@ module Anthropic
57
57
 
58
58
  variant :image, -> { Anthropic::ImageBlockParam }
59
59
 
60
+ variant :search_result, -> { Anthropic::SearchResultBlockParam }
61
+
62
+ variant :document, -> { Anthropic::DocumentBlockParam }
63
+
60
64
  # @!method self.variants
61
- # @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam)]
65
+ # @return [Array(Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam)]
62
66
  end
63
67
 
64
68
  # @!method self.variants
65
- # @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam>)]
69
+ # @return [Array(String, Array<Anthropic::Models::TextBlockParam, Anthropic::Models::ImageBlockParam, Anthropic::Models::SearchResultBlockParam, Anthropic::Models::DocumentBlockParam>)]
66
70
 
67
71
  # @type [Anthropic::Internal::Type::Converter]
68
72
  ContentArray =
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ class ToolTextEditor20250429 < Anthropic::Internal::Type::BaseModel
6
+ # @!attribute name
7
+ # Name of the tool.
8
+ #
9
+ # This is how the tool will be called by the model and in `tool_use` blocks.
10
+ #
11
+ # @return [Symbol, :str_replace_based_edit_tool]
12
+ required :name, const: :str_replace_based_edit_tool
13
+
14
+ # @!attribute type
15
+ #
16
+ # @return [Symbol, :text_editor_20250429]
17
+ required :type, const: :text_editor_20250429
18
+
19
+ # @!attribute cache_control
20
+ # Create a cache control breakpoint at this content block.
21
+ #
22
+ # @return [Anthropic::Models::CacheControlEphemeral, nil]
23
+ optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
24
+
25
+ # @!method initialize(cache_control: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250429)
26
+ # Some parameter documentations has been truncated, see
27
+ # {Anthropic::Models::ToolTextEditor20250429} for more details.
28
+ #
29
+ # @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
30
+ #
31
+ # @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
32
+ #
33
+ # @param type [Symbol, :text_editor_20250429]
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ class ToolTextEditor20250728 < Anthropic::Internal::Type::BaseModel
6
+ # @!attribute name
7
+ # Name of the tool.
8
+ #
9
+ # This is how the tool will be called by the model and in `tool_use` blocks.
10
+ #
11
+ # @return [Symbol, :str_replace_based_edit_tool]
12
+ required :name, const: :str_replace_based_edit_tool
13
+
14
+ # @!attribute type
15
+ #
16
+ # @return [Symbol, :text_editor_20250728]
17
+ required :type, const: :text_editor_20250728
18
+
19
+ # @!attribute cache_control
20
+ # Create a cache control breakpoint at this content block.
21
+ #
22
+ # @return [Anthropic::Models::CacheControlEphemeral, nil]
23
+ optional :cache_control, -> { Anthropic::CacheControlEphemeral }, nil?: true
24
+
25
+ # @!attribute max_characters
26
+ # Maximum number of characters to display when viewing a file. If not specified,
27
+ # defaults to displaying the full file.
28
+ #
29
+ # @return [Integer, nil]
30
+ optional :max_characters, Integer, nil?: true
31
+
32
+ # @!method initialize(cache_control: nil, max_characters: nil, name: :str_replace_based_edit_tool, type: :text_editor_20250728)
33
+ # Some parameter documentations has been truncated, see
34
+ # {Anthropic::Models::ToolTextEditor20250728} for more details.
35
+ #
36
+ # @param cache_control [Anthropic::Models::CacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
37
+ #
38
+ # @param max_characters [Integer, nil] Maximum number of characters to display when viewing a file. If not specified, d
39
+ #
40
+ # @param name [Symbol, :str_replace_based_edit_tool] Name of the tool.
41
+ #
42
+ # @param type [Symbol, :text_editor_20250728]
43
+ end
44
+ end
45
+ end
@@ -11,10 +11,14 @@ module Anthropic
11
11
 
12
12
  variant -> { Anthropic::ToolTextEditor20250124 }
13
13
 
14
+ variant -> { Anthropic::ToolTextEditor20250429 }
15
+
16
+ variant -> { Anthropic::ToolTextEditor20250728 }
17
+
14
18
  variant -> { Anthropic::WebSearchTool20250305 }
15
19
 
16
20
  # @!method self.variants
17
- # @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::WebSearchTool20250305)]
21
+ # @return [Array(Anthropic::Models::Tool, Anthropic::Models::ToolBash20250124, Anthropic::Models::ToolTextEditor20250124, Anthropic::Models::ToolTextEditor20250429, Anthropic::Models::ToolTextEditor20250728, Anthropic::Models::WebSearchTool20250305)]
18
22
  end
19
23
  end
20
24
  end
@@ -23,6 +23,20 @@ module Anthropic
23
23
  # @return [Symbol, :tool_use]
24
24
  required :type, const: :tool_use
25
25
 
26
+ # @api private
27
+ #
28
+ # Internal buffer for accumulating partial JSON during streaming.
29
+ # Used by streaming helpers to reconstruct complete JSON input from deltas.
30
+ optional :json_buf, String
31
+
32
+ response_only do
33
+ # @api public
34
+ #
35
+ # Parsed input data coerced to the tool's input schema model.
36
+ # Only present when tools are defined using the InputSchema DSL.
37
+ optional :parsed, Anthropic::Internal::Type::Unknown
38
+ end
39
+
26
40
  # @!method initialize(id:, input:, name:, type: :tool_use)
27
41
  # @param id [String]
28
42
  # @param input [Object]
@@ -3,6 +3,12 @@
3
3
  module Anthropic
4
4
  module Models
5
5
  class Usage < Anthropic::Internal::Type::BaseModel
6
+ # @!attribute cache_creation
7
+ # Breakdown of cached tokens by TTL
8
+ #
9
+ # @return [Anthropic::Models::CacheCreation, nil]
10
+ required :cache_creation, -> { Anthropic::CacheCreation }, nil?: true
11
+
6
12
  # @!attribute cache_creation_input_tokens
7
13
  # The number of input tokens used to create the cache entry.
8
14
  #
@@ -39,7 +45,9 @@ module Anthropic
39
45
  # @return [Symbol, Anthropic::Models::Usage::ServiceTier, nil]
40
46
  required :service_tier, enum: -> { Anthropic::Usage::ServiceTier }, nil?: true
41
47
 
42
- # @!method initialize(cache_creation_input_tokens:, cache_read_input_tokens:, input_tokens:, output_tokens:, server_tool_use:, service_tier:)
48
+ # @!method initialize(cache_creation:, cache_creation_input_tokens:, cache_read_input_tokens:, input_tokens:, output_tokens:, server_tool_use:, service_tier:)
49
+ # @param cache_creation [Anthropic::Models::CacheCreation, nil] Breakdown of cached tokens by TTL
50
+ #
43
51
  # @param cache_creation_input_tokens [Integer, nil] The number of input tokens used to create the cache entry.
44
52
  #
45
53
  # @param cache_read_input_tokens [Integer, nil] The number of input tokens read from the cache.
@@ -11,16 +11,16 @@ module Anthropic
11
11
  mod.constants.each do |name|
12
12
  case mod.const_get(name)
13
13
  in true | false
14
- mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, mod) } }
14
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
15
15
  mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
16
16
  in Integer
17
- mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, mod) } }
17
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
18
18
  mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
19
19
  in Float
20
- mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, mod) } }
20
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
21
21
  mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
22
22
  in Symbol
23
- mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, mod) } }
23
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
24
24
  mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
25
25
  else
26
26
  end
@@ -77,6 +77,8 @@ module Anthropic
77
77
 
78
78
  CacheControlEphemeral = Anthropic::Models::CacheControlEphemeral
79
79
 
80
+ CacheCreation = Anthropic::Models::CacheCreation
81
+
80
82
  CitationCharLocation = Anthropic::Models::CitationCharLocation
81
83
 
82
84
  CitationCharLocationParam = Anthropic::Models::CitationCharLocationParam
@@ -93,6 +95,10 @@ module Anthropic
93
95
 
94
96
  CitationsDelta = Anthropic::Models::CitationsDelta
95
97
 
98
+ CitationSearchResultLocationParam = Anthropic::Models::CitationSearchResultLocationParam
99
+
100
+ CitationsSearchResultLocation = Anthropic::Models::CitationsSearchResultLocation
101
+
96
102
  CitationsWebSearchResultLocation = Anthropic::Models::CitationsWebSearchResultLocation
97
103
 
98
104
  CitationWebSearchResultLocationParam = Anthropic::Models::CitationWebSearchResultLocationParam
@@ -179,6 +185,8 @@ module Anthropic
179
185
 
180
186
  RedactedThinkingBlockParam = Anthropic::Models::RedactedThinkingBlockParam
181
187
 
188
+ SearchResultBlockParam = Anthropic::Models::SearchResultBlockParam
189
+
182
190
  ServerToolUsage = Anthropic::Models::ServerToolUsage
183
191
 
184
192
  ServerToolUseBlock = Anthropic::Models::ServerToolUseBlock
@@ -229,6 +237,10 @@ module Anthropic
229
237
 
230
238
  ToolTextEditor20250124 = Anthropic::Models::ToolTextEditor20250124
231
239
 
240
+ ToolTextEditor20250429 = Anthropic::Models::ToolTextEditor20250429
241
+
242
+ ToolTextEditor20250728 = Anthropic::Models::ToolTextEditor20250728
243
+
232
244
  ToolUnion = Anthropic::Models::ToolUnion
233
245
 
234
246
  ToolUseBlock = Anthropic::Models::ToolUseBlock
@@ -46,7 +46,7 @@ module Anthropic
46
46
  #
47
47
  # @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
48
48
  #
49
- # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522>] Body param: Definitions of tools that the model may use.
49
+ # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Body param: Definitions of tools that the model may use.
50
50
  #
51
51
  # @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
52
52
  #
@@ -62,7 +62,7 @@ module Anthropic
62
62
  def create(params)
63
63
  parsed, options = Anthropic::Beta::MessageCreateParams.dump_request(params)
64
64
  if parsed[:stream]
65
- message = "Please use `#stream_raw` for the streaming use case."
65
+ message = "Please use `#stream` for the streaming use case."
66
66
  raise ArgumentError.new(message)
67
67
  end
68
68
 
@@ -89,8 +89,75 @@ module Anthropic
89
89
  )
90
90
  end
91
91
 
92
- def stream
93
- raise NotImplementedError.new("higher level helpers are coming soon!")
92
+ # See {Anthropic::Resources::Beta::Messages#create} for non-streaming counterpart.
93
+ #
94
+ # Some parameter documentations has been truncated, see
95
+ # {Anthropic::Models::Beta::MessageCreateParams} for more details.
96
+ #
97
+ # Send a structured list of input messages with text and/or image content, and the
98
+ # model will generate the next message in the conversation.
99
+ #
100
+ # The Messages API can be used for either single queries or stateless multi-turn
101
+ # conversations.
102
+ #
103
+ # Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
104
+ #
105
+ # @overload stream_raw(max_tokens:, messages:, model:, container: nil, mcp_servers: nil, metadata: nil, service_tier: nil, stop_sequences: nil, system_: nil, temperature: nil, thinking: nil, tool_choice: nil, tools: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
106
+ #
107
+ # @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
108
+ #
109
+ # @param messages [Array<Anthropic::Models::Beta::BetaMessageParam>] Body param: Input messages.
110
+ #
111
+ # @param model [Symbol, String, Anthropic::Models::Model] Body param: The model that will complete your prompt.\n\nSee [models](https://do
112
+ #
113
+ # @param container [String, nil] Body param: Container identifier for reuse across requests.
114
+ #
115
+ # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
116
+ #
117
+ # @param metadata [Anthropic::Models::Beta::BetaMetadata] Body param: An object describing metadata about the request.
118
+ #
119
+ # @param service_tier [Symbol, Anthropic::Models::Beta::MessageCreateParams::ServiceTier] Body param: Determines whether to use priority capacity (if available) or standa
120
+ #
121
+ # @param stop_sequences [Array<String>] Body param: Custom text sequences that will cause the model to stop generating.
122
+ #
123
+ # @param system_ [String, Array<Anthropic::Models::Beta::BetaTextBlockParam>] Body param: System prompt.
124
+ #
125
+ # @param temperature [Float] Body param: Amount of randomness injected into the response.
126
+ #
127
+ # @param thinking [Anthropic::Models::Beta::BetaThinkingConfigEnabled, Anthropic::Models::Beta::BetaThinkingConfigDisabled] Body param: Configuration for enabling Claude's extended thinking.
128
+ #
129
+ # @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
130
+ #
131
+ # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Body param: Definitions of tools that the model may use.
132
+ #
133
+ # @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
134
+ #
135
+ # @param top_p [Float] Body param: Use nucleus sampling.
136
+ #
137
+ # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
138
+ #
139
+ # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
140
+ #
141
+ # @return [Anthropic::Internal::Stream<Anthropic::Models::Beta::BetaRawMessageStartEvent, Anthropic::Models::Beta::BetaRawMessageDeltaEvent, Anthropic::Models::Beta::BetaRawMessageStopEvent, Anthropic::Models::Beta::BetaRawContentBlockStartEvent, Anthropic::Models::Beta::BetaRawContentBlockDeltaEvent, Anthropic::Models::Beta::BetaRawContentBlockStopEvent>]
142
+ #
143
+ # @see Anthropic::Models::Beta::MessageCreateParams
144
+ def stream(params)
145
+ parsed, options = Anthropic::Models::Beta::MessageCreateParams.dump_request(params)
146
+ unless parsed.fetch(:stream, true)
147
+ message = "Please use `#create` for the non-streaming use case."
148
+ raise ArgumentError.new(message)
149
+ end
150
+ parsed.store(:stream, true)
151
+ raw_stream = @client.request(
152
+ method: :post,
153
+ path: "v1/messages?beta=true",
154
+ headers: {"accept" => "text/event-stream"},
155
+ body: parsed,
156
+ stream: Anthropic::Internal::Stream,
157
+ model: Anthropic::Beta::BetaRawMessageStreamEvent,
158
+ options: options
159
+ )
160
+ Anthropic::Streaming::MessageStream.new(raw_stream: raw_stream)
94
161
  end
95
162
 
96
163
  # See {Anthropic::Resources::Beta::Messages#create} for non-streaming counterpart.
@@ -132,7 +199,7 @@ module Anthropic
132
199
  #
133
200
  # @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
134
201
  #
135
- # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522>] Body param: Definitions of tools that the model may use.
202
+ # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305>] Body param: Definitions of tools that the model may use.
136
203
  #
137
204
  # @param top_k [Integer] Body param: Only sample from the top K options for each subsequent token.
138
205
  #
@@ -192,7 +259,7 @@ module Anthropic
192
259
  #
193
260
  # @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
194
261
  #
195
- # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaCodeExecutionTool20250522>] Body param: Definitions of tools that the model may use.
262
+ # @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910>] Body param: Definitions of tools that the model may use.
196
263
  #
197
264
  # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
198
265
  #