anthropic 1.11.0 → 1.13.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 (177) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/README.md +1 -1
  4. data/lib/anthropic/helpers/streaming/message_stream.rb +3 -0
  5. data/lib/anthropic/internal/page_cursor.rb +92 -0
  6. data/lib/anthropic/internal/token_page.rb +92 -0
  7. data/lib/anthropic/internal/transport/pooled_net_requester.rb +30 -24
  8. data/lib/anthropic/models/anthropic_beta.rb +3 -0
  9. data/lib/anthropic/models/beta/beta_all_thinking_turns.rb +19 -0
  10. data/lib/anthropic/models/beta/beta_clear_thinking_20251015_edit.rb +48 -0
  11. data/lib/anthropic/models/beta/beta_clear_thinking_20251015_edit_response.rb +36 -0
  12. data/lib/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rb +0 -2
  13. data/lib/anthropic/models/beta/beta_container.rb +9 -1
  14. data/lib/anthropic/models/beta/beta_container_params.rb +34 -0
  15. data/lib/anthropic/models/beta/beta_context_management_config.rb +17 -5
  16. data/lib/anthropic/models/beta/beta_context_management_response.rb +16 -5
  17. data/lib/anthropic/models/beta/beta_mcp_tool_use_block_param.rb +3 -3
  18. data/lib/anthropic/models/beta/beta_message.rb +4 -2
  19. data/lib/anthropic/models/beta/beta_raw_message_delta_event.rb +2 -2
  20. data/lib/anthropic/models/beta/beta_server_tool_use_block_param.rb +3 -3
  21. data/lib/anthropic/models/beta/beta_skill.rb +51 -0
  22. data/lib/anthropic/models/beta/beta_skill_params.rb +51 -0
  23. data/lib/anthropic/models/beta/beta_thinking_config_enabled.rb +1 -1
  24. data/lib/anthropic/models/beta/beta_thinking_config_param.rb +1 -1
  25. data/lib/anthropic/models/beta/beta_thinking_turns.rb +25 -0
  26. data/lib/anthropic/models/beta/beta_tool.rb +5 -3
  27. data/lib/anthropic/models/beta/beta_tool_use_block_param.rb +3 -3
  28. data/lib/anthropic/models/beta/message_count_tokens_params.rb +15 -12
  29. data/lib/anthropic/models/beta/message_create_params.rb +34 -18
  30. data/lib/anthropic/models/beta/messages/batch_create_params.rb +39 -20
  31. data/lib/anthropic/models/beta/skill_create_params.rb +49 -0
  32. data/lib/anthropic/models/beta/skill_create_response.rb +84 -0
  33. data/lib/anthropic/models/beta/skill_delete_params.rb +24 -0
  34. data/lib/anthropic/models/beta/skill_delete_response.rb +34 -0
  35. data/lib/anthropic/models/beta/skill_list_params.rb +61 -0
  36. data/lib/anthropic/models/beta/skill_list_response.rb +84 -0
  37. data/lib/anthropic/models/beta/skill_retrieve_params.rb +24 -0
  38. data/lib/anthropic/models/beta/skill_retrieve_response.rb +84 -0
  39. data/lib/anthropic/models/beta/skills/version_create_params.rb +42 -0
  40. data/lib/anthropic/models/beta/skills/version_create_response.rb +92 -0
  41. data/lib/anthropic/models/beta/skills/version_delete_params.rb +39 -0
  42. data/lib/anthropic/models/beta/skills/version_delete_response.rb +36 -0
  43. data/lib/anthropic/models/beta/skills/version_list_params.rb +47 -0
  44. data/lib/anthropic/models/beta/skills/version_list_response.rb +92 -0
  45. data/lib/anthropic/models/beta/skills/version_retrieve_params.rb +39 -0
  46. data/lib/anthropic/models/beta/skills/version_retrieve_response.rb +92 -0
  47. data/lib/anthropic/models/completion_create_params.rb +3 -4
  48. data/lib/anthropic/models/message_count_tokens_params.rb +10 -10
  49. data/lib/anthropic/models/message_create_params.rb +13 -13
  50. data/lib/anthropic/models/messages/batch_create_params.rb +14 -15
  51. data/lib/anthropic/models/model.rb +6 -20
  52. data/lib/anthropic/models/server_tool_use_block_param.rb +3 -3
  53. data/lib/anthropic/models/stop_reason.rb +0 -1
  54. data/lib/anthropic/models/thinking_config_enabled.rb +1 -1
  55. data/lib/anthropic/models/thinking_config_param.rb +1 -1
  56. data/lib/anthropic/models/tool.rb +5 -3
  57. data/lib/anthropic/models/tool_use_block_param.rb +3 -3
  58. data/lib/anthropic/resources/beta/messages.rb +5 -5
  59. data/lib/anthropic/resources/beta/skills/versions.rb +154 -0
  60. data/lib/anthropic/resources/beta/skills.rb +144 -0
  61. data/lib/anthropic/resources/beta.rb +4 -0
  62. data/lib/anthropic/resources/completions.rb +4 -4
  63. data/lib/anthropic/version.rb +1 -1
  64. data/lib/anthropic.rb +27 -0
  65. data/rbi/anthropic/internal/page_cursor.rbi +25 -0
  66. data/rbi/anthropic/internal/token_page.rbi +25 -0
  67. data/rbi/anthropic/models/anthropic_beta.rbi +2 -0
  68. data/rbi/anthropic/models/beta/beta_all_thinking_turns.rbi +30 -0
  69. data/rbi/anthropic/models/beta/beta_clear_thinking_20251015_edit.rbi +109 -0
  70. data/rbi/anthropic/models/beta/beta_clear_thinking_20251015_edit_response.rbi +61 -0
  71. data/rbi/anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response.rbi +0 -1
  72. data/rbi/anthropic/models/beta/beta_container.rbi +23 -3
  73. data/rbi/anthropic/models/beta/beta_container_params.rbi +54 -0
  74. data/rbi/anthropic/models/beta/beta_context_management_config.rbi +51 -5
  75. data/rbi/anthropic/models/beta/beta_context_management_response.rbi +32 -4
  76. data/rbi/anthropic/models/beta/beta_mcp_tool_use_block.rbi +3 -3
  77. data/rbi/anthropic/models/beta/beta_mcp_tool_use_block_param.rbi +3 -3
  78. data/rbi/anthropic/models/beta/beta_message.rbi +6 -2
  79. data/rbi/anthropic/models/beta/beta_raw_message_delta_event.rbi +2 -2
  80. data/rbi/anthropic/models/beta/beta_server_tool_use_block.rbi +3 -3
  81. data/rbi/anthropic/models/beta/beta_server_tool_use_block_param.rbi +3 -3
  82. data/rbi/anthropic/models/beta/beta_skill.rbi +80 -0
  83. data/rbi/anthropic/models/beta/beta_skill_params.rbi +91 -0
  84. data/rbi/anthropic/models/beta/beta_thinking_config_enabled.rbi +2 -2
  85. data/rbi/anthropic/models/beta/beta_thinking_config_param.rbi +1 -1
  86. data/rbi/anthropic/models/beta/beta_thinking_turns.rbi +33 -0
  87. data/rbi/anthropic/models/beta/beta_tool.rbi +3 -3
  88. data/rbi/anthropic/models/beta/beta_tool_use_block.rbi +8 -3
  89. data/rbi/anthropic/models/beta/beta_tool_use_block_param.rbi +3 -3
  90. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +27 -21
  91. data/rbi/anthropic/models/beta/message_create_params.rbi +61 -29
  92. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +70 -33
  93. data/rbi/anthropic/models/beta/skill_create_params.rbi +90 -0
  94. data/rbi/anthropic/models/beta/skill_create_response.rbi +118 -0
  95. data/rbi/anthropic/models/beta/skill_delete_params.rbi +62 -0
  96. data/rbi/anthropic/models/beta/skill_delete_response.rbi +46 -0
  97. data/rbi/anthropic/models/beta/skill_list_params.rbi +109 -0
  98. data/rbi/anthropic/models/beta/skill_list_response.rbi +118 -0
  99. data/rbi/anthropic/models/beta/skill_retrieve_params.rbi +62 -0
  100. data/rbi/anthropic/models/beta/skill_retrieve_response.rbi +118 -0
  101. data/rbi/anthropic/models/beta/skills/version_create_params.rbi +79 -0
  102. data/rbi/anthropic/models/beta/skills/version_create_response.rbi +124 -0
  103. data/rbi/anthropic/models/beta/skills/version_delete_params.rbi +77 -0
  104. data/rbi/anthropic/models/beta/skills/version_delete_response.rbi +48 -0
  105. data/rbi/anthropic/models/beta/skills/version_list_params.rbi +85 -0
  106. data/rbi/anthropic/models/beta/skills/version_list_response.rbi +124 -0
  107. data/rbi/anthropic/models/beta/skills/version_retrieve_params.rbi +77 -0
  108. data/rbi/anthropic/models/beta/skills/version_retrieve_response.rbi +124 -0
  109. data/rbi/anthropic/models/completion_create_params.rbi +6 -8
  110. data/rbi/anthropic/models/message_count_tokens_params.rbi +19 -19
  111. data/rbi/anthropic/models/message_create_params.rbi +24 -24
  112. data/rbi/anthropic/models/messages/batch_create_params.rbi +26 -28
  113. data/rbi/anthropic/models/model.rbi +0 -11
  114. data/rbi/anthropic/models/server_tool_use_block.rbi +8 -3
  115. data/rbi/anthropic/models/server_tool_use_block_param.rbi +3 -3
  116. data/rbi/anthropic/models/stop_reason.rbi +0 -5
  117. data/rbi/anthropic/models/thinking_config_enabled.rbi +2 -2
  118. data/rbi/anthropic/models/thinking_config_param.rbi +1 -1
  119. data/rbi/anthropic/models/tool.rbi +3 -3
  120. data/rbi/anthropic/models/tool_use_block.rbi +8 -3
  121. data/rbi/anthropic/models/tool_use_block_param.rbi +3 -3
  122. data/rbi/anthropic/resources/beta/messages.rbi +51 -36
  123. data/rbi/anthropic/resources/beta/skills/versions.rbi +124 -0
  124. data/rbi/anthropic/resources/beta/skills.rbi +118 -0
  125. data/rbi/anthropic/resources/beta.rbi +3 -0
  126. data/rbi/anthropic/resources/completions.rbi +10 -12
  127. data/rbi/anthropic/resources/messages.rbi +31 -31
  128. data/sig/anthropic/internal/page_cursor.rbs +15 -0
  129. data/sig/anthropic/internal/token_page.rbs +15 -0
  130. data/sig/anthropic/models/anthropic_beta.rbs +2 -0
  131. data/sig/anthropic/models/beta/beta_all_thinking_turns.rbs +17 -0
  132. data/sig/anthropic/models/beta/beta_clear_thinking_20251015_edit.rbs +44 -0
  133. data/sig/anthropic/models/beta/beta_clear_thinking_20251015_edit_response.rbs +34 -0
  134. data/sig/anthropic/models/beta/beta_container.rbs +18 -3
  135. data/sig/anthropic/models/beta/beta_container_params.rbs +26 -0
  136. data/sig/anthropic/models/beta/beta_context_management_config.rbs +18 -6
  137. data/sig/anthropic/models/beta/beta_context_management_response.rbs +14 -4
  138. data/sig/anthropic/models/beta/beta_mcp_tool_use_block.rbs +4 -4
  139. data/sig/anthropic/models/beta/beta_mcp_tool_use_block_param.rbs +4 -4
  140. data/sig/anthropic/models/beta/beta_server_tool_use_block.rbs +4 -4
  141. data/sig/anthropic/models/beta/beta_server_tool_use_block_param.rbs +4 -4
  142. data/sig/anthropic/models/beta/beta_skill.rbs +45 -0
  143. data/sig/anthropic/models/beta/beta_skill_params.rbs +47 -0
  144. data/sig/anthropic/models/beta/beta_thinking_turns.rbs +19 -0
  145. data/sig/anthropic/models/beta/beta_tool.rbs +8 -4
  146. data/sig/anthropic/models/beta/beta_tool_use_block.rbs +9 -4
  147. data/sig/anthropic/models/beta/beta_tool_use_block_param.rbs +4 -4
  148. data/sig/anthropic/models/beta/message_create_params.rbs +12 -4
  149. data/sig/anthropic/models/beta/messages/batch_create_params.rbs +12 -4
  150. data/sig/anthropic/models/beta/skill_create_params.rbs +42 -0
  151. data/sig/anthropic/models/beta/skill_create_response.rbs +52 -0
  152. data/sig/anthropic/models/beta/skill_delete_params.rbs +30 -0
  153. data/sig/anthropic/models/beta/skill_delete_response.rbs +17 -0
  154. data/sig/anthropic/models/beta/skill_list_params.rbs +49 -0
  155. data/sig/anthropic/models/beta/skill_list_response.rbs +52 -0
  156. data/sig/anthropic/models/beta/skill_retrieve_params.rbs +30 -0
  157. data/sig/anthropic/models/beta/skill_retrieve_response.rbs +52 -0
  158. data/sig/anthropic/models/beta/skills/version_create_params.rbs +39 -0
  159. data/sig/anthropic/models/beta/skills/version_create_response.rbs +59 -0
  160. data/sig/anthropic/models/beta/skills/version_delete_params.rbs +39 -0
  161. data/sig/anthropic/models/beta/skills/version_delete_response.rbs +19 -0
  162. data/sig/anthropic/models/beta/skills/version_list_params.rbs +44 -0
  163. data/sig/anthropic/models/beta/skills/version_list_response.rbs +59 -0
  164. data/sig/anthropic/models/beta/skills/version_retrieve_params.rbs +39 -0
  165. data/sig/anthropic/models/beta/skills/version_retrieve_response.rbs +59 -0
  166. data/sig/anthropic/models/model.rbs +0 -11
  167. data/sig/anthropic/models/server_tool_use_block.rbs +9 -4
  168. data/sig/anthropic/models/server_tool_use_block_param.rbs +4 -4
  169. data/sig/anthropic/models/stop_reason.rbs +0 -2
  170. data/sig/anthropic/models/tool.rbs +8 -4
  171. data/sig/anthropic/models/tool_use_block.rbs +9 -4
  172. data/sig/anthropic/models/tool_use_block_param.rbs +4 -4
  173. data/sig/anthropic/resources/beta/messages.rbs +2 -2
  174. data/sig/anthropic/resources/beta/skills/versions.rbs +40 -0
  175. data/sig/anthropic/resources/beta/skills.rbs +38 -0
  176. data/sig/anthropic/resources/beta.rbs +2 -0
  177. metadata +83 -2
