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
@@ -0,0 +1,91 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaSearchResultBlockParam = Beta::BetaSearchResultBlockParam
6
+
7
+ module Beta
8
+ class BetaSearchResultBlockParam < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaSearchResultBlockParam,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(T::Array[Anthropic::Beta::BetaTextBlockParam]) }
18
+ attr_accessor :content
19
+
20
+ sig { returns(String) }
21
+ attr_accessor :source
22
+
23
+ sig { returns(String) }
24
+ attr_accessor :title
25
+
26
+ sig { returns(Symbol) }
27
+ attr_accessor :type
28
+
29
+ # Create a cache control breakpoint at this content block.
30
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
31
+ attr_reader :cache_control
32
+
33
+ sig do
34
+ params(
35
+ cache_control:
36
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
37
+ ).void
38
+ end
39
+ attr_writer :cache_control
40
+
41
+ sig { returns(T.nilable(Anthropic::Beta::BetaCitationsConfigParam)) }
42
+ attr_reader :citations
43
+
44
+ sig do
45
+ params(
46
+ citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash
47
+ ).void
48
+ end
49
+ attr_writer :citations
50
+
51
+ sig do
52
+ params(
53
+ content: T::Array[Anthropic::Beta::BetaTextBlockParam::OrHash],
54
+ source: String,
55
+ title: String,
56
+ cache_control:
57
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
58
+ citations: Anthropic::Beta::BetaCitationsConfigParam::OrHash,
59
+ type: Symbol
60
+ ).returns(T.attached_class)
61
+ end
62
+ def self.new(
63
+ content:,
64
+ source:,
65
+ title:,
66
+ # Create a cache control breakpoint at this content block.
67
+ cache_control: nil,
68
+ citations: nil,
69
+ type: :search_result
70
+ )
71
+ end
72
+
73
+ sig do
74
+ override.returns(
75
+ {
76
+ content: T::Array[Anthropic::Beta::BetaTextBlockParam],
77
+ source: String,
78
+ title: String,
79
+ type: Symbol,
80
+ cache_control:
81
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
82
+ citations: Anthropic::Beta::BetaCitationsConfigParam
83
+ }
84
+ )
85
+ end
86
+ def to_hash
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -14,18 +14,33 @@ module Anthropic
14
14
  )
15
15
  end
16
16
 
17
+ # The number of web fetch tool requests.
18
+ sig { returns(Integer) }
19
+ attr_accessor :web_fetch_requests
20
+
17
21
  # The number of web search tool requests.
18
22
  sig { returns(Integer) }
19
23
  attr_accessor :web_search_requests
20
24
 
21
- sig { params(web_search_requests: Integer).returns(T.attached_class) }
25
+ sig do
26
+ params(
27
+ web_fetch_requests: Integer,
28
+ web_search_requests: Integer
29
+ ).returns(T.attached_class)
30
+ end
22
31
  def self.new(
32
+ # The number of web fetch tool requests.
33
+ web_fetch_requests:,
23
34
  # The number of web search tool requests.
24
35
  web_search_requests:
25
36
  )
26
37
  end
27
38
 
28
- sig { override.returns({ web_search_requests: Integer }) }
39
+ sig do
40
+ override.returns(
41
+ { web_fetch_requests: Integer, web_search_requests: Integer }
42
+ )
43
+ end
29
44
  def to_hash
30
45
  end
31
46
  end
@@ -66,11 +66,26 @@ module Anthropic
66
66
  :web_search,
67
67
  Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
68
68
  )
69
+ WEB_FETCH =
70
+ T.let(
71
+ :web_fetch,
72
+ Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
73
+ )
69
74
  CODE_EXECUTION =
70
75
  T.let(
71
76
  :code_execution,
72
77
  Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
73
78
  )
79
+ BASH_CODE_EXECUTION =
80
+ T.let(
81
+ :bash_code_execution,
82
+ Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
83
+ )
84
+ TEXT_EDITOR_CODE_EXECUTION =
85
+ T.let(
86
+ :text_editor_code_execution,
87
+ Anthropic::Beta::BetaServerToolUseBlock::Name::TaggedSymbol
88
+ )
74
89
 
75
90
  sig do
76
91
  override.returns(
@@ -90,11 +90,26 @@ module Anthropic
90
90
  :web_search,
91
91
  Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
92
92
  )
93
+ WEB_FETCH =
94
+ T.let(
95
+ :web_fetch,
96
+ Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
97
+ )
93
98
  CODE_EXECUTION =
