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,78 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaCitationSearchResultLocation = Beta::BetaCitationSearchResultLocation
6
+
7
+ module Beta
8
+ class BetaCitationSearchResultLocation < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaCitationSearchResultLocation,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :cited_text
19
+
20
+ sig { returns(Integer) }
21
+ attr_accessor :end_block_index
22
+
23
+ sig { returns(Integer) }
24
+ attr_accessor :search_result_index
25
+
26
+ sig { returns(String) }
27
+ attr_accessor :source
28
+
29
+ sig { returns(Integer) }
30
+ attr_accessor :start_block_index
31
+
32
+ sig { returns(T.nilable(String)) }
33
+ attr_accessor :title
34
+
35
+ sig { returns(Symbol) }
36
+ attr_accessor :type
37
+
38
+ sig do
39
+ params(
40
+ cited_text: String,
41
+ end_block_index: Integer,
42
+ search_result_index: Integer,
43
+ source: String,
44
+ start_block_index: Integer,
45
+ title: T.nilable(String),
46
+ type: Symbol
47
+ ).returns(T.attached_class)
48
+ end
49
+ def self.new(
50
+ cited_text:,
51
+ end_block_index:,
52
+ search_result_index:,
53
+ source:,
54
+ start_block_index:,
55
+ title:,
56
+ type: :search_result_location
57
+ )
58
+ end
59
+
60
+ sig do
61
+ override.returns(
62
+ {
63
+ cited_text: String,
64
+ end_block_index: Integer,
65
+ search_result_index: Integer,
66
+ source: String,
67
+ start_block_index: Integer,
68
+ title: T.nilable(String),
69
+ type: Symbol
70
+ }
71
+ )
72
+ end
73
+ def to_hash
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,79 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaCitationSearchResultLocationParam =
6
+ Beta::BetaCitationSearchResultLocationParam
7
+
8
+ module Beta
9
+ class BetaCitationSearchResultLocationParam < Anthropic::Internal::Type::BaseModel
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Anthropic::Beta::BetaCitationSearchResultLocationParam,
14
+ Anthropic::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :cited_text
20
+
21
+ sig { returns(Integer) }
22
+ attr_accessor :end_block_index
23
+
24
+ sig { returns(Integer) }
25
+ attr_accessor :search_result_index
26
+
27
+ sig { returns(String) }
28
+ attr_accessor :source
29
+
30
+ sig { returns(Integer) }
31
+ attr_accessor :start_block_index
32
+
33
+ sig { returns(T.nilable(String)) }
34
+ attr_accessor :title
35
+
36
+ sig { returns(Symbol) }
37
+ attr_accessor :type
38
+
39
+ sig do
40
+ params(
41
+ cited_text: String,
42
+ end_block_index: Integer,
43
+ search_result_index: Integer,
44
+ source: String,
45
+ start_block_index: Integer,
46
+ title: T.nilable(String),
47
+ type: Symbol
48
+ ).returns(T.attached_class)
49
+ end
50
+ def self.new(
51
+ cited_text:,
52
+ end_block_index:,
53
+ search_result_index:,
54
+ source:,
55
+ start_block_index:,
56
+ title:,
57
+ type: :search_result_location
58
+ )
59
+ end
60
+
61
+ sig do
62
+ override.returns(
63
+ {
64
+ cited_text: String,
65
+ end_block_index: Integer,
66
+ search_result_index: Integer,
67
+ source: String,
68
+ start_block_index: Integer,
69
+ title: T.nilable(String),
70
+ type: Symbol
71
+ }
72
+ )
73
+ end
74
+ def to_hash
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -27,7 +27,8 @@ module Anthropic
27
27
  Anthropic::Beta::BetaCitationCharLocation::OrHash,
28
28
  Anthropic::Beta::BetaCitationPageLocation::OrHash,
29
29
  Anthropic::Beta::BetaCitationContentBlockLocation::OrHash,
30
- Anthropic::Beta::BetaCitationsWebSearchResultLocation::OrHash
30
+ Anthropic::Beta::BetaCitationsWebSearchResultLocation::OrHash,
31
+ Anthropic::Beta::BetaCitationSearchResultLocation::OrHash
31
32
  ),
32
33
  type: Symbol
33
34
  ).returns(T.attached_class)