@@ -28,9 +28,9 @@ module Anthropic
28
28
  #
29
29
  # @param model [Symbol, String, Anthropic::Models::Model] Body param: The model that will complete your prompt.\n\nSee [models](https://do
30
30
  #
31
- # @param container [String, nil] Body param: Container identifier for reuse across requests.
31
+ # @param container [Anthropic::Models::Beta::BetaContainerParams, String, nil] Body param: Container identifier for reuse across requests.
32
32
  #
33
- # @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Configuration for context management operations.
33
+ # @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Context management configuration.
34
34
  #
35
35
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
36
36
  #
@@ -112,9 +112,9 @@ module Anthropic
112
112
  #
113
113
  # @param model [Symbol, String, Anthropic::Models::Model] Body param: The model that will complete your prompt.\n\nSee [models](https://do
114
114
  #
115
- # @param container [String, nil] Body param: Container identifier for reuse across requests.
115
+ # @param container [Anthropic::Models::Beta::BetaContainerParams, String, nil] Body param: Container identifier for reuse across requests.
116
116
  #
117
- # @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Configuration for context management operations.
117
+ # @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Context management configuration.
118
118
  #
119
119
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
120
120
  #
@@ -255,7 +255,7 @@ module Anthropic
255
255
  #
256
256
  # @param model [Symbol, String, Anthropic::Models::Model] Body param: The model that will complete your prompt.\n\nSee [models](https://do
