anthropic 1.0.0 → 1.1.1

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 (479) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/README.md +33 -9
  4. data/lib/anthropic/client.rb +30 -0
  5. data/lib/anthropic/helpers/bedrock/client.rb +3 -1
  6. data/lib/anthropic/helpers/vertex/client.rb +4 -2
  7. data/lib/anthropic/internal/util.rb +10 -2
  8. data/lib/anthropic/models/anthropic_beta.rb +26 -8
  9. data/lib/anthropic/models/base64_image_source.rb +3 -3
  10. data/lib/anthropic/models/beta/beta_base64_image_source.rb +3 -3
  11. data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +10 -8
  12. data/lib/anthropic/models/beta/beta_cache_control_ephemeral.rb +39 -1
  13. data/lib/anthropic/models/beta/beta_cache_creation.rb +28 -0
  14. data/lib/anthropic/models/beta/beta_citations_delta.rb +4 -4
  15. data/lib/anthropic/models/beta/beta_code_execution_output_block.rb +25 -0
  16. data/lib/anthropic/models/beta/beta_code_execution_output_block_param.rb +25 -0
  17. data/lib/anthropic/models/beta/beta_code_execution_result_block.rb +44 -0
  18. data/lib/anthropic/models/beta/beta_code_execution_result_block_param.rb +44 -0
  19. data/lib/anthropic/models/beta/beta_code_execution_tool_20250522.rb +40 -0
  20. data/lib/anthropic/models/beta/beta_code_execution_tool_result_block.rb +31 -0
  21. data/lib/anthropic/models/beta/beta_code_execution_tool_result_block_content.rb +20 -0
  22. data/lib/anthropic/models/beta/beta_code_execution_tool_result_block_param.rb +41 -0
  23. data/lib/anthropic/models/beta/beta_code_execution_tool_result_block_param_content.rb +20 -0
  24. data/lib/anthropic/models/beta/beta_code_execution_tool_result_error.rb +25 -0
  25. data/lib/anthropic/models/beta/beta_code_execution_tool_result_error_code.rb +21 -0
  26. data/lib/anthropic/models/beta/beta_code_execution_tool_result_error_param.rb +25 -0
  27. data/lib/anthropic/models/beta/beta_container.rb +31 -0
  28. data/lib/anthropic/models/beta/beta_container_upload_block.rb +27 -0
  29. data/lib/anthropic/models/beta/beta_container_upload_block_param.rb +37 -0
  30. data/lib/anthropic/models/beta/beta_content_block.rb +11 -1
  31. data/lib/anthropic/models/beta/beta_content_block_param.rb +23 -5
  32. data/lib/anthropic/models/beta/beta_content_block_source.rb +5 -5
  33. data/lib/anthropic/models/beta/beta_content_block_source_content.rb +1 -1
  34. data/lib/anthropic/models/beta/beta_file_document_source.rb +25 -0
  35. data/lib/anthropic/models/beta/beta_file_image_source.rb +25 -0
  36. data/lib/anthropic/models/beta/beta_image_block_param.rb +8 -6
  37. data/lib/anthropic/models/beta/beta_mcp_tool_result_block.rb +52 -0
  38. data/lib/anthropic/models/beta/beta_mcp_tool_use_block.rb +49 -0
  39. data/lib/anthropic/models/beta/beta_mcp_tool_use_block_param.rb +56 -0
  40. data/lib/anthropic/models/beta/beta_message.rb +19 -10
  41. data/lib/anthropic/models/beta/beta_message_delta_usage.rb +2 -2
  42. data/lib/anthropic/models/beta/beta_message_param.rb +8 -8
  43. data/lib/anthropic/models/beta/beta_message_tokens_count.rb +1 -1
  44. data/lib/anthropic/models/beta/beta_metadata.rb +1 -1
  45. data/lib/anthropic/models/beta/beta_model_info.rb +1 -1
  46. data/lib/anthropic/models/beta/beta_raw_content_block_delta.rb +1 -1
  47. data/lib/anthropic/models/beta/beta_raw_content_block_delta_event.rb +2 -2
  48. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +18 -4
  49. data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +22 -9
  50. data/lib/anthropic/models/beta/beta_raw_message_start_event.rb +2 -2
  51. data/lib/anthropic/models/beta/beta_raw_message_stream_event.rb +1 -1
  52. data/lib/anthropic/models/beta/beta_request_mcp_server_tool_configuration.rb +25 -0
  53. data/lib/anthropic/models/beta/beta_request_mcp_server_url_definition.rb +47 -0
  54. data/lib/anthropic/models/beta/beta_request_mcp_tool_result_block_param.rb +65 -0
  55. data/lib/anthropic/models/beta/beta_server_tool_use_block.rb +15 -4
  56. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +17 -6
  57. data/lib/anthropic/models/beta/beta_text_block.rb +3 -3
  58. data/lib/anthropic/models/beta/beta_text_block_param.rb +4 -4
  59. data/lib/anthropic/models/beta/beta_text_citation.rb +1 -1
  60. data/lib/anthropic/models/beta/beta_text_citation_param.rb +1 -1
  61. data/lib/anthropic/models/beta/beta_thinking_config_enabled.rb +1 -1
  62. data/lib/anthropic/models/beta/beta_thinking_config_param.rb +1 -1
  63. data/lib/anthropic/models/beta/beta_tool.rb +9 -9
  64. data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +3 -3
  65. data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +3 -3
  66. data/lib/anthropic/models/beta/beta_tool_choice.rb +1 -1
  67. data/lib/anthropic/models/beta/beta_tool_choice_any.rb +1 -1
  68. data/lib/anthropic/models/beta/beta_tool_choice_auto.rb +1 -1
  69. data/lib/anthropic/models/beta/beta_tool_choice_tool.rb +1 -1
  70. data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +3 -3
  71. data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +3 -3
  72. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +8 -8
  73. data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +3 -3
  74. data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +3 -3
  75. data/lib/anthropic/models/beta/beta_tool_text_editor_20250429.rb +40 -0
  76. data/lib/anthropic/models/beta/beta_tool_union.rb +5 -1
  77. data/lib/anthropic/models/beta/beta_tool_use_block_param.rb +2 -2
  78. data/lib/anthropic/models/beta/beta_usage.rb +33 -3
  79. data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +8 -7
  80. data/lib/anthropic/models/beta/beta_web_search_tool_request_error.rb +3 -17
  81. data/lib/anthropic/models/beta/beta_web_search_tool_result_block.rb +2 -2
  82. data/lib/anthropic/models/beta/beta_web_search_tool_result_block_content.rb +2 -2
  83. data/lib/anthropic/models/beta/beta_web_search_tool_result_block_param.rb +4 -4
  84. data/lib/anthropic/models/beta/beta_web_search_tool_result_block_param_content.rb +2 -4
  85. data/lib/anthropic/models/beta/beta_web_search_tool_result_error.rb +3 -17
  86. data/lib/anthropic/models/beta/beta_web_search_tool_result_error_code.rb +22 -0
  87. data/lib/anthropic/models/beta/deleted_file.rb +46 -0
  88. data/lib/anthropic/models/beta/file_delete_params.rb +24 -0
  89. data/lib/anthropic/models/beta/file_download_params.rb +24 -0
  90. data/lib/anthropic/models/beta/file_list_params.rb +55 -0
  91. data/lib/anthropic/models/beta/file_metadata.rb +74 -0
  92. data/lib/anthropic/models/beta/file_retrieve_metadata_params.rb +24 -0
  93. data/lib/anthropic/models/beta/file_upload_params.rb +32 -0
  94. data/lib/anthropic/models/beta/message_count_tokens_params.rb +31 -18
  95. data/lib/anthropic/models/beta/message_create_params.rb +63 -19
  96. data/lib/anthropic/models/beta/messages/batch_cancel_params.rb +2 -2
  97. data/lib/anthropic/models/beta/messages/batch_create_params.rb +77 -29
  98. data/lib/anthropic/models/beta/messages/batch_delete_params.rb +2 -2
  99. data/lib/anthropic/models/beta/messages/batch_list_params.rb +2 -2
  100. data/lib/anthropic/models/beta/messages/batch_results_params.rb +2 -2
  101. data/lib/anthropic/models/beta/messages/batch_retrieve_params.rb +2 -2
  102. data/lib/anthropic/models/beta/messages/beta_deleted_message_batch.rb +1 -1
  103. data/lib/anthropic/models/beta/messages/beta_message_batch.rb +6 -6
  104. data/lib/anthropic/models/beta/messages/beta_message_batch_errored_result.rb +2 -2
  105. data/lib/anthropic/models/beta/messages/beta_message_batch_individual_response.rb +3 -3
  106. data/lib/anthropic/models/beta/messages/beta_message_batch_request_counts.rb +2 -1
  107. data/lib/anthropic/models/beta/messages/beta_message_batch_result.rb +1 -1
  108. data/lib/anthropic/models/beta/messages/beta_message_batch_succeeded_result.rb +2 -2
  109. data/lib/anthropic/models/beta/model_list_params.rb +2 -2
  110. data/lib/anthropic/models/beta/model_retrieve_params.rb +2 -2
  111. data/lib/anthropic/models/beta_error.rb +1 -1
  112. data/lib/anthropic/models/beta_error_response.rb +2 -2
  113. data/lib/anthropic/models/citations_delta.rb +4 -4
  114. data/lib/anthropic/models/completion.rb +4 -4
  115. data/lib/anthropic/models/completion_create_params.rb +6 -6
  116. data/lib/anthropic/models/content_block.rb +1 -1
  117. data/lib/anthropic/models/content_block_param.rb +13 -5
  118. data/lib/anthropic/models/content_block_source.rb +5 -5
  119. data/lib/anthropic/models/content_block_source_content.rb +1 -1
  120. data/lib/anthropic/models/document_block_param.rb +8 -8
  121. data/lib/anthropic/models/error_object.rb +1 -1
  122. data/lib/anthropic/models/error_response.rb +2 -2
  123. data/lib/anthropic/models/image_block_param.rb +6 -6
  124. data/lib/anthropic/models/message.rb +10 -10
  125. data/lib/anthropic/models/message_count_tokens_params.rb +14 -14
  126. data/lib/anthropic/models/message_count_tokens_tool.rb +1 -1
  127. data/lib/anthropic/models/message_create_params.rb +44 -17
  128. data/lib/anthropic/models/message_delta_usage.rb +2 -2
  129. data/lib/anthropic/models/message_param.rb +8 -8
  130. data/lib/anthropic/models/message_tokens_count.rb +1 -1
  131. data/lib/anthropic/models/messages/batch_create_params.rb +58 -27
  132. data/lib/anthropic/models/messages/deleted_message_batch.rb +1 -1
  133. data/lib/anthropic/models/messages/message_batch.rb +6 -6
  134. data/lib/anthropic/models/messages/message_batch_errored_result.rb +2 -2
  135. data/lib/anthropic/models/messages/message_batch_individual_response.rb +3 -3
  136. data/lib/anthropic/models/messages/message_batch_request_counts.rb +1 -1
  137. data/lib/anthropic/models/messages/message_batch_result.rb +1 -1
  138. data/lib/anthropic/models/messages/message_batch_succeeded_result.rb +2 -2
  139. data/lib/anthropic/models/metadata.rb +2 -2
  140. data/lib/anthropic/models/model.rb +45 -15
  141. data/lib/anthropic/models/model_info.rb +2 -2
  142. data/lib/anthropic/models/model_list_params.rb +2 -2
  143. data/lib/anthropic/models/model_retrieve_params.rb +2 -2
  144. data/lib/anthropic/models/raw_content_block_delta.rb +1 -1
  145. data/lib/anthropic/models/raw_content_block_delta_event.rb +2 -2
  146. data/lib/anthropic/models/raw_content_block_start_event.rb +4 -4
  147. data/lib/anthropic/models/raw_message_delta_event.rb +8 -8
  148. data/lib/anthropic/models/raw_message_start_event.rb +2 -2
  149. data/lib/anthropic/models/raw_message_stream_event.rb +1 -1
  150. data/lib/anthropic/models/server_tool_use_block_param.rb +2 -2
  151. data/lib/anthropic/models/text_block.rb +4 -4
  152. data/lib/anthropic/models/text_block_param.rb +4 -4
  153. data/lib/anthropic/models/text_citation.rb +1 -1
  154. data/lib/anthropic/models/text_citation_param.rb +1 -1
  155. data/lib/anthropic/models/thinking_config_enabled.rb +1 -1
  156. data/lib/anthropic/models/thinking_config_param.rb +1 -1
  157. data/lib/anthropic/models/tool.rb +10 -10
  158. data/lib/anthropic/models/tool_bash_20250124.rb +3 -3
  159. data/lib/anthropic/models/tool_choice.rb +1 -1
  160. data/lib/anthropic/models/tool_choice_any.rb +2 -2
  161. data/lib/anthropic/models/tool_choice_auto.rb +1 -1
  162. data/lib/anthropic/models/tool_choice_tool.rb +1 -1
  163. data/lib/anthropic/models/tool_result_block_param.rb +8 -8
  164. data/lib/anthropic/models/tool_text_editor_20250124.rb +3 -3
  165. data/lib/anthropic/models/tool_union.rb +1 -1
  166. data/lib/anthropic/models/tool_use_block_param.rb +2 -2
  167. data/lib/anthropic/models/usage.rb +25 -3
  168. data/lib/anthropic/models/web_search_tool_20250305.rb +7 -7
  169. data/lib/anthropic/models/web_search_tool_request_error.rb +3 -3
  170. data/lib/anthropic/models/web_search_tool_result_block.rb +2 -2
  171. data/lib/anthropic/models/web_search_tool_result_block_content.rb +2 -2
  172. data/lib/anthropic/models/web_search_tool_result_block_param.rb +4 -4
  173. data/lib/anthropic/models/web_search_tool_result_block_param_content.rb +2 -2
  174. data/lib/anthropic/models/web_search_tool_result_error.rb +3 -3
  175. data/lib/anthropic/resources/beta/files.rb +153 -0
  176. data/lib/anthropic/resources/beta/messages/batches.rb +13 -13
  177. data/lib/anthropic/resources/beta/messages.rb +57 -30
  178. data/lib/anthropic/resources/beta/models.rb +4 -4
  179. data/lib/anthropic/resources/beta.rb +4 -0
  180. data/lib/anthropic/resources/completions.rb +8 -8
  181. data/lib/anthropic/resources/messages/batches.rb +7 -7
  182. data/lib/anthropic/resources/messages.rb +43 -26
  183. data/lib/anthropic/resources/models.rb +4 -4
  184. data/lib/anthropic/version.rb +1 -1
  185. data/lib/anthropic.rb +37 -1
  186. data/rbi/anthropic/models/anthropic_beta.rbi +24 -0
  187. data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +8 -4
  188. data/rbi/anthropic/models/beta/beta_cache_control_ephemeral.rbi +87 -3
  189. data/rbi/anthropic/models/beta/beta_cache_creation.rbi +52 -0
  190. data/rbi/anthropic/models/beta/beta_code_execution_output_block.rbi +33 -0
  191. data/rbi/anthropic/models/beta/beta_code_execution_output_block_param.rbi +33 -0
  192. data/rbi/anthropic/models/beta/beta_code_execution_result_block.rbi +67 -0
  193. data/rbi/anthropic/models/beta/beta_code_execution_result_block_param.rbi +72 -0
  194. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250522.rbi +72 -0
  195. data/rbi/anthropic/models/beta/beta_code_execution_tool_result_block.rbi +59 -0
  196. data/rbi/anthropic/models/beta/beta_code_execution_tool_result_block_content.rbi +32 -0
  197. data/rbi/anthropic/models/beta/beta_code_execution_tool_result_block_param.rbi +88 -0
  198. data/rbi/anthropic/models/beta/beta_code_execution_tool_result_block_param_content.rbi +32 -0
  199. data/rbi/anthropic/models/beta/beta_code_execution_tool_result_error.rbi +51 -0
  200. data/rbi/anthropic/models/beta/beta_code_execution_tool_result_error_code.rbi +51 -0
  201. data/rbi/anthropic/models/beta/beta_code_execution_tool_result_error_param.rbi +52 -0
  202. data/rbi/anthropic/models/beta/beta_container.rbi +39 -0
  203. data/rbi/anthropic/models/beta/beta_container_upload_block.rbi +34 -0
  204. data/rbi/anthropic/models/beta/beta_container_upload_block_param.rbi +68 -0
  205. data/rbi/anthropic/models/beta/beta_content_block.rbi +5 -0
  206. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +8 -3
  207. data/rbi/anthropic/models/beta/beta_file_document_source.rbi +33 -0
  208. data/rbi/anthropic/models/beta/beta_file_image_source.rbi +33 -0
  209. data/rbi/anthropic/models/beta/beta_image_block_param.rbi +8 -4
  210. data/rbi/anthropic/models/beta/beta_mcp_tool_result_block.rbi +85 -0
  211. data/rbi/anthropic/models/beta/beta_mcp_tool_use_block.rbi +70 -0
  212. data/rbi/anthropic/models/beta/beta_mcp_tool_use_block_param.rbi +86 -0
  213. data/rbi/anthropic/models/beta/beta_message.rbi +21 -0
  214. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +16 -1
  215. data/rbi/anthropic/models/beta/beta_raw_message_delta_event.rbi +21 -1
  216. data/rbi/anthropic/models/beta/beta_request_mcp_server_tool_configuration.rbi +46 -0
  217. data/rbi/anthropic/models/beta/beta_request_mcp_server_url_definition.rbi +86 -0
  218. data/rbi/anthropic/models/beta/beta_request_mcp_tool_result_block_param.rbi +125 -0
  219. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +42 -4
  220. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +38 -4
  221. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250429.rbi +72 -0
  222. data/rbi/anthropic/models/beta/beta_tool_union.rbi +3 -1
  223. data/rbi/anthropic/models/beta/beta_usage.rbi +66 -3
  224. data/rbi/anthropic/models/beta/beta_web_search_tool_request_error.rbi +3 -54
  225. data/rbi/anthropic/models/beta/beta_web_search_tool_result_error.rbi +3 -52
  226. data/rbi/anthropic/models/beta/beta_web_search_tool_result_error_code.rbi +55 -0
  227. data/rbi/anthropic/models/beta/deleted_file.rbi +81 -0
  228. data/rbi/anthropic/models/beta/file_delete_params.rbi +62 -0
  229. data/rbi/anthropic/models/beta/file_download_params.rbi +62 -0
  230. data/rbi/anthropic/models/beta/file_list_params.rbi +100 -0
  231. data/rbi/anthropic/models/beta/file_metadata.rbi +98 -0
  232. data/rbi/anthropic/models/beta/file_retrieve_metadata_params.rbi +62 -0
  233. data/rbi/anthropic/models/beta/file_upload_params.rbi +70 -0
  234. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +43 -5
  235. data/rbi/anthropic/models/beta/message_create_params.rbi +116 -4
  236. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +121 -4
  237. data/rbi/anthropic/models/content_block_param.rbi +3 -2
  238. data/rbi/anthropic/models/message_create_params.rbi +61 -0
  239. data/rbi/anthropic/models/messages/batch_create_params.rbi +71 -0
  240. data/rbi/anthropic/models/model.rbi +26 -2
  241. data/rbi/anthropic/models/usage.rbi +32 -3
  242. data/rbi/anthropic/resources/beta/files.rbi +109 -0
  243. data/rbi/anthropic/resources/beta/messages.rbi +49 -3
  244. data/rbi/anthropic/resources/beta.rbi +3 -0
  245. data/rbi/anthropic/resources/messages.rbi +14 -0
  246. data/sig/anthropic/models/anthropic_beta.rbs +12 -0
  247. data/sig/anthropic/models/api_error_object.rbs +2 -0
  248. data/sig/anthropic/models/authentication_error.rbs +2 -0
  249. data/sig/anthropic/models/base64_image_source.rbs +10 -4
  250. data/sig/anthropic/models/base64_pdf_source.rbs +6 -0
  251. data/sig/anthropic/models/beta/beta_base64_image_source.rbs +10 -4
  252. data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +14 -4
  253. data/sig/anthropic/models/beta/beta_base64_pdf_source.rbs +6 -0
  254. data/sig/anthropic/models/beta/beta_cache_control_ephemeral.rbs +31 -2
  255. data/sig/anthropic/models/beta/beta_cache_creation.rbs +29 -0
  256. data/sig/anthropic/models/beta/beta_citation_char_location.rbs +9 -0
  257. data/sig/anthropic/models/beta/beta_citation_char_location_param.rbs +9 -0
  258. data/sig/anthropic/models/beta/beta_citation_content_block_location.rbs +9 -0
  259. data/sig/anthropic/models/beta/beta_citation_content_block_location_param.rbs +9 -0
  260. data/sig/anthropic/models/beta/beta_citation_page_location.rbs +9 -0
  261. data/sig/anthropic/models/beta/beta_citation_page_location_param.rbs +9 -0
  262. data/sig/anthropic/models/beta/beta_citation_web_search_result_location_param.rbs +8 -0
  263. data/sig/anthropic/models/beta/beta_citations_config_param.rbs +2 -0
  264. data/sig/anthropic/models/beta/beta_citations_delta.rbs +9 -4
  265. data/sig/anthropic/models/beta/beta_citations_web_search_result_location.rbs +8 -0
  266. data/sig/anthropic/models/beta/beta_code_execution_output_block.rbs +20 -0
  267. data/sig/anthropic/models/beta/beta_code_execution_output_block_param.rbs +20 -0
  268. data/sig/anthropic/models/beta/beta_code_execution_result_block.rbs +44 -0
  269. data/sig/anthropic/models/beta/beta_code_execution_result_block_param.rbs +44 -0
  270. data/sig/anthropic/models/beta/beta_code_execution_tool_20250522.rbs +34 -0
  271. data/sig/anthropic/models/beta/beta_code_execution_tool_result_block.rbs +34 -0
  272. data/sig/anthropic/models/beta/beta_code_execution_tool_result_block_content.rbs +17 -0
  273. data/sig/anthropic/models/beta/beta_code_execution_tool_result_block_param.rbs +39 -0
  274. data/sig/anthropic/models/beta/beta_code_execution_tool_result_block_param_content.rbs +17 -0
  275. data/sig/anthropic/models/beta/beta_code_execution_tool_result_error.rbs +29 -0
  276. data/sig/anthropic/models/beta/beta_code_execution_tool_result_error_code.rbs +24 -0
  277. data/sig/anthropic/models/beta/beta_code_execution_tool_result_error_param.rbs +29 -0
  278. data/sig/anthropic/models/beta/beta_container.rbs +19 -0
  279. data/sig/anthropic/models/beta/beta_container_upload_block.rbs +20 -0
  280. data/sig/anthropic/models/beta/beta_container_upload_block_param.rbs +34 -0
  281. data/sig/anthropic/models/beta/beta_content_block.rbs +4 -0
  282. data/sig/anthropic/models/beta/beta_content_block_param.rbs +7 -3
  283. data/sig/anthropic/models/beta/beta_content_block_source.rbs +9 -4
  284. data/sig/anthropic/models/beta/beta_file_document_source.rbs +19 -0
  285. data/sig/anthropic/models/beta/beta_file_image_source.rbs +19 -0
  286. data/sig/anthropic/models/beta/beta_image_block_param.rbs +11 -4
  287. data/sig/anthropic/models/beta/beta_input_json_delta.rbs +2 -0
  288. data/sig/anthropic/models/beta/beta_mcp_tool_result_block.rbs +49 -0
  289. data/sig/anthropic/models/beta/beta_mcp_tool_use_block.rbs +44 -0
  290. data/sig/anthropic/models/beta/beta_mcp_tool_use_block_param.rbs +49 -0
  291. data/sig/anthropic/models/beta/beta_message.rbs +16 -0
  292. data/sig/anthropic/models/beta/beta_message_delta_usage.rbs +8 -0
  293. data/sig/anthropic/models/beta/beta_message_param.rbs +13 -8
  294. data/sig/anthropic/models/beta/beta_message_tokens_count.rbs +2 -0
  295. data/sig/anthropic/models/beta/beta_metadata.rbs +2 -0
  296. data/sig/anthropic/models/beta/beta_model_info.rbs +7 -0
  297. data/sig/anthropic/models/beta/beta_plain_text_source.rbs +2 -0
  298. data/sig/anthropic/models/beta/beta_raw_content_block_delta_event.rbs +6 -0
  299. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +14 -4
  300. data/sig/anthropic/models/beta/beta_raw_content_block_stop_event.rbs +2 -0
  301. data/sig/anthropic/models/beta/beta_raw_message_delta_event.rbs +16 -0
  302. data/sig/anthropic/models/beta/beta_raw_message_start_event.rbs +5 -0
  303. data/sig/anthropic/models/beta/beta_raw_message_stop_event.rbs +2 -0
  304. data/sig/anthropic/models/beta/beta_redacted_thinking_block.rbs +2 -0
  305. data/sig/anthropic/models/beta/beta_redacted_thinking_block_param.rbs +2 -0
  306. data/sig/anthropic/models/beta/beta_request_mcp_server_tool_configuration.rbs +23 -0
  307. data/sig/anthropic/models/beta/beta_request_mcp_server_url_definition.rbs +44 -0
  308. data/sig/anthropic/models/beta/beta_request_mcp_tool_result_block_param.rbs +60 -0
  309. data/sig/anthropic/models/beta/beta_server_tool_usage.rbs +2 -0
  310. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +26 -3
  311. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +22 -3
  312. data/sig/anthropic/models/beta/beta_signature_delta.rbs +2 -0
  313. data/sig/anthropic/models/beta/beta_text_block.rbs +6 -0
  314. data/sig/anthropic/models/beta/beta_text_block_param.rbs +7 -0
  315. data/sig/anthropic/models/beta/beta_text_delta.rbs +2 -0
  316. data/sig/anthropic/models/beta/beta_thinking_block.rbs +2 -0
  317. data/sig/anthropic/models/beta/beta_thinking_block_param.rbs +2 -0
  318. data/sig/anthropic/models/beta/beta_thinking_config_disabled.rbs +2 -0
  319. data/sig/anthropic/models/beta/beta_thinking_config_enabled.rbs +2 -0
  320. data/sig/anthropic/models/beta/beta_thinking_delta.rbs +2 -0
  321. data/sig/anthropic/models/beta/beta_tool.rbs +14 -4
  322. data/sig/anthropic/models/beta/beta_tool_bash_20241022.rbs +6 -0
  323. data/sig/anthropic/models/beta/beta_tool_bash_20250124.rbs +6 -0
  324. data/sig/anthropic/models/beta/beta_tool_choice_any.rbs +2 -0
  325. data/sig/anthropic/models/beta/beta_tool_choice_auto.rbs +2 -0
  326. data/sig/anthropic/models/beta/beta_tool_choice_none.rbs +2 -0
  327. data/sig/anthropic/models/beta/beta_tool_choice_tool.rbs +6 -0
  328. data/sig/anthropic/models/beta/beta_tool_computer_use_20241022.rbs +9 -0
  329. data/sig/anthropic/models/beta/beta_tool_computer_use_20250124.rbs +9 -0
  330. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +16 -8
  331. data/sig/anthropic/models/beta/beta_tool_text_editor_20241022.rbs +6 -0
  332. data/sig/anthropic/models/beta/beta_tool_text_editor_20250124.rbs +6 -0
  333. data/sig/anthropic/models/beta/beta_tool_text_editor_20250429.rbs +34 -0
  334. data/sig/anthropic/models/beta/beta_tool_union.rbs +2 -0
  335. data/sig/anthropic/models/beta/beta_tool_use_block.rbs +7 -0
  336. data/sig/anthropic/models/beta/beta_tool_use_block_param.rbs +8 -0
  337. data/sig/anthropic/models/beta/beta_url_image_source.rbs +2 -0
  338. data/sig/anthropic/models/beta/beta_url_pdf_source.rbs +2 -0
  339. data/sig/anthropic/models/beta/beta_usage.rbs +32 -2
  340. data/sig/anthropic/models/beta/beta_web_search_result_block.rbs +8 -0
  341. data/sig/anthropic/models/beta/beta_web_search_result_block_param.rbs +8 -0
  342. data/sig/anthropic/models/beta/beta_web_search_tool_20250305.rbs +18 -0
  343. data/sig/anthropic/models/beta/beta_web_search_tool_request_error.rbs +7 -21
  344. data/sig/anthropic/models/beta/beta_web_search_tool_result_block.rbs +6 -0
  345. data/sig/anthropic/models/beta/beta_web_search_tool_result_block_param.rbs +7 -0
  346. data/sig/anthropic/models/beta/beta_web_search_tool_result_error.rbs +7 -21
  347. data/sig/anthropic/models/beta/beta_web_search_tool_result_error_code.rbs +26 -0
  348. data/sig/anthropic/models/beta/deleted_file.rbs +38 -0
  349. data/sig/anthropic/models/beta/file_delete_params.rbs +30 -0
  350. data/sig/anthropic/models/beta/file_download_params.rbs +30 -0
  351. data/sig/anthropic/models/beta/file_list_params.rbs +53 -0
  352. data/sig/anthropic/models/beta/file_metadata.rbs +54 -0
  353. data/sig/anthropic/models/beta/file_retrieve_metadata_params.rbs +30 -0
  354. data/sig/anthropic/models/beta/file_upload_params.rbs +37 -0
  355. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +28 -6
  356. data/sig/anthropic/models/beta/message_create_params.rbs +51 -0
  357. data/sig/anthropic/models/beta/messages/batch_cancel_params.rbs +5 -0
  358. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +67 -6
  359. data/sig/anthropic/models/beta/messages/batch_delete_params.rbs +5 -0
  360. data/sig/anthropic/models/beta/messages/batch_list_params.rbs +8 -0
  361. data/sig/anthropic/models/beta/messages/batch_results_params.rbs +5 -0
  362. data/sig/anthropic/models/beta/messages/batch_retrieve_params.rbs +5 -0
  363. data/sig/anthropic/models/beta/messages/beta_deleted_message_batch.rbs +2 -0
  364. data/sig/anthropic/models/beta/messages/beta_message_batch.rbs +17 -4
  365. data/sig/anthropic/models/beta/messages/beta_message_batch_canceled_result.rbs +2 -0
  366. data/sig/anthropic/models/beta/messages/beta_message_batch_errored_result.rbs +5 -0
  367. data/sig/anthropic/models/beta/messages/beta_message_batch_expired_result.rbs +2 -0
  368. data/sig/anthropic/models/beta/messages/beta_message_batch_individual_response.rbs +5 -0
  369. data/sig/anthropic/models/beta/messages/beta_message_batch_request_counts.rbs +8 -0
  370. data/sig/anthropic/models/beta/messages/beta_message_batch_succeeded_result.rbs +5 -0
  371. data/sig/anthropic/models/beta/model_list_params.rbs +8 -0
  372. data/sig/anthropic/models/beta/model_retrieve_params.rbs +5 -0
  373. data/sig/anthropic/models/beta_api_error.rbs +2 -0
  374. data/sig/anthropic/models/beta_authentication_error.rbs +2 -0
  375. data/sig/anthropic/models/beta_billing_error.rbs +2 -0
  376. data/sig/anthropic/models/beta_error_response.rbs +2 -0
  377. data/sig/anthropic/models/beta_gateway_timeout_error.rbs +2 -0
  378. data/sig/anthropic/models/beta_invalid_request_error.rbs +2 -0
  379. data/sig/anthropic/models/beta_not_found_error.rbs +2 -0
  380. data/sig/anthropic/models/beta_overloaded_error.rbs +2 -0
  381. data/sig/anthropic/models/beta_permission_error.rbs +2 -0
  382. data/sig/anthropic/models/beta_rate_limit_error.rbs +2 -0
  383. data/sig/anthropic/models/billing_error.rbs +2 -0
  384. data/sig/anthropic/models/cache_control_ephemeral.rbs +2 -0
  385. data/sig/anthropic/models/citation_char_location.rbs +9 -0
  386. data/sig/anthropic/models/citation_char_location_param.rbs +9 -0
  387. data/sig/anthropic/models/citation_content_block_location.rbs +9 -0
  388. data/sig/anthropic/models/citation_content_block_location_param.rbs +9 -0
  389. data/sig/anthropic/models/citation_page_location.rbs +9 -0
  390. data/sig/anthropic/models/citation_page_location_param.rbs +9 -0
  391. data/sig/anthropic/models/citation_web_search_result_location_param.rbs +8 -0
  392. data/sig/anthropic/models/citations_config_param.rbs +2 -0
  393. data/sig/anthropic/models/citations_delta.rbs +12 -4
  394. data/sig/anthropic/models/citations_web_search_result_location.rbs +8 -0
  395. data/sig/anthropic/models/completion.rbs +8 -0
  396. data/sig/anthropic/models/completion_create_params.rbs +13 -0
  397. data/sig/anthropic/models/content_block_param.rbs +3 -3
  398. data/sig/anthropic/models/content_block_source.rbs +12 -4
  399. data/sig/anthropic/models/document_block_param.rbs +13 -4
  400. data/sig/anthropic/models/error_response.rbs +2 -0
  401. data/sig/anthropic/models/gateway_timeout_error.rbs +2 -0
  402. data/sig/anthropic/models/image_block_param.rbs +10 -4
  403. data/sig/anthropic/models/input_json_delta.rbs +2 -0
  404. data/sig/anthropic/models/invalid_request_error.rbs +2 -0
  405. data/sig/anthropic/models/message.rbs +11 -0
  406. data/sig/anthropic/models/message_count_tokens_params.rbs +10 -0
  407. data/sig/anthropic/models/message_create_params.rbs +36 -0
  408. data/sig/anthropic/models/message_delta_usage.rbs +8 -0
  409. data/sig/anthropic/models/message_param.rbs +13 -8
  410. data/sig/anthropic/models/message_tokens_count.rbs +2 -0
  411. data/sig/anthropic/models/messages/batch_cancel_params.rbs +2 -0
  412. data/sig/anthropic/models/messages/batch_create_params.rbs +52 -6
  413. data/sig/anthropic/models/messages/batch_delete_params.rbs +2 -0
  414. data/sig/anthropic/models/messages/batch_list_params.rbs +7 -0
  415. data/sig/anthropic/models/messages/batch_results_params.rbs +2 -0
  416. data/sig/anthropic/models/messages/batch_retrieve_params.rbs +2 -0
  417. data/sig/anthropic/models/messages/deleted_message_batch.rbs +2 -0
  418. data/sig/anthropic/models/messages/message_batch.rbs +17 -4
  419. data/sig/anthropic/models/messages/message_batch_canceled_result.rbs +2 -0
  420. data/sig/anthropic/models/messages/message_batch_errored_result.rbs +2 -0
  421. data/sig/anthropic/models/messages/message_batch_expired_result.rbs +2 -0
  422. data/sig/anthropic/models/messages/message_batch_individual_response.rbs +5 -0
  423. data/sig/anthropic/models/messages/message_batch_request_counts.rbs +8 -0
  424. data/sig/anthropic/models/messages/message_batch_succeeded_result.rbs +2 -0
  425. data/sig/anthropic/models/metadata.rbs +2 -0
  426. data/sig/anthropic/models/model.rbs +26 -2
  427. data/sig/anthropic/models/model_info.rbs +7 -0
  428. data/sig/anthropic/models/model_list_params.rbs +8 -0
  429. data/sig/anthropic/models/model_retrieve_params.rbs +5 -0
  430. data/sig/anthropic/models/not_found_error.rbs +2 -0
  431. data/sig/anthropic/models/overloaded_error.rbs +2 -0
  432. data/sig/anthropic/models/permission_error.rbs +2 -0
  433. data/sig/anthropic/models/plain_text_source.rbs +2 -0
  434. data/sig/anthropic/models/rate_limit_error.rbs +2 -0
  435. data/sig/anthropic/models/raw_content_block_delta_event.rbs +6 -0
  436. data/sig/anthropic/models/raw_content_block_start_event.rbs +10 -4
  437. data/sig/anthropic/models/raw_content_block_stop_event.rbs +2 -0
  438. data/sig/anthropic/models/raw_message_delta_event.rbs +11 -0
  439. data/sig/anthropic/models/raw_message_start_event.rbs +2 -0
  440. data/sig/anthropic/models/raw_message_stop_event.rbs +2 -0
  441. data/sig/anthropic/models/redacted_thinking_block.rbs +2 -0
  442. data/sig/anthropic/models/redacted_thinking_block_param.rbs +2 -0
  443. data/sig/anthropic/models/server_tool_usage.rbs +2 -0
  444. data/sig/anthropic/models/server_tool_use_block.rbs +7 -0
  445. data/sig/anthropic/models/server_tool_use_block_param.rbs +8 -0
  446. data/sig/anthropic/models/signature_delta.rbs +2 -0
  447. data/sig/anthropic/models/text_block.rbs +6 -0
  448. data/sig/anthropic/models/text_block_param.rbs +7 -0
  449. data/sig/anthropic/models/text_delta.rbs +2 -0
  450. data/sig/anthropic/models/thinking_block.rbs +2 -0
  451. data/sig/anthropic/models/thinking_block_param.rbs +2 -0
  452. data/sig/anthropic/models/thinking_config_disabled.rbs +2 -0
  453. data/sig/anthropic/models/thinking_config_enabled.rbs +2 -0
  454. data/sig/anthropic/models/thinking_delta.rbs +2 -0
  455. data/sig/anthropic/models/tool.rbs +14 -4
  456. data/sig/anthropic/models/tool_bash_20250124.rbs +6 -0
  457. data/sig/anthropic/models/tool_choice_any.rbs +2 -0
  458. data/sig/anthropic/models/tool_choice_auto.rbs +2 -0
  459. data/sig/anthropic/models/tool_choice_none.rbs +2 -0
  460. data/sig/anthropic/models/tool_choice_tool.rbs +6 -0
  461. data/sig/anthropic/models/tool_result_block_param.rbs +17 -8
  462. data/sig/anthropic/models/tool_text_editor_20250124.rbs +6 -0
  463. data/sig/anthropic/models/tool_use_block.rbs +2 -0
  464. data/sig/anthropic/models/tool_use_block_param.rbs +8 -0
  465. data/sig/anthropic/models/url_image_source.rbs +2 -0
  466. data/sig/anthropic/models/url_pdf_source.rbs +2 -0
  467. data/sig/anthropic/models/usage.rbs +27 -2
  468. data/sig/anthropic/models/web_search_result_block.rbs +8 -0
  469. data/sig/anthropic/models/web_search_result_block_param.rbs +8 -0
  470. data/sig/anthropic/models/web_search_tool_20250305.rbs +18 -0
  471. data/sig/anthropic/models/web_search_tool_request_error.rbs +9 -4
  472. data/sig/anthropic/models/web_search_tool_result_block.rbs +6 -0
  473. data/sig/anthropic/models/web_search_tool_result_block_param.rbs +7 -0
  474. data/sig/anthropic/models/web_search_tool_result_error.rbs +9 -4
  475. data/sig/anthropic/resources/beta/files.rbs +41 -0
  476. data/sig/anthropic/resources/beta/messages.rbs +8 -1
  477. data/sig/anthropic/resources/beta.rbs +2 -0
  478. data/sig/anthropic/resources/messages.rbs +2 -0
  479. metadata +104 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62a7b515abd75bfa35748c96add9a790088a6b69a3ce6397f92e1e6454d165b2