@@ -55,7 +56,8 @@ module Anthropic
55
56
  Anthropic::Beta::BetaCitationCharLocation,
56
57
  Anthropic::Beta::BetaCitationPageLocation,
57
58
  Anthropic::Beta::BetaCitationContentBlockLocation,
58
- Anthropic::Beta::BetaCitationsWebSearchResultLocation
59
+ Anthropic::Beta::BetaCitationsWebSearchResultLocation,
60
+ Anthropic::Beta::BetaCitationSearchResultLocation
59
61
  )
60
62
  end
61
63
 
@@ -0,0 +1,72 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaCodeExecutionTool20250825 = Beta::BetaCodeExecutionTool20250825
6
+
7
+ module Beta
8
+ class BetaCodeExecutionTool20250825 < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaCodeExecutionTool20250825,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # Name of the tool.
18
+ #
19
+ # This is how the tool will be called by the model and in `tool_use` blocks.
20
+ sig { returns(Symbol) }
21
+ attr_accessor :name
22
+
23
+ sig { returns(Symbol) }
24
+ attr_accessor :type
25
+
26
+ # Create a cache control breakpoint at this content block.
27
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
28
+ attr_reader :cache_control
29
+
30
+ sig do
31
+ params(
32
+ cache_control:
33
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
34
+ ).void
35
+ end
36
+ attr_writer :cache_control
37
+
38
+ sig do
39
+ params(
40
+ cache_control:
41
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
42
+ name: Symbol,
43
+ type: Symbol
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ # Create a cache control breakpoint at this content block.
48
+ cache_control: nil,
49
+ # Name of the tool.
50
+ #
51
+ # This is how the tool will be called by the model and in `tool_use` blocks.
52
+ name: :code_execution,
53
+ type: :code_execution_20250825
54
+ )
55
+ end
56
+
57
+ sig do
58
+ override.returns(
59
+ {
60
+ name: Symbol,
61
+ type: Symbol,
62
+ cache_control:
63
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)
64
+ }
65
+ )
66
+ end
67
+ def to_hash
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -13,15 +13,18 @@ module Anthropic
13
13
  T.type_alias do
14
14
  T.any(
15
15
  Anthropic::Beta::BetaTextBlock,
16
+ Anthropic::Beta::BetaThinkingBlock,
17
+ Anthropic::Beta::BetaRedactedThinkingBlock,
16
18
  Anthropic::Beta::BetaToolUseBlock,
17
19
  Anthropic::Beta::BetaServerToolUseBlock,
18
20
  Anthropic::Beta::BetaWebSearchToolResultBlock,
21
+ Anthropic::Beta::BetaWebFetchToolResultBlock,
19
22
  Anthropic::Beta::BetaCodeExecutionToolResultBlock,
23
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
24
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
20
25
  Anthropic::Beta::BetaMCPToolUseBlock,
21
26
  Anthropic::Beta::BetaMCPToolResultBlock,
22
- Anthropic::Beta::BetaContainerUploadBlock,
23
- Anthropic::Beta::BetaThinkingBlock,
24
- Anthropic::Beta::BetaRedactedThinkingBlock
27
+ Anthropic::Beta::BetaContainerUploadBlock
25
28
  )
26
29
  end
27
30
 
@@ -12,18 +12,22 @@ module Anthropic
12
12
  Variants =
13
13
  T.type_alias do
14
14
  T.any(
15
+ Anthropic::Beta::BetaTextBlockParam,
16
+ Anthropic::Beta::BetaImageBlockParam,
17
+ Anthropic::Beta::BetaRequestDocumentBlock,
18
+ Anthropic::Beta::BetaSearchResultBlockParam,
19
+ Anthropic::Beta::BetaThinkingBlockParam,
20
+ Anthropic::Beta::BetaRedactedThinkingBlockParam,
21
+ Anthropic::Beta::BetaToolUseBlockParam,
22
+ Anthropic::Beta::BetaToolResultBlockParam,
15
23
  Anthropic::Beta::BetaServerToolUseBlockParam,
16
24
  Anthropic::Beta::BetaWebSearchToolResultBlockParam,
25
+ Anthropic::Beta::BetaWebFetchToolResultBlockParam,
17
26
  Anthropic::Beta::BetaCodeExecutionToolResultBlockParam,
27
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlockParam,
28
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlockParam,
18
29
  Anthropic::Beta::BetaMCPToolUseBlockParam,
19
30
  Anthropic::Beta::BetaRequestMCPToolResultBlockParam,
20
- Anthropic::Beta::BetaTextBlockParam,
21
- Anthropic::Beta::BetaImageBlockParam,
22
- Anthropic::Beta::BetaToolUseBlockParam,
23
- Anthropic::Beta::BetaToolResultBlockParam,
24
- Anthropic::Beta::BetaBase64PDFBlock,
25
- Anthropic::Beta::BetaThinkingBlockParam,
26
- Anthropic::Beta::BetaRedactedThinkingBlockParam,
27
31
  Anthropic::Beta::BetaContainerUploadBlockParam
28
32
  )
