anthropic 1.13.0 → 1.15.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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/README.md +31 -1
  4. data/lib/anthropic/helpers/input_schema/base_model.rb +6 -3
  5. data/lib/anthropic/helpers/input_schema/json_schema_converter.rb +9 -3
  6. data/lib/anthropic/helpers/input_schema/supported_schemas.rb +106 -0
  7. data/lib/anthropic/helpers/input_schema/union_of.rb +3 -1
  8. data/lib/anthropic/helpers/messages.rb +107 -0
  9. data/lib/anthropic/helpers/streaming/message_stream.rb +54 -43
  10. data/lib/anthropic/helpers/tools/base_tool.rb +82 -0
  11. data/lib/anthropic/helpers/tools/runner.rb +156 -0
  12. data/lib/anthropic/helpers/tools.rb +5 -0
  13. data/lib/anthropic/internal/transport/base_client.rb +7 -1
  14. data/lib/anthropic/internal/transport/pooled_net_requester.rb +6 -2
  15. data/lib/anthropic/models/beta/beta_code_execution_tool_20250522.rb +8 -1
  16. data/lib/anthropic/models/beta/beta_code_execution_tool_20250825.rb +8 -1
  17. data/lib/anthropic/models/beta/beta_json_output_format.rb +27 -0
  18. data/lib/anthropic/models/beta/beta_memory_tool_20250818.rb +8 -1
  19. data/lib/anthropic/models/beta/beta_tool.rb +8 -1
  20. data/lib/anthropic/models/beta/beta_tool_bash_20241022.rb +8 -1
  21. data/lib/anthropic/models/beta/beta_tool_bash_20250124.rb +8 -1
  22. data/lib/anthropic/models/beta/beta_tool_computer_use_20241022.rb +8 -1
  23. data/lib/anthropic/models/beta/beta_tool_computer_use_20250124.rb +8 -1
  24. data/lib/anthropic/models/beta/beta_tool_text_editor_20241022.rb +8 -1
  25. data/lib/anthropic/models/beta/beta_tool_text_editor_20250124.rb +8 -1
  26. data/lib/anthropic/models/beta/beta_tool_text_editor_20250429.rb +8 -1
  27. data/lib/anthropic/models/beta/beta_tool_text_editor_20250728.rb +8 -1
  28. data/lib/anthropic/models/beta/beta_tool_use_block.rb +14 -0
  29. data/lib/anthropic/models/beta/beta_web_fetch_tool_20250910.rb +8 -1
  30. data/lib/anthropic/models/beta/beta_web_search_tool_20250305.rb +8 -1
  31. data/lib/anthropic/models/beta/message_count_tokens_params.rb +9 -1
  32. data/lib/anthropic/models/beta/message_create_params.rb +9 -1
  33. data/lib/anthropic/models/beta/messages/batch_create_params.rb +9 -1
  34. data/lib/anthropic/models/tool_use_block.rb +6 -6
  35. data/lib/anthropic/resources/beta/messages/batches.rb +6 -6
  36. data/lib/anthropic/resources/beta/messages.rb +37 -11
  37. data/lib/anthropic/resources/messages/batches.rb +6 -6
  38. data/lib/anthropic/resources/messages.rb +12 -84
  39. data/lib/anthropic/version.rb +1 -1
  40. data/lib/anthropic.rb +16 -10
  41. data/manifest.yaml +1 -0
  42. data/rbi/anthropic/helpers/input_schema/base_model.rbi +7 -2
  43. data/rbi/anthropic/helpers/tools/base_tool.rbi +51 -0
  44. data/rbi/anthropic/helpers/tools/runner.rbi +40 -0
  45. data/rbi/anthropic/helpers/tools.rbi +5 -0
  46. data/rbi/anthropic/internal/transport/base_client.rbi +5 -0
  47. data/rbi/anthropic/internal/transport/pooled_net_requester.rbi +6 -2
  48. data/rbi/anthropic/internal/type/base_model.rbi +8 -4
  49. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250522.rbi +10 -1
  50. data/rbi/anthropic/models/beta/beta_code_execution_tool_20250825.rbi +10 -1
  51. data/rbi/anthropic/models/beta/beta_json_output_format.rbi +46 -0
  52. data/rbi/anthropic/models/beta/beta_memory_tool_20250818.rbi +10 -1
  53. data/rbi/anthropic/models/beta/beta_tool.rbi +9 -0
  54. data/rbi/anthropic/models/beta/beta_tool_bash_20241022.rbi +10 -1
  55. data/rbi/anthropic/models/beta/beta_tool_bash_20250124.rbi +10 -1
  56. data/rbi/anthropic/models/beta/beta_tool_computer_use_20241022.rbi +10 -1
  57. data/rbi/anthropic/models/beta/beta_tool_computer_use_20250124.rbi +10 -1
  58. data/rbi/anthropic/models/beta/beta_tool_text_editor_20241022.rbi +10 -1
  59. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250124.rbi +10 -1
  60. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250429.rbi +10 -1
  61. data/rbi/anthropic/models/beta/beta_tool_text_editor_20250728.rbi +10 -1
  62. data/rbi/anthropic/models/beta/beta_web_fetch_tool_20250910.rbi +10 -1
  63. data/rbi/anthropic/models/beta/beta_web_search_tool_20250305.rbi +9 -0
  64. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +17 -0
  65. data/rbi/anthropic/models/beta/message_create_params.rbi +17 -0
  66. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +18 -0
  67. data/rbi/anthropic/models/tool_use_block.rbi +3 -0
  68. data/rbi/anthropic/resources/beta/messages/batches.rbi +6 -6
  69. data/rbi/anthropic/resources/beta/messages.rbi +313 -3
  70. data/rbi/anthropic/resources/messages/batches.rbi +6 -6
  71. data/rbi/anthropic/resources/messages.rbi +5 -3
  72. data/sig/anthropic/internal/transport/base_client.rbs +2 -0
  73. data/sig/anthropic/internal/transport/pooled_net_requester.rbs +4 -1
  74. data/sig/anthropic/models/beta/beta_code_execution_tool_20250522.rbs +9 -2
  75. data/sig/anthropic/models/beta/beta_code_execution_tool_20250825.rbs +9 -2
  76. data/sig/anthropic/models/beta/beta_json_output_format.rbs +23 -0
  77. data/sig/anthropic/models/beta/beta_memory_tool_20250818.rbs +9 -2
  78. data/sig/anthropic/models/beta/beta_tool.rbs +7 -0
  79. data/sig/anthropic/models/beta/beta_tool_bash_20241022.rbs +9 -2
  80. data/sig/anthropic/models/beta/beta_tool_bash_20250124.rbs +9 -2
  81. data/sig/anthropic/models/beta/beta_tool_computer_use_20241022.rbs +9 -2
  82. data/sig/anthropic/models/beta/beta_tool_computer_use_20250124.rbs +9 -2
  83. data/sig/anthropic/models/beta/beta_tool_text_editor_20241022.rbs +9 -2
  84. data/sig/anthropic/models/beta/beta_tool_text_editor_20250124.rbs +9 -2
  85. data/sig/anthropic/models/beta/beta_tool_text_editor_20250429.rbs +9 -2
  86. data/sig/anthropic/models/beta/beta_tool_text_editor_20250728.rbs +9 -2
  87. data/sig/anthropic/models/beta/beta_web_fetch_tool_20250910.rbs +9 -2
  88. data/sig/anthropic/models/beta/beta_web_search_tool_20250305.rbs +7 -0
  89. data/sig/anthropic/models/beta/message_count_tokens_params.rbs +5 -0
  90. data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
  91. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +5 -0
  92. data/sig/anthropic/resources/beta/messages.rbs +3 -0
  93. metadata +14 -4
  94. data/lib/anthropic/helpers/input_schema/property_mapping.rb +0 -47
  95. /data/rbi/anthropic/helpers/{structured_output.rbi → input_schema.rbi} +0 -0
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Anthropic
4
- module Helpers
5
- module InputSchema
6
- # rubocop:disable Style/MutableConstant
7
- PROPERTY_MAPPING = {
8
- # Numeric properties:
9
- minimum: :minimum,
10
- maximum: :maximum,
11
- exclusive_minimum: :exclusiveMinimum,
12
- exclusive_maximum: :exclusiveMaximum,
13
- multiple_of: :multipleOf,
14
-
15
- # String properties:
16
- min_length: :minLength,
17
- max_length: :maxLength,
18
- pattern: :pattern,
19
- format: :format,
20
- content_media_type: :contentMediaType,
21
- content_encoding: :contentEncoding,
22
-
23
- # Array properties:
24
- min_items: :minItems,
25
- max_items: :maxItems,
26
- unique_items: :uniqueItems,
27
- prefix_items: :prefixItems,
28
- contains: :contains,
29
- min_contains: :minContains,
30
- max_contains: :maxContains,
31
-
32
- # Object properties:
33
- pattern_properties: :patternProperties,
34
- dependent_schemas: :dependentSchemas,
35
- dependent_required: :dependentRequired,
36
- property_names: :propertyNames,
37
-
38
- # Metadata:
39
- default: :default,
40
- examples: :examples,
41
-
42
- doc: :description
43
- }
44
- # rubocop:enable Style/MutableConstant
45
- end
46
- end
47
- end