94
99
  T.let(
95
100
  :code_execution,
96
101
  Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
97
102
  )
103
+ BASH_CODE_EXECUTION =
104
+ T.let(
105
+ :bash_code_execution,
106
+ Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
107
+ )
108
+ TEXT_EDITOR_CODE_EXECUTION =
109
+ T.let(
110
+ :text_editor_code_execution,
111
+ Anthropic::Beta::BetaServerToolUseBlockParam::Name::TaggedSymbol
112
+ )
98
113
 
99
114
  sig do
100
115
  override.returns(
@@ -38,7 +38,8 @@ module Anthropic
38
38
  Anthropic::Beta::BetaCitationCharLocation::OrHash,
39
39
  Anthropic::Beta::BetaCitationPageLocation::OrHash,
40
40
  Anthropic::Beta::BetaCitationContentBlockLocation::OrHash,
41
- Anthropic::Beta::BetaCitationsWebSearchResultLocation::OrHash
41
+ Anthropic::Beta::BetaCitationsWebSearchResultLocation::OrHash,
42
+ Anthropic::Beta::BetaCitationSearchResultLocation::OrHash
42
43
  )
43
44
  ]
44
45
  ),
@@ -40,7 +40,8 @@ module Anthropic
40
40
  Anthropic::Beta::BetaCitationCharLocationParam,
41
41
  Anthropic::Beta::BetaCitationPageLocationParam,
42
42
  Anthropic::Beta::BetaCitationContentBlockLocationParam,
43
- Anthropic::Beta::BetaCitationWebSearchResultLocationParam
43
+ Anthropic::Beta::BetaCitationWebSearchResultLocationParam,
44
+ Anthropic::Beta::BetaCitationSearchResultLocationParam
44
45
  )
45
46
  ]
46
47
  )
@@ -60,7 +61,8 @@ module Anthropic
60
61
  Anthropic::Beta::BetaCitationCharLocationParam::OrHash,
61
62
  Anthropic::Beta::BetaCitationPageLocationParam::OrHash,
62
63
  Anthropic::Beta::BetaCitationContentBlockLocationParam::OrHash,
63
- Anthropic::Beta::BetaCitationWebSearchResultLocationParam::OrHash
64
+ Anthropic::Beta::BetaCitationWebSearchResultLocationParam::OrHash,
65
+ Anthropic::Beta::BetaCitationSearchResultLocationParam::OrHash
64
66
  )
65
67
  ]
66
68
  ),
@@ -90,7 +92,8 @@ module Anthropic
90
92
  Anthropic::Beta::BetaCitationCharLocationParam,
91
93
  Anthropic::Beta::BetaCitationPageLocationParam,
92
94
  Anthropic::Beta::BetaCitationContentBlockLocationParam,
93
- Anthropic::Beta::BetaCitationWebSearchResultLocationParam
95
+ Anthropic::Beta::BetaCitationWebSearchResultLocationParam,
96
+ Anthropic::Beta::BetaCitationSearchResultLocationParam
94
97
  )
95
98
  ]
96
99
  )
@@ -14,7 +14,8 @@ module Anthropic
14
14
  Anthropic::Beta::BetaCitationCharLocation,
15
15
  Anthropic::Beta::BetaCitationPageLocation,
16
16
  Anthropic::Beta::BetaCitationContentBlockLocation,
17
- Anthropic::Beta::BetaCitationsWebSearchResultLocation
17
+ Anthropic::Beta::BetaCitationsWebSearchResultLocation,
18
+ Anthropic::Beta::BetaCitationSearchResultLocation
18
19
  )
19
20
  end
20
21
 
@@ -14,7 +14,8 @@ module Anthropic
14
14
  Anthropic::Beta::BetaCitationCharLocationParam,
15
15
  Anthropic::Beta::BetaCitationPageLocationParam,
16
16
  Anthropic::Beta::BetaCitationContentBlockLocationParam,
17
- Anthropic::Beta::BetaCitationWebSearchResultLocationParam
17
+ Anthropic::Beta::BetaCitationWebSearchResultLocationParam,
18
+ Anthropic::Beta::BetaCitationSearchResultLocationParam
18
19
  )
19
20
  end
20
21
 