29
33
  end
@@ -0,0 +1,95 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaDocumentBlock = Beta::BetaDocumentBlock
6
+
7
+ module Beta
8
+ class BetaDocumentBlock < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaDocumentBlock,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # Citation configuration for the document
18
+ sig { returns(T.nilable(Anthropic::Beta::BetaCitationConfig)) }
19
+ attr_reader :citations
20
+
21
+ sig do
22
+ params(
23
+ citations: T.nilable(Anthropic::Beta::BetaCitationConfig::OrHash)
24
+ ).void
25
+ end
26
+ attr_writer :citations
27
+
28
+ sig { returns(Anthropic::Beta::BetaDocumentBlock::Source::Variants) }
29
+ attr_accessor :source
30
+
31
+ # The title of the document
32
+ sig { returns(T.nilable(String)) }
33
+ attr_accessor :title
34
+
35
+ sig { returns(Symbol) }
36
+ attr_accessor :type
37
+
38
+ sig do
39
+ params(
40
+ citations: T.nilable(Anthropic::Beta::BetaCitationConfig::OrHash),
41
+ source:
42
+ T.any(
43
+ Anthropic::Beta::BetaBase64PDFSource::OrHash,
44
+ Anthropic::Beta::BetaPlainTextSource::OrHash
45
+ ),
46
+ title: T.nilable(String),
47
+ type: Symbol
48
+ ).returns(T.attached_class)
49
+ end
50
+ def self.new(
51
+ # Citation configuration for the document
52
+ citations:,
53
+ source:,
54
+ # The title of the document
55
+ title:,
56
+ type: :document
57
+ )
58
+ end
59
+
60
+ sig do
61
+ override.returns(
62
+ {
63
+ citations: T.nilable(Anthropic::Beta::BetaCitationConfig),
64
+ source: Anthropic::Beta::BetaDocumentBlock::Source::Variants,
65
+ title: T.nilable(String),
66
+ type: Symbol
67
+ }
68
+ )
69
+ end
70
+ def to_hash
71
+ end
72
+
73
+ module Source
74
+ extend Anthropic::Internal::Type::Union
75
+
76
+ Variants =
77
+ T.type_alias do
78
+ T.any(
79
+ Anthropic::Beta::BetaBase64PDFSource,
80
+ Anthropic::Beta::BetaPlainTextSource
81
+ )
82
+ end
83
+
84
+ sig do
85
+ override.returns(
86
+ T::Array[Anthropic::Beta::BetaDocumentBlock::Source::Variants]
87
+ )
88
+ end
89
+ def self.variants
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -84,6 +84,10 @@ module Anthropic
84
84
  # - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
85
85
  # - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
86
86
  # - `"tool_use"`: the model invoked one or more tools
87
+ # - `"pause_turn"`: we paused a long-running turn. You may provide the response
88
+ # back as-is in a subsequent request to let the model continue.
89
+ # - `"refusal"`: when streaming classifiers intervene to handle potential policy
90
+ # violations
87
91
  #
88
92
  # In non-streaming mode this value is always non-null. In streaming mode, it is
89
93
  # null in the `message_start` event and non-null otherwise.
