anthropic 1.1.0 → 1.2.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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +62 -0
  3. data/README.md +32 -16
  4. data/lib/anthropic/errors.rb +22 -0
  5. data/lib/anthropic/helpers/bedrock/client.rb +3 -1
  6. data/lib/anthropic/helpers/streaming/events.rb +141 -0
  7. data/lib/anthropic/helpers/streaming/message_stream.rb +238 -0
  8. data/lib/anthropic/helpers/streaming.rb +37 -0
  9. data/lib/anthropic/helpers/vertex/client.rb +8 -3
  10. data/lib/anthropic/internal/stream.rb +4 -2
  11. data/lib/anthropic/internal/transport/base_client.rb +10 -2
  12. data/lib/anthropic/internal/type/array_of.rb +6 -1
  13. data/lib/anthropic/internal/type/base_model.rb +77 -23
  14. data/lib/anthropic/internal/type/base_stream.rb +3 -1
  15. data/lib/anthropic/internal/type/boolean.rb +7 -1
  16. data/lib/anthropic/internal/type/converter.rb +42 -34
  17. data/lib/anthropic/internal/type/enum.rb +16 -5
  18. data/lib/anthropic/internal/type/file_input.rb +6 -1
  19. data/lib/anthropic/internal/type/hash_of.rb +6 -1
  20. data/lib/anthropic/internal/type/union.rb +17 -9
  21. data/lib/anthropic/internal/type/unknown.rb +7 -1
  22. data/lib/anthropic/internal/util.rb +18 -11
  23. data/lib/anthropic/models/beta/beta_base64_pdf_block.rb +1 -65
  24. data/lib/anthropic/models/beta/beta_citation_search_result_location.rb +55 -0
  25. data/lib/anthropic/models/beta/beta_citation_search_result_location_param.rb +55 -0
  26. data/lib/anthropic/models/beta/beta_citations_delta.rb +5 -3
  27. data/lib/anthropic/models/beta/beta_content_block.rb +5 -5
  28. data/lib/anthropic/models/beta/beta_content_block_param.rb +20 -17
  29. data/lib/anthropic/models/beta/beta_message.rb +6 -2
  30. data/lib/anthropic/models/beta/beta_message_param.rb +3 -3
  31. data/lib/anthropic/models/beta/beta_raw_content_block_start_event.rb +7 -7
  32. data/lib/anthropic/models/beta/beta_request_document_block.rb +75 -0
  33. data/lib/anthropic/models/beta/beta_search_result_block_param.rb +55 -0
  34. data/lib/anthropic/models/beta/beta_text_block.rb +2 -2
  35. data/lib/anthropic/models/beta/beta_text_block_param.rb +2 -2
  36. data/lib/anthropic/models/beta/beta_text_citation.rb +3 -1
  37. data/lib/anthropic/models/beta/beta_text_citation_param.rb +3 -1
  38. data/lib/anthropic/models/beta/beta_tool.rb +7 -1
  39. data/lib/anthropic/models/beta/beta_tool_result_block_param.rb +6 -4
  40. data/lib/anthropic/models/beta/beta_tool_union.rb +7 -7
  41. data/lib/anthropic/models/beta/message_count_tokens_params.rb +16 -10
  42. data/lib/anthropic/models/beta/message_create_params.rb +9 -3
  43. data/lib/anthropic/models/beta/messages/batch_create_params.rb +9 -3
  44. data/lib/anthropic/models/content_block.rb +5 -5
  45. data/lib/anthropic/models/content_block_param.rb +11 -11
  46. data/lib/anthropic/models/message.rb +6 -2
  47. data/lib/anthropic/models/message_count_tokens_params.rb +9 -3
  48. data/lib/anthropic/models/message_count_tokens_tool.rb +35 -1
  49. data/lib/anthropic/models/message_create_params.rb +9 -3
  50. data/lib/anthropic/models/message_param.rb +3 -3
  51. data/lib/anthropic/models/messages/batch_create_params.rb +9 -3
  52. data/lib/anthropic/models/model.rb +6 -0
  53. data/lib/anthropic/models/raw_content_block_start_event.rb +7 -7
  54. data/lib/anthropic/models/tool.rb +7 -1
  55. data/lib/anthropic/models/tool_union.rb +34 -1
  56. data/lib/anthropic/models/tool_use_block.rb +6 -0
  57. data/lib/anthropic/models.rb +4 -4
  58. data/lib/anthropic/resources/beta/messages.rb +5 -5
  59. data/lib/anthropic/resources/messages.rb +68 -7
  60. data/lib/anthropic/streaming.rb +5 -0
  61. data/lib/anthropic/version.rb +1 -1
  62. data/lib/anthropic.rb +11 -1
  63. data/rbi/anthropic/errors.rbi +16 -0
  64. data/rbi/anthropic/helpers/streaming/events.rbi +85 -0
  65. data/rbi/anthropic/helpers/streaming/message_stream.rbi +59 -0
  66. data/rbi/anthropic/internal/type/base_stream.rbi +8 -1
  67. data/rbi/anthropic/internal/type/boolean.rbi +2 -0
  68. data/rbi/anthropic/internal/type/converter.rbi +15 -15
  69. data/rbi/anthropic/internal/type/union.rbi +5 -0
  70. data/rbi/anthropic/internal/type/unknown.rbi +2 -0
  71. data/rbi/anthropic/internal/util.rbi +2 -0
  72. data/rbi/anthropic/models/beta/beta_base64_pdf_block.rbi +1 -128
  73. data/rbi/anthropic/models/beta/beta_citation_search_result_location.rbi +78 -0
  74. data/rbi/anthropic/models/beta/beta_citation_search_result_location_param.rbi +79 -0
  75. data/rbi/anthropic/models/beta/beta_citations_delta.rbi +4 -2
  76. data/rbi/anthropic/models/beta/beta_content_block.rbi +3 -3
  77. data/rbi/anthropic/models/beta/beta_content_block_param.rbi +8 -7
  78. data/rbi/anthropic/models/beta/beta_message.rbi +11 -3
  79. data/rbi/anthropic/models/beta/beta_raw_content_block_start_event.rbi +6 -6
  80. data/rbi/anthropic/models/beta/beta_request_document_block.rbi +140 -0
  81. data/rbi/anthropic/models/beta/beta_search_result_block_param.rbi +91 -0
  82. data/rbi/anthropic/models/beta/beta_text_block.rbi +2 -1
  83. data/rbi/anthropic/models/beta/beta_text_block_param.rbi +6 -3
  84. data/rbi/anthropic/models/beta/beta_text_citation.rbi +2 -1
  85. data/rbi/anthropic/models/beta/beta_text_citation_param.rbi +2 -1
  86. data/rbi/anthropic/models/beta/beta_tool.rbi +14 -5
  87. data/rbi/anthropic/models/beta/beta_tool_result_block_param.rbi +2 -1
  88. data/rbi/anthropic/models/beta/beta_tool_union.rbi +5 -5
  89. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +39 -27
  90. data/rbi/anthropic/models/beta/message_create_params.rbi +34 -22
  91. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +34 -22
  92. data/rbi/anthropic/models/content_block.rbi +3 -3
  93. data/rbi/anthropic/models/content_block_param.rbi +5 -5
  94. data/rbi/anthropic/models/message.rbi +11 -3
  95. data/rbi/anthropic/models/message_count_tokens_params.rbi +18 -2
  96. data/rbi/anthropic/models/message_count_tokens_tool.rbi +61 -0
  97. data/rbi/anthropic/models/message_create_params.rbi +18 -2
  98. data/rbi/anthropic/models/messages/batch_create_params.rbi +18 -2
  99. data/rbi/anthropic/models/raw_content_block_start_event.rbi +6 -6
  100. data/rbi/anthropic/models/tool.rbi +16 -5
  101. data/rbi/anthropic/models/tool_union.rbi +61 -0
  102. data/rbi/anthropic/resources/beta/messages.rbi +36 -18
  103. data/rbi/anthropic/resources/messages.rbi +293 -3
  104. data/rbi/anthropic/streaming.rbi +5 -0
  105. data/sig/anthropic/errors.rbs +9 -0
  106. data/sig/anthropic/helpers/streaming/events.rbs +119 -0
  107. data/sig/anthropic/helpers/streaming/message_stream.rbs +55 -0
  108. data/sig/anthropic/internal/type/base_stream.rbs +4 -0
  109. data/sig/anthropic/internal/type/converter.rbs +7 -1
  110. data/sig/anthropic/models/beta/beta_base64_pdf_block.rbs +1 -58
  111. data/sig/anthropic/models/beta/beta_citation_search_result_location.rbs +54 -0
  112. data/sig/anthropic/models/beta/beta_citation_search_result_location_param.rbs +54 -0
  113. data/sig/anthropic/models/beta/beta_citations_delta.rbs +1 -0
  114. data/sig/anthropic/models/beta/beta_content_block.rbs +2 -2
  115. data/sig/anthropic/models/beta/beta_content_block_param.rbs +9 -8
  116. data/sig/anthropic/models/beta/beta_raw_content_block_start_event.rbs +2 -2
  117. data/sig/anthropic/models/beta/beta_request_document_block.rbs +66 -0
  118. data/sig/anthropic/models/beta/beta_search_result_block_param.rbs +53 -0
  119. data/sig/anthropic/models/beta/beta_text_citation.rbs +1 -0
  120. data/sig/anthropic/models/beta/beta_text_citation_param.rbs +1 -0
  121. data/sig/anthropic/models/beta/beta_tool.rbs +14 -3
  122. data/sig/anthropic/models/beta/beta_tool_result_block_param.rbs +1 -0
  123. data/sig/anthropic/models/beta/beta_tool_union.rbs +4 -4
  124. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +4 -4
  125. data/sig/anthropic/models/content_block.rbs +2 -2
  126. data/sig/anthropic/models/content_block_param.rbs +5 -5
  127. data/sig/anthropic/models/message_count_tokens_tool.rbs +28 -0
  128. data/sig/anthropic/models/raw_content_block_start_event.rbs +2 -2
  129. data/sig/anthropic/models/tool.rbs +14 -3
  130. data/sig/anthropic/models/tool_union.rbs +28 -0
  131. data/sig/anthropic/streaming.rbs +3 -0
  132. metadata +26 -3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anthropic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthropic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-22 00:00:00.000000000 Z