4
- data.tar.gz: 38dc35edae168d73a6fc963bfb1832d3f18a193b6c931b33aba7a05e381fff87
3
+ metadata.gz: 13b85406d88291ad8b4617f040286edefe795c4b0400312d0a630dfe30a70bf6
4
+ data.tar.gz: 3467c4167d8db97ecc9bd2dbf049f6795ac7d6474ad8e3b1c1d0414aee1d297e
5
5
  SHA512:
6
- metadata.gz: 996716ea5ca5ff8583889e73bf85cdce945a4f89e5b9418f197e17643006ab29e60413480621f68cf22e8935677a986c72f15a501c7f70e7b74b08b69680d298
7
- data.tar.gz: 47e1634631849390aad56914667b4905d8a7bdc6e29c8404fbe93ca1d7706e58828a5c2c6b1c9afa385ab84ed2cbcb5b0c690d0d07653332be0f5a1763993d9c
6
+ metadata.gz: d5ea1bd30663111c0cf3d5681469b9186621bf2eb8009f38e3aea031092f5b4a1bf091b484c8bb40b8214977ff29efc19ef03b25ed7479cd69e6c9d528a5f06a
7
+ data.tar.gz: d7afee44eb07c19934d5691b7b2d7e55fbdbcd88b82dc3ae65d71cc4e00ab6093836da1c4158e68f8d0fd48a9520993350abb4c29957785edcd68862cafaa3f8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.1 (2025-05-28)
4
+
5
+ Full Changelog: [v1.1.0...v1.1.1](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.1.0...v1.1.1)
6
+
7
+ ### Bug Fixes
8
+
9
+ * prevent rubocop from mangling `===` to `is_a?` check ([303ad55](https://github.com/anthropics/anthropic-sdk-ruby/commit/303ad550c542c726b2ce8bc3d53e01108af634d5))
10
+ * sorbet types for enums, and make tapioca detection ignore `tapioca dsl` ([fb289a1](https://github.com/anthropics/anthropic-sdk-ruby/commit/fb289a1be37379cea207b024e0fb4503ea174639))
11
+
12
+
13
+ ### Chores
14
+
15
+ * add more examples ([e14665e](https://github.com/anthropics/anthropic-sdk-ruby/commit/e14665e4e236cce4a17de06507d1b855d1d153d2))
16
+ * image example ([#621](https://github.com/anthropics/anthropic-sdk-ruby/issues/621)) ([9bdc648](https://github.com/anthropics/anthropic-sdk-ruby/commit/9bdc6487d77d856c87d658917f53faa6f12bc38f))
17
+ * **internal:** fix release workflows ([fffb4b8](https://github.com/anthropics/anthropic-sdk-ruby/commit/fffb4b8eeff759ac98e9cfb5d778b014336e2956))
18
+ * more examples ([#619](https://github.com/anthropics/anthropic-sdk-ruby/issues/619)) ([e14665e](https://github.com/anthropics/anthropic-sdk-ruby/commit/e14665e4e236cce4a17de06507d1b855d1d153d2))
19
+
20
+ ## 1.1.0 (2025-05-22)
21
+
22
+ Full Changelog: [v1.0.0...v1.1.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.0.0...v1.1.0)
23
+
24
+ ### Features
25
+
26
+ * **api:** add claude 4 models, files API, code execution tool, MCP connector and more ([5dd465d](https://github.com/anthropics/anthropic-sdk-ruby/commit/5dd465dac56891b5f21e51e73edac15131d04453))
27
+
28
+
29
+ ### Chores
30
+
31
+ * use fully qualified names for yard annotations and rbs aliases ([80332a0](https://github.com/anthropics/anthropic-sdk-ruby/commit/80332a019ae8bb49d839516256fc4314db7648b9))
32
+
3
33
  ## 1.0.0 (2025-05-21)
4
34
 
5
35
  Full Changelog: [v0.1.0-beta.9...v1.0.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v0.1.0-beta.9...v1.0.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "anthropic", "~> 1.0.0"
18
+ gem "anthropic", "~> 1.1.1"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -91,6 +91,28 @@ if page.next_page?
91
91
  end
92
92
  ```
93
93
 
94
+ ### File uploads
95
+
96
+ Request parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.
97
+
98
+ ```ruby
99
+ require "pathname"
100
+
101
+ # Use `Pathname` to send the filename and/or avoid paging a large file into memory:
102
+ file_metadata = anthropic.beta.files.upload(file: Pathname("/path/to/file"))
103
+
104
+ # Alternatively, pass file contents or a `StringIO` directly:
105
+ file_metadata = anthropic.beta.files.upload(file: File.read("/path/to/file"))
106
+
107
+ # Or, to control the filename and/or content type:
108
+ file = Anthropic::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")
109
+ file_metadata = anthropic.beta.files.upload(file: file)
110
+
111
+ puts(file_metadata.id)
112
+ ```
113
+
114
+ Note that you can also pass a raw `IO` descriptor, but this disables retries, as the library can't be sure if the descriptor is a file or pipe (which cannot be rewound).
115
+
94
116
  ### Handling errors
95
117
 
96
118
  When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Anthropic::Errors::APIError` will be thrown:
@@ -339,23 +361,25 @@ anthropic.messages.create(**params)
339
361
  Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
340
362
 
341
363
  ```ruby
342
- # :"image/jpeg"
343
- puts(Anthropic::Base64ImageSource::MediaType::IMAGE_JPEG)
364
+ # :auto
365
+ puts(Anthropic::MessageCreateParams::ServiceTier::AUTO)
344
366
 
345
- # Revealed type: `T.all(Anthropic::Base64ImageSource::MediaType, Symbol)`
346
- T.reveal_type(Anthropic::Base64ImageSource::MediaType::IMAGE_JPEG)
367
+ # Revealed type: `T.all(Anthropic::MessageCreateParams::ServiceTier, Symbol)`
368
+ T.reveal_type(Anthropic::MessageCreateParams::ServiceTier::AUTO)
347
369
  ```
348
370
 
349
371
  Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
350
372
 
351
373
  ```ruby
352
- Anthropic::Base64ImageSource.new(
353
- media_type: Anthropic::Base64ImageSource::MediaType::IMAGE_JPEG,
374
+ # Using the enum constants preserves the tagged type information:
375
+ anthropic.messages.create(
376
+ service_tier: Anthropic::MessageCreateParams::ServiceTier::AUTO,
354
377
  # …
355
378
  )
356
379
 
357
- Anthropic::Base64ImageSource.new(
358
- media_type: :"image/jpeg",
380
+ # Literal values are also permissible:
381
+ anthropic.messages.create(
382
+ service_tier: :auto,
359
383
  # …
360
384
  )
361
385
  ```
@@ -15,6 +15,15 @@ module Anthropic
15
15
  # Default max retry delay in seconds.
16
16
  DEFAULT_MAX_RETRY_DELAY = 8.0
17
17
 
18
+ # Models that have specific non-streaming token limits
19
+ MODEL_NONSTREAMING_TOKENS = {
20
+ "claude-opus-4-20250514": 8_192,
21
+ "claude-opus-4-0": 8_192,
22
+ "claude-4-opus-20250514": 8_192,
23
+ "anthropic.claude-opus-4-20250514-v1:0": 8_192,
24
+ "claude-opus-4@20250514": 8_192
25
+ }.freeze
26
+
18
27
  # @return [String, nil]
19
28
  attr_reader :api_key
20
29
 
@@ -56,6 +65,27 @@ module Anthropic
56
65
  {"authorization" => "Bearer #{@auth_token}"}
57
66
  end
58
67
 
68
+ # Calculate the timeout for non-streaming requests based on token count
69
+ #
70
+ # @param max_tokens [Integer] The maximum number of tokens to generate
71
+ # @param max_nonstreaming_tokens [Integer, nil] The maximum tokens allowed for non-streaming
72
+ # @return [Float] The calculated timeout in seconds
73
+ # @raise [ArgumentError] If expected time exceeds default time or max_tokens exceeds max_nonstreaming_tokens
74
+ def calculate_nonstreaming_timeout(max_tokens, max_nonstreaming_tokens = nil)
75
+ maximum_time = 60 * 60 # 1 hour in seconds
76
+ default_time = 60 * 10 # 10 minutes in seconds
77
+
78
+ expected_time = maximum_time * max_tokens / 128_000.0
79
+ if expected_time > default_time || (max_nonstreaming_tokens && max_tokens > max_nonstreaming_tokens)
80
+ raise ArgumentError.new(
81
+ "Streaming is strongly recommended for operations that may take longer than 10 minutes. " \
82
+ "See https://github.com/anthropics/anthropic-sdk-ruby#long-requests for more details"
83
+ )
84
+ end
85
+
86
+ DEFAULT_TIMEOUT_IN_SECONDS
87
+ end
88
+
59
89
  # Creates and returns a new client for interacting with the API.
60
90
  #
61
91
  # @param api_key [String, nil] Defaults to `ENV["ANTHROPIC_API_KEY"]`
@@ -62,7 +62,7 @@ module Anthropic
62
62
  begin
63
63
  require("aws-sdk-bedrockruntime")
64
64
  rescue LoadError
65
- raise <<~MSG
65
+ message = <<~MSG
66
66
 
67
67
  In order to access Anthropic models on Bedrock you must require the `aws-sdk-bedrockruntime` gem.
68
68
  You can install it by adding the following to your Gemfile:
@@ -75,6 +75,8 @@ module Anthropic
75
75
 
76
76
  gem install aws-sdk-bedrockruntime
77
77
  MSG
78
+
79
+ raise RuntimeError.new(message)
78
80
  end
79
81
 
80
82
  @aws_region, @aws_credentials = resolve_region_and_credentials(
@@ -49,7 +49,7 @@ module Anthropic
49
49
  begin
50
50
  require("googleauth")
51
51
  rescue LoadError
52
- raise <<~MSG
52
+ message = <<~MSG
53
53
 
54
54
  In order to access Anthropic models on Vertex you must require the `googleauth` gem.
55
55
  You can install it by adding the following to your Gemfile:
@@ -62,6 +62,8 @@ module Anthropic
62
62
 
63
63
  gem install googleauth
64
64
  MSG
65
+
66
+ raise RuntimeError.new(message)
65
67
  end
66
68
 
67
69
  if region.to_s.empty?
@@ -185,7 +187,7 @@ module Anthropic
185
187
  ].include?(request_components[:path]) && request_components[:method] == :post
186
188
 
187
189
  unless body.is_a?(Hash)
188
- raise Anthropic::Error, "Expected json data to be a hash for post /v1/messages"
190
+ raise ArgumentError.new("Expected json data to be a hash for post /v1/messages")
189
191
  end
190
192
 
191
193
  model = body.delete(:model)
@@ -600,11 +600,13 @@ module Anthropic
600
600
  #
601
601
  # @return [Object]
602
602
  def encode_content(headers, body)
603
+ # rubocop:disable Style/CaseEquality
604
+ # rubocop:disable Layout/LineLength
603
605
  content_type = headers["content-type"]
604
606
  case [content_type, body]
605
607
  in [Anthropic::Internal::Util::JSON_CONTENT, Hash | Array | -> { primitive?(_1) }]
606
608
  [headers, JSON.generate(body)]
607
- in [Anthropic::Internal::Util::JSONL_CONTENT, Enumerable] unless body.is_a?(Anthropic::Internal::Type::FileInput)
609
+ in [Anthropic::Internal::Util::JSONL_CONTENT, Enumerable] unless Anthropic::Internal::Type::FileInput === body
608
610
  [headers, body.lazy.map { JSON.generate(_1) }]
609
611
  in [%r{^multipart/form-data}, Hash | Anthropic::Internal::Type::FileInput]
610
612
  boundary, strio = encode_multipart_streaming(body)
@@ -619,6 +621,8 @@ module Anthropic
619
621
  else
620
622
  [headers, body]
621
623
  end
624
+ # rubocop:enable Layout/LineLength
625
+ # rubocop:enable Style/CaseEquality
622
626
  end
623
627
 
624
628
  # @api private
@@ -871,8 +875,12 @@ module Anthropic
871
875
  case type
872
876
  in Anthropic::Internal::Util::SorbetRuntimeSupport
873
877
  type.to_sorbet_type
874
- else
878
+ in Class | Module
875
879
  type
880
+ in true | false
881
+ T::Boolean
882
+ else
883
+ type.class
876
884
  end
877
885
  end
878
886
  end
@@ -7,21 +7,33 @@ module Anthropic
7
7
 
8
8
  variant String
9
9
 
10
- variant const: -> { Anthropic::AnthropicBeta::MESSAGE_BATCHES_2024_09_24 }
10
+ variant const: -> { Anthropic::Models::AnthropicBeta::MESSAGE_BATCHES_2024_09_24 }
11
11
 
12
- variant const: -> { Anthropic::AnthropicBeta::PROMPT_CACHING_2024_07_31 }
12
+ variant const: -> { Anthropic::Models::AnthropicBeta::PROMPT_CACHING_2024_07_31 }
13
13
 
14
- variant const: -> { Anthropic::AnthropicBeta::COMPUTER_USE_2024_10_22 }
14
+ variant const: -> { Anthropic::Models::AnthropicBeta::COMPUTER_USE_2024_10_22 }
15
15
 
16
- variant const: -> { Anthropic::AnthropicBeta::COMPUTER_USE_2025_01_24 }
16
+ variant const: -> { Anthropic::Models::AnthropicBeta::COMPUTER_USE_2025_01_24 }
17
17
 
18
- variant const: -> { Anthropic::AnthropicBeta::PDFS_2024_09_25 }
18
+ variant const: -> { Anthropic::Models::AnthropicBeta::PDFS_2024_09_25 }
19
19
 
20
- variant const: -> { Anthropic::AnthropicBeta::TOKEN_COUNTING_2024_11_01 }
20
+ variant const: -> { Anthropic::Models::AnthropicBeta::TOKEN_COUNTING_2024_11_01 }
21
21
 
22
- variant const: -> { Anthropic::AnthropicBeta::TOKEN_EFFICIENT_TOOLS_2025_02_19 }
22
+ variant const: -> { Anthropic::Models::AnthropicBeta::TOKEN_EFFICIENT_TOOLS_2025_02_19 }
23
23
 
24
- variant const: -> { Anthropic::AnthropicBeta::OUTPUT_128K_2025_02_19 }
24
+ variant const: -> { Anthropic::Models::AnthropicBeta::OUTPUT_128K_2025_02_19 }
25
+
26
+ variant const: -> { Anthropic::Models::AnthropicBeta::FILES_API_2025_04_14 }
27
+
28
+ variant const: -> { Anthropic::Models::AnthropicBeta::MCP_CLIENT_2025_04_04 }
29
+
30
+ variant const: -> { Anthropic::Models::AnthropicBeta::DEV_FULL_THINKING_2025_05_14 }
31
+
32
+ variant const: -> { Anthropic::Models::AnthropicBeta::INTERLEAVED_THINKING_2025_05_14 }
33
+
34
+ variant const: -> { Anthropic::Models::AnthropicBeta::CODE_EXECUTION_2025_05_22 }
35
+
36
+ variant const: -> { Anthropic::Models::AnthropicBeta::EXTENDED_CACHE_TTL_2025_04_11 }
25
37
 
26
38
  # @!method self.variants
27
39
  # @return [Array(String, Symbol)]
@@ -40,6 +52,12 @@ module Anthropic
40
52
  TOKEN_COUNTING_2024_11_01 = :"token-counting-2024-11-01"
41
53
  TOKEN_EFFICIENT_TOOLS_2025_02_19 = :"token-efficient-tools-2025-02-19"
42
54
  OUTPUT_128K_2025_02_19 = :"output-128k-2025-02-19"
55
+ FILES_API_2025_04_14 = :"files-api-2025-04-14"
56
+ MCP_CLIENT_2025_04_04 = :"mcp-client-2025-04-04"
57
+ DEV_FULL_THINKING_2025_05_14 = :"dev-full-thinking-2025-05-14"
58
+ INTERLEAVED_THINKING_2025_05_14 = :"interleaved-thinking-2025-05-14"
59
+ CODE_EXECUTION_2025_05_22 = :"code-execution-2025-05-22"
60
+ EXTENDED_CACHE_TTL_2025_04_11 = :"extended-cache-ttl-2025-04-11"
43
61
 
44
62
  # @!endgroup
45
63
  end
@@ -10,7 +10,7 @@ module Anthropic
10
10
 
11
11
  # @!attribute media_type
12
12
  #
13
- # @return [Symbol, Anthropic::Base64ImageSource::MediaType]
13
+ # @return [Symbol, Anthropic::Models::Base64ImageSource::MediaType]
14
14
  required :media_type, enum: -> { Anthropic::Base64ImageSource::MediaType }
15
15
 
16
16
  # @!attribute type
@@ -20,10 +20,10 @@ module Anthropic
20
20
 
21
21
  # @!method initialize(data:, media_type:, type: :base64)
22
22
  # @param data [String]
23
- # @param media_type [Symbol, Anthropic::Base64ImageSource::MediaType]
23
+ # @param media_type [Symbol, Anthropic::Models::Base64ImageSource::MediaType]
24
24
  # @param type [Symbol, :base64]
25
25
 
26
- # @see Anthropic::Base64ImageSource#media_type
26
+ # @see Anthropic::Models::Base64ImageSource#media_type
27
27
  module MediaType
28
28
  extend Anthropic::Internal::Type::Enum
29
29
 
@@ -11,7 +11,7 @@ module Anthropic
11
11
 
12
12
  # @!attribute media_type
13
13
  #
14
- # @return [Symbol, Anthropic::Beta::BetaBase64ImageSource::MediaType]
14
+ # @return [Symbol, Anthropic::Models::Beta::BetaBase64ImageSource::MediaType]
15
15
  required :media_type, enum: -> { Anthropic::Beta::BetaBase64ImageSource::MediaType }
16
16
 
17
17
  # @!attribute type
@@ -21,10 +21,10 @@ module Anthropic
21
21
 
22
22
  # @!method initialize(data:, media_type:, type: :base64)
23
23
  # @param data [String]
24
- # @param media_type [Symbol, Anthropic::Beta::BetaBase64ImageSource::MediaType]
24
+ # @param media_type [Symbol, Anthropic::Models::Beta::BetaBase64ImageSource::MediaType]
25
25
  # @param type [Symbol, :base64]
26
26
 
27
- # @see Anthropic::Beta::BetaBase64ImageSource#media_type
27
+ # @see Anthropic::Models::Beta::BetaBase64ImageSource#media_type
28
28
  module MediaType
29
29
  extend Anthropic::Internal::Type::Enum
30
30
 
@@ -6,7 +6,7 @@ module Anthropic
6
6
  class BetaBase64PDFBlock < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute source
8
8
  #
9
- # @return [Anthropic::Beta::BetaBase64PDFSource, Anthropic::Beta::BetaPlainTextSource, Anthropic::Beta::BetaContentBlockSource, Anthropic::Beta::BetaURLPDFSource]
9
+ # @return [Anthropic::Models::Beta::BetaBase64PDFSource, Anthropic::Models::Beta::BetaPlainTextSource, Anthropic::Models::Beta::BetaContentBlockSource, Anthropic::Models::Beta::BetaURLPDFSource, Anthropic::Models::Beta::BetaFileDocumentSource]
10
10
  required :source, union: -> { Anthropic::Beta::BetaBase64PDFBlock::Source }
11
11
 
12
12
  # @!attribute type
@@ -17,12 +17,12 @@ module Anthropic
17
17
  # @!attribute cache_control
18
18
  # Create a cache control breakpoint at this content block.
19
19
  #
20
- # @return [Anthropic::Beta::BetaCacheControlEphemeral, nil]
20
+ # @return [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil]
21
21
  optional :cache_control, -> { Anthropic::Beta::BetaCacheControlEphemeral }, nil?: true
22
22
 
23
23
  # @!attribute citations
24
24
  #
25
- # @return [Anthropic::Beta::BetaCitationsConfigParam, nil]
25
+ # @return [Anthropic::Models::Beta::BetaCitationsConfigParam, nil]
26
26
  optional :citations, -> { Anthropic::Beta::BetaCitationsConfigParam }
27
27
 
28
28
  # @!attribute context
@@ -36,11 +36,11 @@ module Anthropic
36
36
  optional :title, String, nil?: true
37
37
 
38
38
  # @!method initialize(source:, cache_control: nil, citations: nil, context: nil, title: nil, type: :document)
39
- # @param source [Anthropic::Beta::BetaBase64PDFSource, Anthropic::Beta::BetaPlainTextSource, Anthropic::Beta::BetaContentBlockSource, Anthropic::Beta::BetaURLPDFSource]
39
+ # @param source [Anthropic::Models::Beta::BetaBase64PDFSource, Anthropic::Models::Beta::BetaPlainTextSource, Anthropic::Models::Beta::BetaContentBlockSource, Anthropic::Models::Beta::BetaURLPDFSource, Anthropic::Models::Beta::BetaFileDocumentSource]
40
40
  #
41
- # @param cache_control [Anthropic::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
41
+ # @param cache_control [Anthropic::Models::Beta::BetaCacheControlEphemeral, nil] Create a cache control breakpoint at this content block.
42
42
  #
43
- # @param citations [Anthropic::Beta::BetaCitationsConfigParam]
43
+ # @param citations [Anthropic::Models::Beta::BetaCitationsConfigParam]
44
44
  #
45
45
  # @param context [String, nil]
46
46
  #
@@ -48,7 +48,7 @@ module Anthropic
48
48
  #
49
49
  # @param type [Symbol, :document]
50
50
 
51
- # @see Anthropic::Beta::BetaBase64PDFBlock#source
51
+ # @see Anthropic::Models::Beta::BetaBase64PDFBlock#source
52
52
  module Source
53
53
  extend Anthropic::Internal::Type::Union
54
54
 
@@ -62,8 +62,10 @@ module Anthropic
62
62
 
63
63
  variant :url, -> { Anthropic::Beta::BetaURLPDFSource }
64
64
 
65
+ variant :file, -> { Anthropic::Beta::BetaFileDocumentSource }
66
+
65
67
  # @!method self.variants
66
- # @return [Array(Anthropic::Beta::BetaBase64PDFSource, Anthropic::Beta::BetaPlainTextSource, Anthropic::Beta::BetaContentBlockSource, Anthropic::Beta::BetaURLPDFSource)]
68
+ # @return [Array(Anthropic::Models::Beta::BetaBase64PDFSource, Anthropic::Models::Beta::BetaPlainTextSource, Anthropic::Models::Beta::BetaContentBlockSource, Anthropic::Models::Beta::BetaURLPDFSource, Anthropic::Models::Beta::BetaFileDocumentSource)]
67
69
  end
68
70
  end
69
71
  end
@@ -9,8 +9,46 @@ module Anthropic
9
9
  # @return [Symbol, :ephemeral]
10
10
  required :type, const: :ephemeral
11
11
 
12
- # @!method initialize(type: :ephemeral)
12
+ # @!attribute ttl
13
+ # The time-to-live for the cache control breakpoint.
14
+ #
15
+ # This may be one the following values:
16
+ #
17
+ # - `5m`: 5 minutes
18
+ # - `1h`: 1 hour
19
+ #
20
+ # Defaults to `5m`.
21
+ #
22
+ # @return [Symbol, Anthropic::Models::Beta::BetaCacheControlEphemeral::TTL, nil]
23
+ optional :ttl, enum: -> { Anthropic::Beta::BetaCacheControlEphemeral::TTL }
24
+
25
+ # @!method initialize(ttl: nil, type: :ephemeral)
26
+ # Some parameter documentations has been truncated, see
27
+ # {Anthropic::Models::Beta::BetaCacheControlEphemeral} for more details.
28
+ #
29
+ # @param ttl [Symbol, Anthropic::Models::Beta::BetaCacheControlEphemeral::TTL] The time-to-live for the cache control breakpoint.
30
+ #
13
31
  # @param type [Symbol, :ephemeral]
32
+
33
+ # The time-to-live for the cache control breakpoint.
34
+ #
35
+ # This may be one the following values:
36
+ #
37
+ # - `5m`: 5 minutes
38
+ # - `1h`: 1 hour
39
+ #
40
+ # Defaults to `5m`.
41
+ #
42
+ # @see Anthropic::Models::Beta::BetaCacheControlEphemeral#ttl
43
+ module TTL
44
+ extend Anthropic::Internal::Type::Enum
45
+
46
+ TTL_5M = :"5m"
47
+ TTL_1H = :"1h"
48
+
49
+ # @!method self.values
50
+ # @return [Array<Symbol>]
51
+ end
14
52
  end
15
53
  end
16
54
 
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaCacheCreation < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute ephemeral_1h_input_tokens
8
+ # The number of input tokens used to create the 1 hour cache entry.
9
+ #
10
+ # @return [Integer]
11
+ required :ephemeral_1h_input_tokens, Integer
12
+
13
+ # @!attribute ephemeral_5m_input_tokens
14
+ # The number of input tokens used to create the 5 minute cache entry.
15
+ #
16
+ # @return [Integer]
17
+ required :ephemeral_5m_input_tokens, Integer
18
+
19
+ # @!method initialize(ephemeral_1h_input_tokens:, ephemeral_5m_input_tokens:)
20
+ # @param ephemeral_1h_input_tokens [Integer] The number of input tokens used to create the 1 hour cache entry.
21
+ #
22
+ # @param ephemeral_5m_input_tokens [Integer] The number of input tokens used to create the 5 minute cache entry.
23
+ end
24
+ end
25
+
26
+ BetaCacheCreation = Beta::BetaCacheCreation
27
+ end
28
+ end
@@ -6,7 +6,7 @@ module Anthropic
6
6
  class BetaCitationsDelta < Anthropic::Internal::Type::BaseModel
7
7
  # @!attribute citation
8
8
  #
9
- # @return [Anthropic::Beta::BetaCitationCharLocation, Anthropic::Beta::BetaCitationPageLocation, Anthropic::Beta::BetaCitationContentBlockLocation, Anthropic::Beta::BetaCitationsWebSearchResultLocation]
9
+ # @return [Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation]
10
10
  required :citation, union: -> { Anthropic::Beta::BetaCitationsDelta::Citation }
11
11
 
12
12
  # @!attribute type
@@ -15,10 +15,10 @@ module Anthropic
15
15
  required :type, const: :citations_delta
16
16
 
17
17
  # @!method initialize(citation:, type: :citations_delta)
18
- # @param citation [Anthropic::Beta::BetaCitationCharLocation, Anthropic::Beta::BetaCitationPageLocation, Anthropic::Beta::BetaCitationContentBlockLocation, Anthropic::Beta::BetaCitationsWebSearchResultLocation]
18
+ # @param citation [Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation]
19
19
  # @param type [Symbol, :citations_delta]
20
20
 
21
- # @see Anthropic::Beta::BetaCitationsDelta#citation
21
+ # @see Anthropic::Models::Beta::BetaCitationsDelta#citation
22
22
  module Citation
23
23
  extend Anthropic::Internal::Type::Union
24
24
 
@@ -33,7 +33,7 @@ module Anthropic
33
33
  variant :web_search_result_location, -> { Anthropic::Beta::BetaCitationsWebSearchResultLocation }
34
34
 
35
35
  # @!method self.variants
36
- # @return [Array(Anthropic::Beta::BetaCitationCharLocation, Anthropic::Beta::BetaCitationPageLocation, Anthropic::Beta::BetaCitationContentBlockLocation, Anthropic::Beta::BetaCitationsWebSearchResultLocation)]
36
+ # @return [Array(Anthropic::Models::Beta::BetaCitationCharLocation, Anthropic::Models::Beta::BetaCitationPageLocation, Anthropic::Models::Beta::BetaCitationContentBlockLocation, Anthropic::Models::Beta::BetaCitationsWebSearchResultLocation)]
37
37
  end
38
38
  end
39
39
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaCodeExecutionOutputBlock < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute file_id
8
+ #
9
+ # @return [String]
10
+ required :file_id, String
11
+
12
+ # @!attribute type
13
+ #
14
+ # @return [Symbol, :code_execution_output]
15
+ required :type, const: :code_execution_output
16
+
17
+ # @!method initialize(file_id:, type: :code_execution_output)
18
+ # @param file_id [String]
19
+ # @param type [Symbol, :code_execution_output]
20
+ end
21
+ end
22
+
23
+ BetaCodeExecutionOutputBlock = Beta::BetaCodeExecutionOutputBlock
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaCodeExecutionOutputBlockParam < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute file_id
8
+ #
9
+ # @return [String]
10
+ required :file_id, String
11
+
12
+ # @!attribute type
13
+ #
14
+ # @return [Symbol, :code_execution_output]
15
+ required :type, const: :code_execution_output
16
+
17
+ # @!method initialize(file_id:, type: :code_execution_output)
18
+ # @param file_id [String]
19
+ # @param type [Symbol, :code_execution_output]
20
+ end
21
+ end
22
+
23
+ BetaCodeExecutionOutputBlockParam = Beta::BetaCodeExecutionOutputBlockParam
24
+ end
25
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaCodeExecutionResultBlock < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute content
8
+ #
9
+ # @return [Array<Anthropic::Models::Beta::BetaCodeExecutionOutputBlock>]
10
+ required :content,
11
+ -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaCodeExecutionOutputBlock] }
12
+
13
+ # @!attribute return_code
14
+ #
15
+ # @return [Integer]
16
+ required :return_code, Integer
17
+
18
+ # @!attribute stderr
19
+ #
20
+ # @return [String]
21
+ required :stderr, String
22
+
23
+ # @!attribute stdout
24
+ #
25
+ # @return [String]
26
+ required :stdout, String
27
+
28
+ # @!attribute type
29
+ #
30
+ # @return [Symbol, :code_execution_result]
31
+ required :type, const: :code_execution_result
32
+
33
+ # @!method initialize(content:, return_code:, stderr:, stdout:, type: :code_execution_result)
34
+ # @param content [Array<Anthropic::Models::Beta::BetaCodeExecutionOutputBlock>]
35
+ # @param return_code [Integer]
36
+ # @param stderr [String]
37
+ # @param stdout [String]
38
+ # @param type [Symbol, :code_execution_result]
39
+ end
40
+ end
41
+
42
+ BetaCodeExecutionResultBlock = Beta::BetaCodeExecutionResultBlock
43
+ end
44
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Models
5
+ module Beta
6
+ class BetaCodeExecutionResultBlockParam < Anthropic::Internal::Type::BaseModel
7
+ # @!attribute content
8
+ #
9
+ # @return [Array<Anthropic::Models::Beta::BetaCodeExecutionOutputBlockParam>]
10
+ required :content,
11
+ -> { Anthropic::Internal::Type::ArrayOf[Anthropic::Beta::BetaCodeExecutionOutputBlockParam] }
12
+
13
+ # @!attribute return_code
14
+ #
15
+ # @return [Integer]
16
+ required :return_code, Integer
17
+
18
+ # @!attribute stderr
19
+ #
20
+ # @return [String]
21
+ required :stderr, String
22
+
23
+ # @!attribute stdout
24
+ #
25
+ # @return [String]
26
+ required :stdout, String
27
+
28
+ # @!attribute type
29
+ #
30
+ # @return [Symbol, :code_execution_result]
31
+ required :type, const: :code_execution_result
32
+
33
+ # @!method initialize(content:, return_code:, stderr:, stdout:, type: :code_execution_result)
34
+ # @param content [Array<Anthropic::Models::Beta::BetaCodeExecutionOutputBlockParam>]
35
+ # @param return_code [Integer]
36
+ # @param stderr [String]
37
+ # @param stdout [String]
38
+ # @param type [Symbol, :code_execution_result]
39
+ end
40
+ end
41
+
42
+ BetaCodeExecutionResultBlockParam = Beta::BetaCodeExecutionResultBlockParam
43
+ end
44
+ end