@@ -134,15 +138,18 @@ module Anthropic
134
138
  T::Array[
135
139
  T.any(
136
140
  Anthropic::Beta::BetaTextBlock::OrHash,
141
+ Anthropic::Beta::BetaThinkingBlock::OrHash,
142
+ Anthropic::Beta::BetaRedactedThinkingBlock::OrHash,
137
143
  Anthropic::Beta::BetaToolUseBlock::OrHash,
138
144
  Anthropic::Beta::BetaServerToolUseBlock::OrHash,
139
145
  Anthropic::Beta::BetaWebSearchToolResultBlock::OrHash,
146
+ Anthropic::Beta::BetaWebFetchToolResultBlock::OrHash,
140
147
  Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
148
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
149
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
141
150
  Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
142
151
  Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
143
- Anthropic::Beta::BetaContainerUploadBlock::OrHash,
144
- Anthropic::Beta::BetaThinkingBlock::OrHash,
145
- Anthropic::Beta::BetaRedactedThinkingBlock::OrHash
152
+ Anthropic::Beta::BetaContainerUploadBlock::OrHash
146
153
  )
147
154
  ],
148
155
  model: T.any(Anthropic::Model::OrSymbol, String),
@@ -206,6 +213,10 @@ module Anthropic
206
213
  # - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
207
214
  # - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
208
215
  # - `"tool_use"`: the model invoked one or more tools
216
+ # - `"pause_turn"`: we paused a long-running turn. You may provide the response
217
+ # back as-is in a subsequent request to let the model continue.
218
+ # - `"refusal"`: when streaming classifiers intervene to handle potential policy
219
+ # violations
209
220
  #
210
221
  # In non-streaming mode this value is always non-null. In streaming mode, it is
211
222
  # null in the `message_start` event and non-null otherwise.
@@ -33,15 +33,18 @@ module Anthropic
33
33
  content_block:
34
34
  T.any(
35
35
  Anthropic::Beta::BetaTextBlock::OrHash,
36
+ Anthropic::Beta::BetaThinkingBlock::OrHash,
37
+ Anthropic::Beta::BetaRedactedThinkingBlock::OrHash,
36
38
  Anthropic::Beta::BetaToolUseBlock::OrHash,
37
39
  Anthropic::Beta::BetaServerToolUseBlock::OrHash,
38
40
  Anthropic::Beta::BetaWebSearchToolResultBlock::OrHash,
41
+ Anthropic::Beta::BetaWebFetchToolResultBlock::OrHash,
39
42
  Anthropic::Beta::BetaCodeExecutionToolResultBlock::OrHash,
43
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock::OrHash,
44
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock::OrHash,
40
45
  Anthropic::Beta::BetaMCPToolUseBlock::OrHash,
41
46
  Anthropic::Beta::BetaMCPToolResultBlock::OrHash,
42
- Anthropic::Beta::BetaContainerUploadBlock::OrHash,
43
- Anthropic::Beta::BetaThinkingBlock::OrHash,
44
- Anthropic::Beta::BetaRedactedThinkingBlock::OrHash
47
+ Anthropic::Beta::BetaContainerUploadBlock::OrHash
45
48
  ),
46
49
  index: Integer,
47
50
  type: Symbol
@@ -76,15 +79,18 @@ module Anthropic
76
79
  T.type_alias do
77
80
  T.any(
78
81
  Anthropic::Beta::BetaTextBlock,
82
+ Anthropic::Beta::BetaThinkingBlock,
83
+ Anthropic::Beta::BetaRedactedThinkingBlock,
79
84
  Anthropic::Beta::BetaToolUseBlock,
80
85
  Anthropic::Beta::BetaServerToolUseBlock,
81
86
  Anthropic::Beta::BetaWebSearchToolResultBlock,
87
+ Anthropic::Beta::BetaWebFetchToolResultBlock,
82
88
  Anthropic::Beta::BetaCodeExecutionToolResultBlock,
89
+ Anthropic::Beta::BetaBashCodeExecutionToolResultBlock,
90
+ Anthropic::Beta::BetaTextEditorCodeExecutionToolResultBlock,
83
91
  Anthropic::Beta::BetaMCPToolUseBlock,
84
92
  Anthropic::Beta::BetaMCPToolResultBlock,
85
- Anthropic::Beta::BetaContainerUploadBlock,
86
- Anthropic::Beta::BetaThinkingBlock,
87
- Anthropic::Beta::BetaRedactedThinkingBlock
93
+ Anthropic::Beta::BetaContainerUploadBlock
88
94
  )
89
95
  end
90
96
 