@@ -0,0 +1,41 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionCreateResultBlock =
6
+ Beta::BetaTextEditorCodeExecutionCreateResultBlock
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionCreateResultBlock < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlock,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(T::Boolean) }
19
+ attr_accessor :is_file_update
20
+
21
+ sig { returns(Symbol) }
22
+ attr_accessor :type
23
+
24
+ sig do
25
+ params(is_file_update: T::Boolean, type: Symbol).returns(
26
+ T.attached_class
27
+ )
28
+ end
29
+ def self.new(
30
+ is_file_update:,
31
+ type: :text_editor_code_execution_create_result
32
+ )
33
+ end
34
+
35
+ sig { override.returns({ is_file_update: T::Boolean, type: Symbol }) }
36
+ def to_hash
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionCreateResultBlockParam =
6
+ Beta::BetaTextEditorCodeExecutionCreateResultBlockParam
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionCreateResultBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(T::Boolean) }
19
+ attr_accessor :is_file_update
20
+
21
+ sig { returns(Symbol) }
22
+ attr_accessor :type
23
+
24
+ sig do
25
+ params(is_file_update: T::Boolean, type: Symbol).returns(
26
+ T.attached_class
27
+ )
28
+ end
29
+ def self.new(
30
+ is_file_update:,
31
+ type: :text_editor_code_execution_create_result
32
+ )
33
+ end
34
+
35
+ sig { override.returns({ is_file_update: T::Boolean, type: Symbol }) }
36
+ def to_hash
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,73 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionStrReplaceResultBlock =
6
+ Beta::BetaTextEditorCodeExecutionStrReplaceResultBlock
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionStrReplaceResultBlock < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlock,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(T.nilable(T::Array[String])) }
19
+ attr_accessor :lines
20
+
21
+ sig { returns(T.nilable(Integer)) }
22
+ attr_accessor :new_lines
23
+
24
+ sig { returns(T.nilable(Integer)) }
25
+ attr_accessor :new_start
26
+
27
+ sig { returns(T.nilable(Integer)) }
28
+ attr_accessor :old_lines
29
+
30
+ sig { returns(T.nilable(Integer)) }
31
+ attr_accessor :old_start
32
+
33
+ sig { returns(Symbol) }
34
+ attr_accessor :type
35
+
36
+ sig do
37
+ params(
38
+ lines: T.nilable(T::Array[String]),
39
+ new_lines: T.nilable(Integer),
40
+ new_start: T.nilable(Integer),
41
+ old_lines: T.nilable(Integer),
42
+ old_start: T.nilable(Integer),
43
+ type: Symbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ lines:,
48
+ new_lines:,
49
+ new_start:,
50
+ old_lines:,
51
+ old_start:,
52
+ type: :text_editor_code_execution_str_replace_result
53
+ )
54
+ end
55
+
56
+ sig do
57
+ override.returns(
58
+ {
59
+ lines: T.nilable(T::Array[String]),
60
+ new_lines: T.nilable(Integer),
61
+ new_start: T.nilable(Integer),
62
+ old_lines: T.nilable(Integer),
63
+ old_start: T.nilable(Integer),
64
+ type: Symbol
65
+ }
66
+ )
67
+ end
68
+ def to_hash
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,73 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionStrReplaceResultBlockParam =
6
+ Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionStrReplaceResultBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(Symbol) }
19
+ attr_accessor :type
20
+
21
+ sig { returns(T.nilable(T::Array[String])) }
22
+ attr_accessor :lines
23
+
24
+ sig { returns(T.nilable(Integer)) }
25
+ attr_accessor :new_lines
26
+
27
+ sig { returns(T.nilable(Integer)) }
28
+ attr_accessor :new_start
29
+
30
+ sig { returns(T.nilable(Integer)) }
31
+ attr_accessor :old_lines
32
+
33
+ sig { returns(T.nilable(Integer)) }
34
+ attr_accessor :old_start
35
+
36
+ sig do
37
+ params(
38
+ lines: T.nilable(T::Array[String]),
39
+ new_lines: T.nilable(Integer),
40
+ new_start: T.nilable(Integer),
41
+ old_lines: T.nilable(Integer),
42
+ old_start: T.nilable(Integer),
43
+ type: Symbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ lines: nil,
48
+ new_lines: nil,
49
+ new_start: nil,
50
+ old_lines: nil,
51
+ old_start: nil,
52
+ type: :text_editor_code_execution_str_replace_result
53
+ )
54
+ end
55
+
56
+ sig do
57
+ override.returns(
58
+ {
59
+ type: Symbol,
60
+ lines: T.nilable(T::Array[String]),
61
+ new_lines: T.nilable(Integer),
62
+ new_start: T.nilable(Integer),
63
+ old_lines: T.nilable(Integer),
64
+ old_start: T.nilable(Integer)
65
+ }
66
+ )
67
+ end
68
+ def to_hash
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,90 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionToolResultBlock =
6
+ Beta::BetaTextEditorCodeExecutionToolResultBlock
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionToolResultBlock < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::Content::Variants
21
+ )
22
+ end
23
+ attr_accessor :content
24
+
25
+ sig { returns(String) }
26
+ attr_accessor :tool_use_id
27
+
28
+ sig { returns(Symbol) }
29
+ attr_accessor :type
30
+
31
+ sig do
32
+ params(
33
+ content:
34
+ T.any(
35
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultError::OrHash,
36
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlock::OrHash,
37
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlock::OrHash,
38
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlock::OrHash
39
+ ),
40
+ tool_use_id: String,
41
+ type: Symbol
42
+ ).returns(T.attached_class)
43
+ end
44
+ def self.new(
45
+ content:,
46
+ tool_use_id:,
47
+ type: :text_editor_code_execution_tool_result
48
+ )
49
+ end
50
+
51
+ sig do
52
+ override.returns(
53
+ {
54
+ content:
55
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::Content::Variants,
56
+ tool_use_id: String,
57
+ type: Symbol
58
+ }
59
+ )
60
+ end
61
+ def to_hash
62
+ end
63
+
64
+ module Content
65
+ extend Anthropic::Internal::Type::Union
66
+
67
+ Variants =
68
+ T.type_alias do
69
+ T.any(
70
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultError,
71
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlock,
72
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlock,
73
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlock
74
+ )
75
+ end
76
+
77
+ sig do
78
+ override.returns(
79
+ T::Array[
80
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::Content::Variants
81
+ ]
82
+ )
83
+ end
84
+ def self.variants
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,118 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaTextEditorCodeExecutionToolResultBlockParam =
6
+ Beta::BetaTextEditorCodeExecutionToolResultBlockParam
7
+
8
+ module Beta
9
+ class BetaTextEditorCodeExecutionToolResultBlockParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig do
19
+ returns(
20
+ T.any(
21
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultErrorParam,
22
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlockParam,
23
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam,
24
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam
25
+ )
26
+ )
27
+ end
28
+ attr_accessor :content
29
+
30
+ sig { returns(String) }
31
+ attr_accessor :tool_use_id
32
+
33
+ sig { returns(Symbol) }
34
+ attr_accessor :type
35
+
36
+ # Create a cache control breakpoint at this content block.
37
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
38
+ attr_reader :cache_control
39
+
40
+ sig do
41
+ params(
42
+ cache_control:
43
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
44
+ ).void
45
+ end
46
+ attr_writer :cache_control
47
+
48
+ sig do
49
+ params(
50
+ content:
51
+ T.any(
52
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultErrorParam::OrHash,
53
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlockParam::OrHash,
54
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam::OrHash,
55
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam::OrHash
56
+ ),
57
+ tool_use_id: String,
58
+ cache_control:
59
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
60
+ type: Symbol
61
+ ).returns(T.attached_class)
62
+ end
63
+ def self.new(
64
+ content:,
65
+ tool_use_id:,
66
+ # Create a cache control breakpoint at this content block.
67
+ cache_control: nil,
68
+ type: :text_editor_code_execution_tool_result
69
+ )
70
+ end
71
+
72
+ sig do
73
+ override.returns(
74
+ {
75
+ content:
76
+ T.any(
77
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultErrorParam,
78
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlockParam,
79
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam,
80
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam
81
+ ),
82
+ tool_use_id: String,
83
+ type: Symbol,
84
+ cache_control:
85
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
86
+ }
87
+ )
88
+ end
89
+ def to_hash
90
+ end
91
+
92
+ module Content
93
+ extend Anthropic::Internal::Type::Union
94
+
95
+ Variants =
96
+ T.type_alias do
97
+ T.any(
98
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultErrorParam,
99
+ Anthropic::Beta::BetaTextEditorCodeExecutionViewResultBlockParam,
100
+ Anthropic::Beta::BetaTextEditorCodeExecutionCreateResultBlockParam,
101
+ Anthropic::Beta::BetaTextEditorCodeExecutionStrReplaceResultBlockParam
102
+ )
103
+ end
104
+
105
+ sig do
106
+ override.returns(
107
+ T::Array[
108
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam::Content::Variants
109
+ ]
110
+ )
111
+ end
112
+ def self.variants
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end