257
257
  #
258
- # @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Configuration for context management operations.
258
+ # @param context_management [Anthropic::Models::Beta::BetaContextManagementConfig, nil] Body param: Context management configuration.
259
259
  #
260
260
  # @param mcp_servers [Array<Anthropic::Models::Beta::BetaRequestMCPServerURLDefinition>] Body param: MCP servers to be utilized in this request
261
261
  #
@@ -0,0 +1,154 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Resources
5
+ class Beta
6
+ class Skills
7
+ class Versions
8
+ # Some parameter documentations has been truncated, see
9
+ # {Anthropic::Models::Beta::Skills::VersionCreateParams} for more details.
10
+ #
11
+ # Create Skill Version
12
+ #
13
+ # @overload create(skill_id, files: nil, betas: nil, request_options: {})
14
+ #
15
+ # @param skill_id [String] Path param: Unique identifier for the skill.
16
+ #
17
+ # @param files [Array<Pathname, StringIO, IO, String, Anthropic::FilePart>, nil] Body param: Files to upload for the skill.
18
+ #
19
+ # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
20
+ #
21
+ # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
22
+ #
23
+ # @return [Anthropic::Models::Beta::Skills::VersionCreateResponse]
24
+ #
25
+ # @see Anthropic::Models::Beta::Skills::VersionCreateParams
26
+ def create(skill_id, params = {})
27
+ parsed, options = Anthropic::Beta::Skills::VersionCreateParams.dump_request(params)
28
+ header_params = {betas: "anthropic-beta"}
29
+ @client.request(
30
+ method: :post,
31
+ path: ["v1/skills/%1$s/versions?beta=true", skill_id],
32
+ headers: {
33
+ "content-type" => "multipart/form-data",
34
+ **parsed.slice(*header_params.keys)
35
+ }.transform_keys(
36
+ header_params
37
+ ),
38
+ body: parsed.except(*header_params.keys),
39
+ model: Anthropic::Models::Beta::Skills::VersionCreateResponse,
40
+ options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
41
+ )
42
+ end
43
+
44
+ # Some parameter documentations has been truncated, see
45
+ # {Anthropic::Models::Beta::Skills::VersionRetrieveParams} for more details.
46
+ #
47
+ # Get Skill Version
48
+ #
49
+ # @overload retrieve(version, skill_id:, betas: nil, request_options: {})
50
+ #
51
+ # @param version [String] Path param: Version identifier for the skill.
52
+ #
53
+ # @param skill_id [String] Path param: Unique identifier for the skill.
54
+ #
55
+ # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
56
+ #
57
+ # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
58
+ #
59
+ # @return [Anthropic::Models::Beta::Skills::VersionRetrieveResponse]
60
+ #
61
+ # @see Anthropic::Models::Beta::Skills::VersionRetrieveParams
62
+ def retrieve(version, params)
63
+ parsed, options = Anthropic::Beta::Skills::VersionRetrieveParams.dump_request(params)
64
+ skill_id =
65
+ parsed.delete(:skill_id) do
66
+ raise ArgumentError.new("missing required path argument #{_1}")
67
+ end
68
+ @client.request(
69
+ method: :get,
70
+ path: ["v1/skills/%1$s/versions/%2$s?beta=true", skill_id, version],
71
+ headers: parsed.transform_keys(betas: "anthropic-beta"),
72
+ model: Anthropic::Models::Beta::Skills::VersionRetrieveResponse,
73
+ options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
74
+ )
75
+ end
76
+
77
+ # Some parameter documentations has been truncated, see
78
+ # {Anthropic::Models::Beta::Skills::VersionListParams} for more details.
79
+ #
80
+ # List Skill Versions
81
+ #
82
+ # @overload list(skill_id, limit: nil, page: nil, betas: nil, request_options: {})
83
+ #
84
+ # @param skill_id [String] Path param: Unique identifier for the skill.
85
+ #
86
+ # @param limit [Integer, nil] Query param: Number of items to return per page.
87
+ #
88
+ # @param page [String, nil] Query param: Optionally set to the `next_page` token from the previous response.
89
+ #
90
+ # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
91
+ #
92
+ # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
93
+ #
94
+ # @return [Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Skills::VersionListResponse>]
95
+ #
96
+ # @see Anthropic::Models::Beta::Skills::VersionListParams
97
+ def list(skill_id, params = {})
98
+ parsed, options = Anthropic::Beta::Skills::VersionListParams.dump_request(params)
99
+ query_params = [:limit, :page]
100
+ @client.request(
101
+ method: :get,
102
+ path: ["v1/skills/%1$s/versions?beta=true", skill_id],
103
+ query: parsed.slice(*query_params),
104
+ headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"),
105
+ page: Anthropic::Internal::PageCursor,
106
+ model: Anthropic::Models::Beta::Skills::VersionListResponse,
107
+ options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
108
+ )
109
+ end
110
+
111
+ # Some parameter documentations has been truncated, see
112
+ # {Anthropic::Models::Beta::Skills::VersionDeleteParams} for more details.
113
+ #
114
+ # Delete Skill Version
115
+ #
116
+ # @overload delete(version, skill_id:, betas: nil, request_options: {})
117
+ #
118
+ # @param version [String] Path param: Version identifier for the skill.
119
+ #
120
+ # @param skill_id [String] Path param: Unique identifier for the skill.
121
+ #
122
+ # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
123
+ #
124
+ # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
125
+ #
126
+ # @return [Anthropic::Models::Beta::Skills::VersionDeleteResponse]
127
+ #
128
+ # @see Anthropic::Models::Beta::Skills::VersionDeleteParams
129
+ def delete(version, params)
130
+ parsed, options = Anthropic::Beta::Skills::VersionDeleteParams.dump_request(params)
131
+ skill_id =
132
+ parsed.delete(:skill_id) do
133
+ raise ArgumentError.new("missing required path argument #{_1}")
134
+ end
135
+ @client.request(
136
+ method: :delete,
137
+ path: ["v1/skills/%1$s/versions/%2$s?beta=true", skill_id, version],
138
+ headers: parsed.transform_keys(betas: "anthropic-beta"),
139
+ model: Anthropic::Models::Beta::Skills::VersionDeleteResponse,
140
+ options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
141
+ )
142
+ end
143
+
144
+ # @api private
145
+ #
146
+ # @param client [Anthropic::Client]
147
+ def initialize(client:)
148
+ @client = client
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end
154
+ end
@@ -0,0 +1,144 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Anthropic
4
+ module Resources
5
+ class Beta
6
+ class Skills
7
+ # @return [Anthropic::Resources::Beta::Skills::Versions]
8
+ attr_reader :versions
9
+
10
+ # Some parameter documentations has been truncated, see
11
+ # {Anthropic::Models::Beta::SkillCreateParams} for more details.
12
+ #
13
+ # Create Skill
14
+ #
15
+ # @overload create(display_title: nil, files: nil, betas: nil, request_options: {})
16
+ #
17
+ # @param display_title [String, nil] Body param: Display title for the skill.
18
+ #
19
+ # @param files [Array<Pathname, StringIO, IO, String, Anthropic::FilePart>, nil] Body param: Files to upload for the skill.
20
+ #
21
+ # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
22
+ #
23
+ # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
24
+ #
25
+ # @return [Anthropic::Models::Beta::SkillCreateResponse]
26
+ #
27
+ # @see Anthropic::Models::Beta::SkillCreateParams
28
+ def create(params = {})
29
+ parsed, options = Anthropic::Beta::SkillCreateParams.dump_request(params)
30
+ header_params = {betas: "anthropic-beta"}
31
+ @client.request(
32
+ method: :post,
33
+ path: "v1/skills?beta=true",
34
+ headers: {
35
+ "content-type" => "multipart/form-data",
36
+ **parsed.slice(*header_params.keys)
37
+ }.transform_keys(
38
+ header_params
39
+ ),
40
+ body: parsed.except(*header_params.keys),
41
+ model: Anthropic::Models::Beta::SkillCreateResponse,
42
+ options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
43
+ )
44
+ end
45
+
46
+ # Some parameter documentations has been truncated, see
47
+ # {Anthropic::Models::Beta::SkillRetrieveParams} for more details.
48
+ #
49
+ # Get Skill
50
+ #
51
+ # @overload retrieve(skill_id, betas: nil, request_options: {})
52
+ #
53
+ # @param skill_id [String] Unique identifier for the skill.
54
+ #
55
+ # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Optional header to specify the beta version(s) you want to use.
56
+ #
57
+ # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
58
+ #
59
+ # @return [Anthropic::Models::Beta::SkillRetrieveResponse]
60
+ #
61
+ # @see Anthropic::Models::Beta::SkillRetrieveParams
62
+ def retrieve(skill_id, params = {})
63
+ parsed, options = Anthropic::Beta::SkillRetrieveParams.dump_request(params)
64
+ @client.request(
65
+ method: :get,
66
+ path: ["v1/skills/%1$s?beta=true", skill_id],
67
+ headers: parsed.transform_keys(betas: "anthropic-beta"),
68
+ model: Anthropic::Models::Beta::SkillRetrieveResponse,
69
+ options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
70
+ )
71
+ end
72
+
73
+ # Some parameter documentations has been truncated, see
74
+ # {Anthropic::Models::Beta::SkillListParams} for more details.
75
+ #
76
+ # List Skills
77
+ #
78
+ # @overload list(limit: nil, page: nil, source: nil, betas: nil, request_options: {})
79
+ #
80
+ # @param limit [Integer] Query param: Number of results to return per page.
81
+ #
82
+ # @param page [String, nil] Query param: Pagination token for fetching a specific page of results.
83
+ #
84
+ # @param source [String, nil] Query param: Filter skills by source.
85
+ #
86
+ # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Header param: Optional header to specify the beta version(s) you want to use.
87
+ #
88
+ # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
89
+ #
90
+ # @return [Anthropic::Internal::PageCursor<Anthropic::Models::Beta::SkillListResponse>]
91
+ #
92
+ # @see Anthropic::Models::Beta::SkillListParams
93
+ def list(params = {})
94
+ parsed, options = Anthropic::Beta::SkillListParams.dump_request(params)
95
+ query_params = [:limit, :page, :source]
96
+ @client.request(
97
+ method: :get,
98
+ path: "v1/skills?beta=true",
99
+ query: parsed.slice(*query_params),
100
+ headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"),
101
+ page: Anthropic::Internal::PageCursor,
102
+ model: Anthropic::Models::Beta::SkillListResponse,
103
+ options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
104
+ )
105
+ end
106
+
107
+ # Some parameter documentations has been truncated, see
108
+ # {Anthropic::Models::Beta::SkillDeleteParams} for more details.
109
+ #
110
+ # Delete Skill
111
+ #
112
+ # @overload delete(skill_id, betas: nil, request_options: {})
113
+ #
114
+ # @param skill_id [String] Unique identifier for the skill.
115
+ #
116
+ # @param betas [Array<String, Symbol, Anthropic::Models::AnthropicBeta>] Optional header to specify the beta version(s) you want to use.
117
+ #
118
+ # @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
119
+ #
120
+ # @return [Anthropic::Models::Beta::SkillDeleteResponse]
121
+ #
122
+ # @see Anthropic::Models::Beta::SkillDeleteParams
123
+ def delete(skill_id, params = {})
124
+ parsed, options = Anthropic::Beta::SkillDeleteParams.dump_request(params)
125
+ @client.request(
126
+ method: :delete,
127
+ path: ["v1/skills/%1$s?beta=true", skill_id],
128
+ headers: parsed.transform_keys(betas: "anthropic-beta"),
129
+ model: Anthropic::Models::Beta::SkillDeleteResponse,
130
+ options: {extra_headers: {"anthropic-beta" => "skills-2025-10-02"}, **options}
131
+ )
132
+ end
133
+
134
+ # @api private
135
+ #
136
+ # @param client [Anthropic::Client]
137
+ def initialize(client:)
138
+ @client = client
139
+ @versions = Anthropic::Resources::Beta::Skills::Versions.new(client: client)
140
+ end
141
+ end
142
+ end
143
+ end
144
+ end
@@ -12,6 +12,9 @@ module Anthropic
12
12
  # @return [Anthropic::Resources::Beta::Files]