11
+ date: 2025-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -41,6 +41,9 @@ files:
41
41
  - lib/anthropic/errors.rb
42
42
  - lib/anthropic/file_part.rb
43
43
  - lib/anthropic/helpers/bedrock/client.rb
44
+ - lib/anthropic/helpers/streaming.rb
45
+ - lib/anthropic/helpers/streaming/events.rb
46
+ - lib/anthropic/helpers/streaming/message_stream.rb
44
47
  - lib/anthropic/helpers/vertex/client.rb
45
48
  - lib/anthropic/internal.rb
46
49
  - lib/anthropic/internal/jsonl_stream.rb
@@ -78,6 +81,8 @@ files:
78
81
  - lib/anthropic/models/beta/beta_citation_content_block_location_param.rb
79
82
  - lib/anthropic/models/beta/beta_citation_page_location.rb
80
83
  - lib/anthropic/models/beta/beta_citation_page_location_param.rb
84
+ - lib/anthropic/models/beta/beta_citation_search_result_location.rb
85
+ - lib/anthropic/models/beta/beta_citation_search_result_location_param.rb
81
86
  - lib/anthropic/models/beta/beta_citation_web_search_result_location_param.rb
82
87
  - lib/anthropic/models/beta/beta_citations_config_param.rb
83
88
  - lib/anthropic/models/beta/beta_citations_delta.rb