@@ -0,0 +1,142 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaRequestDocumentBlock = Beta::BetaRequestDocumentBlock
6
+
7
+ module Beta
8
+ class BetaRequestDocumentBlock < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaRequestDocumentBlock,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig do
18
+ returns(
19
+ T.any(
20
+ Anthropic::Beta::BetaBase64PDFSource,
21
+ Anthropic::Beta::BetaPlainTextSource,
22
+ Anthropic::Beta::BetaContentBlockSource,
23
+ Anthropic::Beta::BetaURLPDFSource,
24
+ Anthropic::Beta::BetaFileDocumentSource
25
+ )
26
+ )
27
+ end
28
+ attr_accessor :source
29
+
30
+ sig { returns(Symbol) }
31
+ attr_accessor :type
32
+
33
+ # Create a cache control breakpoint at this content block.
34
+ sig { returns(T.nilable(Anthropic::Beta::BetaCacheControlEphemeral)) }
35
+ attr_reader :cache_control
36
+
37
+ sig do
38
+ params(
39
+ cache_control:
40
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash)
41
+ ).void
42
+ end
43
+ attr_writer :cache_control
44
+
45
+ sig { returns(T.nilable(Anthropic::Beta::BetaCitationsConfigParam)) }
46
+ attr_reader :citations
47
+
48
+ sig do
49
+ params(
50
+ citations:
51
+ T.nilable(Anthropic::Beta::BetaCitationsConfigParam::OrHash)
52
+ ).void
53
+ end
54
+ attr_writer :citations
55
+
56
+ sig { returns(T.nilable(String)) }
57
+ attr_accessor :context
58
+
59
+ sig { returns(T.nilable(String)) }
60
+ attr_accessor :title
61
+
62
+ sig do
63
+ params(
64
+ source:
65
+ T.any(
66
+ Anthropic::Beta::BetaBase64PDFSource::OrHash,
67
+ Anthropic::Beta::BetaPlainTextSource::OrHash,
68
+ Anthropic::Beta::BetaContentBlockSource::OrHash,
69
+ Anthropic::Beta::BetaURLPDFSource::OrHash,
70
+ Anthropic::Beta::BetaFileDocumentSource::OrHash
71
+ ),
72
+ cache_control:
73
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral::OrHash),
74
+ citations:
75
+ T.nilable(Anthropic::Beta::BetaCitationsConfigParam::OrHash),
76
+ context: T.nilable(String),
77
+ title: T.nilable(String),
78
+ type: Symbol
79
+ ).returns(T.attached_class)
80
+ end
81
+ def self.new(
82
+ source:,
83
+ # Create a cache control breakpoint at this content block.
84
+ cache_control: nil,
85
+ citations: nil,
86
+ context: nil,
87
+ title: nil,
88
+ type: :document
89
+ )
90
+ end
91
+
92
+ sig do
93
+ override.returns(
94
+ {
95
+ source:
96
+ T.any(
97
+ Anthropic::Beta::BetaBase64PDFSource,
98
+ Anthropic::Beta::BetaPlainTextSource,
99
+ Anthropic::Beta::BetaContentBlockSource,
100
+ Anthropic::Beta::BetaURLPDFSource,
101
+ Anthropic::Beta::BetaFileDocumentSource
102
+ ),
103
+ type: Symbol,
104
+ cache_control:
105
+ T.nilable(Anthropic::Beta::BetaCacheControlEphemeral),
106
+ citations: T.nilable(Anthropic::Beta::BetaCitationsConfigParam),
107
+ context: T.nilable(String),
108
+ title: T.nilable(String)
109
+ }
110
+ )
111
+ end
112
+ def to_hash
113
+ end
114
+
115
+ module Source
116
+ extend Anthropic::Internal::Type::Union
117
+
118
+ Variants =
119
+ T.type_alias do
120
+ T.any(
121
+ Anthropic::Beta::BetaBase64PDFSource,
122
+ Anthropic::Beta::BetaPlainTextSource,
123
+ Anthropic::Beta::BetaContentBlockSource,
124
+ Anthropic::Beta::BetaURLPDFSource,
125
+ Anthropic::Beta::BetaFileDocumentSource
126
+ )
127
+ end
128
+
129
+ sig do
130
+ override.returns(
131
+ T::Array[
132
+ Anthropic::Beta::BetaRequestDocumentBlock::Source::Variants
133
+ ]
134
+ )
135
+ end
136
+ def self.variants
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end