13
13
  attr_reader :files
14
14
 
15
+ # @return [Anthropic::Resources::Beta::Skills]
16
+ attr_reader :skills
17
+
15
18
  # @api private
16
19
  #
17
20
  # @param client [Anthropic::Client]
@@ -20,6 +23,7 @@ module Anthropic
20
23
  @models = Anthropic::Resources::Beta::Models.new(client: client)
21
24
  @messages = Anthropic::Resources::Beta::Messages.new(client: client)
22
25
  @files = Anthropic::Resources::Beta::Files.new(client: client)
26
+ @skills = Anthropic::Resources::Beta::Skills.new(client: client)
23
27
  end
24
28
  end
25
29
  end
@@ -12,10 +12,10 @@ module Anthropic
12
12
  # [Legacy] Create a Text Completion.
13
13
  #
14
14
  # The Text Completions API is a legacy API. We recommend using the
15
- # [Messages API](https://docs.anthropic.com/en/api/messages) going forward.
15
+ # [Messages API](https://docs.claude.com/en/api/messages) going forward.
16
16
  #
17
17
  # Future models and features will not be compatible with Text Completions. See our
18
- # [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages)
18
+ # [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages)
19
19
  # for guidance in migrating from Text Completions to Messages.
20
20
  #
21
21
  # @overload create(max_tokens_to_sample:, model:, prompt:, metadata: nil, stop_sequences: nil, temperature: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