@@ -125,9 +130,11 @@ files:
125
130
  - lib/anthropic/models/beta/beta_raw_message_stream_event.rb
126
131
  - lib/anthropic/models/beta/beta_redacted_thinking_block.rb
127
132
  - lib/anthropic/models/beta/beta_redacted_thinking_block_param.rb
133
+ - lib/anthropic/models/beta/beta_request_document_block.rb
128
134
  - lib/anthropic/models/beta/beta_request_mcp_server_tool_configuration.rb
129
135
  - lib/anthropic/models/beta/beta_request_mcp_server_url_definition.rb
130
136
  - lib/anthropic/models/beta/beta_request_mcp_tool_result_block_param.rb
137
+ - lib/anthropic/models/beta/beta_search_result_block_param.rb
131
138
  - lib/anthropic/models/beta/beta_server_tool_usage.rb
132
139
  - lib/anthropic/models/beta/beta_server_tool_use_block.rb
133
140
  - lib/anthropic/models/beta/beta_server_tool_use_block_param.rb
@@ -328,6 +335,7 @@ files:
328
335
  - lib/anthropic/resources/messages.rb
329
336
  - lib/anthropic/resources/messages/batches.rb
330
337
  - lib/anthropic/resources/models.rb
338
+ - lib/anthropic/streaming.rb
331
339
  - lib/anthropic/version.rb
332
340
  - lib/anthropic/vertex.rb
333
341
  - manifest.yaml
@@ -336,6 +344,8 @@ files:
336
344
  - rbi/anthropic/errors.rbi
337
345
  - rbi/anthropic/file_part.rbi
338
346
  - rbi/anthropic/helpers/bedrock/client.rbi
347
+ - rbi/anthropic/helpers/streaming/events.rbi
348
+ - rbi/anthropic/helpers/streaming/message_stream.rbi
339
349
  - rbi/anthropic/helpers/vertex/client.rbi
340
350
  - rbi/anthropic/internal.rbi
341
351
  - rbi/anthropic/internal/jsonl_stream.rbi
@@ -373,6 +383,8 @@ files:
373
383
  - rbi/anthropic/models/beta/beta_citation_content_block_location_param.rbi
374
384
  - rbi/anthropic/models/beta/beta_citation_page_location.rbi
375
385
  - rbi/anthropic/models/beta/beta_citation_page_location_param.rbi
386
+ - rbi/anthropic/models/beta/beta_citation_search_result_location.rbi
387
+ - rbi/anthropic/models/beta/beta_citation_search_result_location_param.rbi
376
388
  - rbi/anthropic/models/beta/beta_citation_web_search_result_location_param.rbi