@@ -68,10 +68,10 @@ module Anthropic
68
68
  # [Legacy] Create a Text Completion.
69
69
  #
70
70
  # The Text Completions API is a legacy API. We recommend using the
71
- # [Messages API](https://docs.anthropic.com/en/api/messages) going forward.
71
+ # [Messages API](https://docs.claude.com/en/api/messages) going forward.
72
72
  #
73
73
  # Future models and features will not be compatible with Text Completions. See our
74
- # [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages)
74
+ # [migration guide](https://docs.claude.com/en/api/migrating-from-text-completions-to-messages)
75
75
  # for guidance in migrating from Text Completions to Messages.
76
76
  #
77
77
  # @overload create_streaming(max_tokens_to_sample:, model:, prompt:, metadata: nil, stop_sequences: nil, temperature: nil, top_k: nil, top_p: nil, betas: nil, request_options: {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anthropic
4
- VERSION = "1.11.0"
4
+ VERSION = "1.13.0"
5
5
  end
data/lib/anthropic.rb CHANGED
@@ -58,12 +58,15 @@ require_relative "anthropic/vertex"
58
58
  require_relative "anthropic/internal/stream"
59
59
  require_relative "anthropic/internal/jsonl_stream"
60
60
  require_relative "anthropic/internal/page"
61
+ require_relative "anthropic/internal/page_cursor"
62
+ require_relative "anthropic/internal/token_page"
61
63
  require_relative "anthropic/models/beta/beta_request_document_block"
62
64
  require_relative "anthropic/models/anthropic_beta"
63
65
  require_relative "anthropic/models/api_error_object"
64
66
  require_relative "anthropic/models/authentication_error"
65
67
  require_relative "anthropic/models/base64_image_source"
66
68
  require_relative "anthropic/models/base64_pdf_source"
69
+ require_relative "anthropic/models/beta/beta_all_thinking_turns"
67
70
  require_relative "anthropic/models/beta/beta_base64_image_source"
68
71
  require_relative "anthropic/models/beta/beta_base64_pdf_block"
69
72
  require_relative "anthropic/models/beta/beta_base64_pdf_source"
@@ -90,6 +93,8 @@ require_relative "anthropic/models/beta/beta_citation_search_result_location"
90
93
  require_relative "anthropic/models/beta/beta_citation_search_result_location_param"
91
94
  require_relative "anthropic/models/beta/beta_citations_web_search_result_location"
92
95
  require_relative "anthropic/models/beta/beta_citation_web_search_result_location_param"
96
+ require_relative "anthropic/models/beta/beta_clear_thinking_20251015_edit"
97
+ require_relative "anthropic/models/beta/beta_clear_thinking_20251015_edit_response"
93
98
  require_relative "anthropic/models/beta/beta_clear_tool_uses_20250919_edit"