377
389
  - rbi/anthropic/models/beta/beta_citations_config_param.rbi
378
390
  - rbi/anthropic/models/beta/beta_citations_delta.rbi
@@ -420,9 +432,11 @@ files:
420
432
  - rbi/anthropic/models/beta/beta_raw_message_stream_event.rbi
421
433
  - rbi/anthropic/models/beta/beta_redacted_thinking_block.rbi
422
434
  - rbi/anthropic/models/beta/beta_redacted_thinking_block_param.rbi
435
+ - rbi/anthropic/models/beta/beta_request_document_block.rbi
423
436
  - rbi/anthropic/models/beta/beta_request_mcp_server_tool_configuration.rbi
424
437
  - rbi/anthropic/models/beta/beta_request_mcp_server_url_definition.rbi
425
438
  - rbi/anthropic/models/beta/beta_request_mcp_tool_result_block_param.rbi
439
+ - rbi/anthropic/models/beta/beta_search_result_block_param.rbi
426
440
  - rbi/anthropic/models/beta/beta_server_tool_usage.rbi
427
441
  - rbi/anthropic/models/beta/beta_server_tool_use_block.rbi
428
442
  - rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi
@@ -623,6 +637,7 @@ files:
623
637
  - rbi/anthropic/resources/messages.rbi
624
638
  - rbi/anthropic/resources/messages/batches.rbi
625
639
  - rbi/anthropic/resources/models.rbi
640
+ - rbi/anthropic/streaming.rbi
626
641
  - rbi/anthropic/version.rbi
627
642
  - rbi/anthropic/vertex.rbi
628
643
  - sig/anthropic/bedrock.rbs
@@ -630,6 +645,8 @@ files:
630
645
  - sig/anthropic/errors.rbs
631
646
  - sig/anthropic/file_part.rbs
632
647
  - sig/anthropic/helpers/bedrock/client.rbs
648
+ - sig/anthropic/helpers/streaming/events.rbs
649
+ - sig/anthropic/helpers/streaming/message_stream.rbs
633
650
  - sig/anthropic/helpers/vertex/client.rbs
634
651
  - sig/anthropic/internal.rbs
635
652
  - sig/anthropic/internal/jsonl_stream.rbs
@@ -667,6 +684,8 @@ files:
667
684
  - sig/anthropic/models/beta/beta_citation_content_block_location_param.rbs
668
685
  - sig/anthropic/models/beta/beta_citation_page_location.rbs
669
686
  - sig/anthropic/models/beta/beta_citation_page_location_param.rbs
687
+ - sig/anthropic/models/beta/beta_citation_search_result_location.rbs
688
+ - sig/anthropic/models/beta/beta_citation_search_result_location_param.rbs
670
689
  - sig/anthropic/models/beta/beta_citation_web_search_result_location_param.rbs
671
690
  - sig/anthropic/models/beta/beta_citations_config_param.rbs
672
691
  - sig/anthropic/models/beta/beta_citations_delta.rbs
@@ -714,9 +733,11 @@ files:
714
733
  - sig/anthropic/models/beta/beta_raw_message_stream_event.rbs
715
734
  - sig/anthropic/models/beta/beta_redacted_thinking_block.rbs
716
735
  - sig/anthropic/models/beta/beta_redacted_thinking_block_param.rbs
736
+ - sig/anthropic/models/beta/beta_request_document_block.rbs
717
737
  - sig/anthropic/models/beta/beta_request_mcp_server_tool_configuration.rbs
718
738
  - sig/anthropic/models/beta/beta_request_mcp_server_url_definition.rbs
719
739
  - sig/anthropic/models/beta/beta_request_mcp_tool_result_block_param.rbs
740
+ - sig/anthropic/models/beta/beta_search_result_block_param.rbs
720
741
  - sig/anthropic/models/beta/beta_server_tool_usage.rbs
721
742
  - sig/anthropic/models/beta/beta_server_tool_use_block.rbs
722
743
  - sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs
@@ -917,10 +938,12 @@ files:
917
938
  - sig/anthropic/resources/messages.rbs
918
939
  - sig/anthropic/resources/messages/batches.rbs
919
940
  - sig/anthropic/resources/models.rbs
941
+ - sig/anthropic/streaming.rbs
920
942
  - sig/anthropic/version.rbs
921
943
  - sig/anthropic/vertex.rbs
922
944
  homepage: https://gemdocs.org/gems/anthropic
923
- licenses: []
945
+ licenses:
946
+ - MIT
924
947
  metadata:
925
948
  homepage_uri: https://gemdocs.org/gems/anthropic
926
949
  source_code_uri: https://github.com/anthropics/anthropic-sdk-ruby