94
99
  require_relative "anthropic/models/beta/beta_clear_tool_uses_20250919_edit_response"
95
100
  require_relative "anthropic/models/beta/beta_code_execution_output_block"
@@ -106,6 +111,7 @@ require_relative "anthropic/models/beta/beta_code_execution_tool_result_error"
106
111
  require_relative "anthropic/models/beta/beta_code_execution_tool_result_error_code"
107
112
  require_relative "anthropic/models/beta/beta_code_execution_tool_result_error_param"
108
113
  require_relative "anthropic/models/beta/beta_container"
114
+ require_relative "anthropic/models/beta/beta_container_params"
109
115
  require_relative "anthropic/models/beta/beta_container_upload_block"
110
116
  require_relative "anthropic/models/beta/beta_container_upload_block_param"
111
117
  require_relative "anthropic/models/beta/beta_content_block"
@@ -158,6 +164,8 @@ require_relative "anthropic/models/beta/beta_server_tool_usage"
158
164
  require_relative "anthropic/models/beta/beta_server_tool_use_block"
159
165
  require_relative "anthropic/models/beta/beta_server_tool_use_block_param"
160
166
  require_relative "anthropic/models/beta/beta_signature_delta"
167
+ require_relative "anthropic/models/beta/beta_skill"
168
+ require_relative "anthropic/models/beta/beta_skill_params"
161
169
  require_relative "anthropic/models/beta/beta_stop_reason"
162
170
  require_relative "anthropic/models/beta/beta_text_block"
163
171
  require_relative "anthropic/models/beta/beta_text_block_param"
@@ -180,6 +188,7 @@ require_relative "anthropic/models/beta/beta_thinking_config_disabled"
180
188
  require_relative "anthropic/models/beta/beta_thinking_config_enabled"
181
189
  require_relative "anthropic/models/beta/beta_thinking_config_param"
182
190
  require_relative "anthropic/models/beta/beta_thinking_delta"
191
+ require_relative "anthropic/models/beta/beta_thinking_turns"
183
192
  require_relative "anthropic/models/beta/beta_tool"
184
193
  require_relative "anthropic/models/beta/beta_tool_bash_20241022"
185
194
  require_relative "anthropic/models/beta/beta_tool_bash_20250124"
@@ -247,6 +256,22 @@ require_relative "anthropic/models/beta/messages/beta_message_batch_result"
247
256
  require_relative "anthropic/models/beta/messages/beta_message_batch_succeeded_result"
248
257
  require_relative "anthropic/models/beta/model_list_params"
249
258
  require_relative "anthropic/models/beta/model_retrieve_params"
259
+ require_relative "anthropic/models/beta/skill_create_params"
260
+ require_relative "anthropic/models/beta/skill_create_response"
261
+ require_relative "anthropic/models/beta/skill_delete_params"
262
+ require_relative "anthropic/models/beta/skill_delete_response"
263
+ require_relative "anthropic/models/beta/skill_list_params"
264
+ require_relative "anthropic/models/beta/skill_list_response"
265
+ require_relative "anthropic/models/beta/skill_retrieve_params"
266
+ require_relative "anthropic/models/beta/skill_retrieve_response"
267
+ require_relative "anthropic/models/beta/skills/version_create_params"
268
+ require_relative "anthropic/models/beta/skills/version_create_response"
269
+ require_relative "anthropic/models/beta/skills/version_delete_params"
270
+ require_relative "anthropic/models/beta/skills/version_delete_response"
271
+ require_relative "anthropic/models/beta/skills/version_list_params"
272
+ require_relative "anthropic/models/beta/skills/version_list_response"
273
+ require_relative "anthropic/models/beta/skills/version_retrieve_params"
274
+ require_relative "anthropic/models/beta/skills/version_retrieve_response"
250
275
  require_relative "anthropic/models/beta_api_error"
251
276
  require_relative "anthropic/models/beta_authentication_error"
252
277
  require_relative "anthropic/models/beta_billing_error"
@@ -381,6 +406,8 @@ require_relative "anthropic/resources/beta/files"
381
406
  require_relative "anthropic/resources/beta/messages"
382
407
  require_relative "anthropic/resources/beta/messages/batches"
383
408
  require_relative "anthropic/resources/beta/models"
409
+ require_relative "anthropic/resources/beta/skills"
410
+ require_relative "anthropic/resources/beta/skills/versions"
384
411
  require_relative "anthropic/resources/completions"
385
412
  require_relative "anthropic/resources/messages"
386
413
  require_relative "anthropic/resources/messages/batches"
@@ -0,0 +1,25 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Internal
5
+ class PageCursor
6
+ include Anthropic::Internal::Type::BasePage
7
+
8
+ Elem = type_member
9
+
10
+ sig { returns(T.nilable(T::Array[Elem])) }
11
+ attr_accessor :data
12
+
13
+ sig { returns(T::Boolean) }
14
+ attr_accessor :has_more
15
+
16
+ sig { returns(T.nilable(String)) }
17
+ attr_accessor :next_page_
18
+
19
+ # @api private
20
+ sig { returns(String) }
21
+ def inspect
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Internal
5
+ class TokenPage
6
+ include Anthropic::Internal::Type::BasePage
7
+
8
+ Elem = type_member
9
+
10
+ sig { returns(T.nilable(T::Array[Elem])) }
11
+ attr_accessor :data
12
+
13
+ sig { returns(T::Boolean) }
14
+ attr_accessor :has_more
15
+
16
+ sig { returns(T.nilable(String)) }
17
+ attr_accessor :next_page_
18
+
19
+ # @api private
20
+ sig { returns(String) }
21
+ def inspect
22
+ end
23
+ end
24
+ end
25
+ end
@@ -85,6 +85,8 @@ module Anthropic
85
85
  :"model-context-window-exceeded-2025-08-26",
86
86
  Anthropic::AnthropicBeta::TaggedSymbol
87
87
  )
88
+ SKILLS_2025_10_02 =
89
+ T.let(:"skills-2025-10-02", Anthropic::AnthropicBeta::TaggedSymbol)
88
90
  end
89
91
  end
90
92
  end
@@ -0,0 +1,30 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaAllThinkingTurns = Beta::BetaAllThinkingTurns
6
+
7
+ module Beta
8
+ class BetaAllThinkingTurns < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaAllThinkingTurns,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(Symbol) }
18
+ attr_accessor :type
19
+
20
+ sig { params(type: Symbol).returns(T.attached_class) }
21
+ def self.new(type: :all)
22
+ end
23
+
24
+ sig { override.returns({ type: Symbol }) }
25
+ def to_hash
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,109 @@
1
+ # typed: strong
2
+
3
+ module Anthropic
4
+ module Models
5
+ BetaClearThinking20251015Edit = Beta::BetaClearThinking20251015Edit
6
+
7
+ module Beta
8
+ class BetaClearThinking20251015Edit < Anthropic::Internal::Type::BaseModel
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Anthropic::Beta::BetaClearThinking20251015Edit,
13
+ Anthropic::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(Symbol) }
18
+ attr_accessor :type
19
+
20
+ # Number of most recent assistant turns to keep thinking blocks for. Older turns
21
+ # will have their thinking blocks removed.
22
+ sig do
23
+ returns(
24
+ T.nilable(
25
+ T.any(
26
+ Anthropic::Beta::BetaThinkingTurns,
27
+ Anthropic::Beta::BetaAllThinkingTurns,
28
+ Symbol
29
+ )
30
+ )
31
+ )
32
+ end
33
+ attr_reader :keep
34
+
35
+ sig do
36
+ params(
37
+ keep:
38
+ T.any(
39
+ Anthropic::Beta::BetaThinkingTurns::OrHash,
40
+ Anthropic::Beta::BetaAllThinkingTurns::OrHash,
41
+ Symbol
42
+ )
43
+ ).void
44
+ end
45
+ attr_writer :keep
46
+
47
+ sig do
48
+ params(
49
+ keep:
50
+ T.any(
51
+ Anthropic::Beta::BetaThinkingTurns::OrHash,
52
+ Anthropic::Beta::BetaAllThinkingTurns::OrHash,
53
+ Symbol
54
+ ),
55
+ type: Symbol
56
+ ).returns(T.attached_class)
57
+ end
58
+ def self.new(
59
+ # Number of most recent assistant turns to keep thinking blocks for. Older turns
60
+ # will have their thinking blocks removed.
61
+ keep: nil,
62
+ type: :clear_thinking_20251015
63
+ )
64
+ end
65
+
66
+ sig do
67
+ override.returns(
68
+ {
69
+ type: Symbol,
70
+ keep:
71
+ T.any(
72
+ Anthropic::Beta::BetaThinkingTurns,
73
+ Anthropic::Beta::BetaAllThinkingTurns,
74
+ Symbol
75
+ )
76
+ }
77
+ )
78
+ end
79
+ def to_hash
80
+ end
81
+
82
+ # Number of most recent assistant turns to keep thinking blocks for. Older turns
83
+ # will have their thinking blocks removed.
84
+ module Keep
85
+ extend Anthropic::Internal::Type::Union
86
+
87
+ Variants =
88
+ T.type_alias do
89
+ T.any(
90
+ Anthropic::Beta::BetaThinkingTurns,
91
+ Anthropic::Beta::BetaAllThinkingTurns,
92
+ Symbol
93
+ )
94
+ end
95
+
96
+ sig do
97
+ override.returns(
98
+ T::Array[
99
+ Anthropic::Beta::BetaClearThinking20251015Edit::Keep::Variants
100
+ ]
101
+ )
102
+ end
103
+ def self.variants
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end