@anthropic-ai/sdk 0.29.2 → 0.30.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 (49) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/core.d.ts.map +1 -1
  3. package/core.js +5 -3
  4. package/core.js.map +1 -1
  5. package/core.mjs +5 -3
  6. package/core.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/resources/beta/beta.d.ts +5 -1
  9. package/resources/beta/beta.d.ts.map +1 -1
  10. package/resources/beta/beta.js.map +1 -1
  11. package/resources/beta/beta.mjs.map +1 -1
  12. package/resources/beta/index.d.ts +1 -1
  13. package/resources/beta/index.d.ts.map +1 -1
  14. package/resources/beta/index.js.map +1 -1
  15. package/resources/beta/index.mjs.map +1 -1
  16. package/resources/beta/messages/batches.d.ts +27 -14
  17. package/resources/beta/messages/batches.d.ts.map +1 -1
  18. package/resources/beta/messages/batches.js +4 -3
  19. package/resources/beta/messages/batches.js.map +1 -1
  20. package/resources/beta/messages/batches.mjs +4 -3
  21. package/resources/beta/messages/batches.mjs.map +1 -1
  22. package/resources/beta/messages/index.d.ts +1 -1
  23. package/resources/beta/messages/index.d.ts.map +1 -1
  24. package/resources/beta/messages/index.js.map +1 -1
  25. package/resources/beta/messages/index.mjs.map +1 -1
  26. package/resources/beta/messages/messages.d.ts +28 -3
  27. package/resources/beta/messages/messages.d.ts.map +1 -1
  28. package/resources/beta/messages/messages.js.map +1 -1
  29. package/resources/beta/messages/messages.mjs.map +1 -1
  30. package/resources/beta/prompt-caching/messages.d.ts +3 -2
  31. package/resources/beta/prompt-caching/messages.d.ts.map +1 -1
  32. package/resources/beta/prompt-caching/messages.js.map +1 -1
  33. package/resources/beta/prompt-caching/messages.mjs.map +1 -1
  34. package/resources/messages.d.ts +4 -3
  35. package/resources/messages.d.ts.map +1 -1
  36. package/resources/messages.js.map +1 -1
  37. package/resources/messages.mjs.map +1 -1
  38. package/src/core.ts +7 -3
  39. package/src/resources/beta/beta.ts +9 -1
  40. package/src/resources/beta/index.ts +4 -0
  41. package/src/resources/beta/messages/batches.ts +28 -14
  42. package/src/resources/beta/messages/index.ts +4 -0
  43. package/src/resources/beta/messages/messages.ts +46 -3
  44. package/src/resources/beta/prompt-caching/messages.ts +3 -2
  45. package/src/resources/messages.ts +6 -2
  46. package/src/version.ts +1 -1
  47. package/version.d.ts +1 -1
  48. package/version.js +1 -1
  49. package/version.mjs +1 -1
@@ -323,6 +323,8 @@ export interface BetaTool {
323
323
  * aspects of the tool input JSON schema.
324
324
  */
325
325
  description?: string;
326
+
327
+ type?: 'custom' | null;
326
328
  }
327
329
 
328
330
  export namespace BetaTool {
@@ -340,6 +342,14 @@ export namespace BetaTool {
340
342
  }
341
343
  }
342
344
 
345
+ export interface BetaToolBash20241022 {
346
+ name: 'bash';
347
+
348
+ type: 'bash_20241022';
349
+
350
+ cache_control?: BetaCacheControlEphemeral | null;
351
+ }
352
+
343
353
  /**
344
354
  * How the model should use the provided tools. The model can use a specific tool,
345
355
  * any available tool, or decide by itself.
@@ -396,6 +406,20 @@ export interface BetaToolChoiceTool {
396
406
  disable_parallel_tool_use?: boolean;
397
407
  }
398
408
 
409
+ export interface BetaToolComputerUse20241022 {
410
+ display_height_px: number;
411
+
412
+ display_width_px: number;
413
+
414
+ name: 'computer';
415
+
416
+ type: 'computer_20241022';
417
+
418
+ cache_control?: BetaCacheControlEphemeral | null;
419
+
420
+ display_number?: number | null;
421
+ }
422
+
399
423
  export interface BetaToolResultBlockParam {
400
424
  tool_use_id: string;
401
425
 
@@ -408,6 +432,20 @@ export interface BetaToolResultBlockParam {
408
432
  is_error?: boolean;
409
433
  }
410
434
 
435
+ export interface BetaToolTextEditor20241022 {
436
+ name: 'str_replace_editor';
437
+
438
+ type: 'text_editor_20241022';
439
+
440
+ cache_control?: BetaCacheControlEphemeral | null;
441
+ }
442
+
443
+ export type BetaToolUnion =
444
+ | BetaTool
445
+ | BetaToolComputerUse20241022
446
+ | BetaToolBash20241022
447
+ | BetaToolTextEditor20241022;
448
+
411
449
  export interface BetaToolUseBlock {
412
450
  id: string;
413
451
 
@@ -472,11 +510,12 @@ export interface MessageCreateParamsBase {
472
510
  * Our models are trained to operate on alternating `user` and `assistant`
473
511
  * conversational turns. When creating a new `Message`, you specify the prior
474
512
  * conversational turns with the `messages` parameter, and the model then generates
475
- * the next `Message` in the conversation.
513
+ * the next `Message` in the conversation. Consecutive `user` or `assistant` turns
514
+ * in your request will be combined into a single turn.
476
515
  *
477
516
  * Each input message must be an object with a `role` and `content`. You can
478
517
  * specify a single `user`-role message, or you can include multiple `user` and
479
- * `assistant` messages. The first message must always use the `user` role.
518
+ * `assistant` messages.
480
519
  *
481
520
  * If the final message uses the `assistant` role, the response content will
482
521
  * continue immediately from the content in that message. This can be used to
@@ -686,7 +725,7 @@ export interface MessageCreateParamsBase {
686
725
  *
687
726
  * See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
688
727
  */
689
- tools?: Array<BetaTool>;
728
+ tools?: Array<BetaToolUnion>;
690
729
 
691
730
  /**
692
731
  * Body param: Only sample from the top K options for each subsequent token.
@@ -766,11 +805,15 @@ export namespace Messages {
766
805
  export import BetaTextBlockParam = MessagesMessagesAPI.BetaTextBlockParam;
767
806
  export import BetaTextDelta = MessagesMessagesAPI.BetaTextDelta;
768
807
  export import BetaTool = MessagesMessagesAPI.BetaTool;
808
+ export import BetaToolBash20241022 = MessagesMessagesAPI.BetaToolBash20241022;
769
809
  export import BetaToolChoice = MessagesMessagesAPI.BetaToolChoice;
770
810
  export import BetaToolChoiceAny = MessagesMessagesAPI.BetaToolChoiceAny;
771
811
  export import BetaToolChoiceAuto = MessagesMessagesAPI.BetaToolChoiceAuto;
772
812
  export import BetaToolChoiceTool = MessagesMessagesAPI.BetaToolChoiceTool;
813
+ export import BetaToolComputerUse20241022 = MessagesMessagesAPI.BetaToolComputerUse20241022;
773
814
  export import BetaToolResultBlockParam = MessagesMessagesAPI.BetaToolResultBlockParam;
815
+ export import BetaToolTextEditor20241022 = MessagesMessagesAPI.BetaToolTextEditor20241022;
816
+ export import BetaToolUnion = MessagesMessagesAPI.BetaToolUnion;
774
817
  export import BetaToolUseBlock = MessagesMessagesAPI.BetaToolUseBlock;
775
818
  export import BetaToolUseBlockParam = MessagesMessagesAPI.BetaToolUseBlockParam;
776
819
  export import BetaUsage = MessagesMessagesAPI.BetaUsage;
@@ -323,11 +323,12 @@ export interface MessageCreateParamsBase {
323
323
  * Our models are trained to operate on alternating `user` and `assistant`
324
324
  * conversational turns. When creating a new `Message`, you specify the prior
325
325
  * conversational turns with the `messages` parameter, and the model then generates
326
- * the next `Message` in the conversation.
326
+ * the next `Message` in the conversation. Consecutive `user` or `assistant` turns
327
+ * in your request will be combined into a single turn.
327
328
  *
328
329
  * Each input message must be an object with a `role` and `content`. You can
329
330
  * specify a single `user`-role message, or you can include multiple `user` and
330
- * `assistant` messages. The first message must always use the `user` role.
331
+ * `assistant` messages.
331
332
  *
332
333
  * If the final message uses the `assistant` role, the response content will
333
334
  * continue immediately from the content in that message. This can be used to
@@ -229,7 +229,10 @@ export interface Metadata {
229
229
  */
230
230
  export type Model =
231
231
  | (string & {})
232
+ | 'claude-3-5-sonnet-latest'
233
+ | 'claude-3-5-sonnet-20241022'
232
234
  | 'claude-3-5-sonnet-20240620'
235
+ | 'claude-3-opus-latest'
233
236
  | 'claude-3-opus-20240229'
234
237
  | 'claude-3-sonnet-20240229'
235
238
  | 'claude-3-haiku-20240307'
@@ -492,11 +495,12 @@ export interface MessageCreateParamsBase {
492
495
  * Our models are trained to operate on alternating `user` and `assistant`
493
496
  * conversational turns. When creating a new `Message`, you specify the prior
494
497
  * conversational turns with the `messages` parameter, and the model then generates
495
- * the next `Message` in the conversation.
498
+ * the next `Message` in the conversation. Consecutive `user` or `assistant` turns
499
+ * in your request will be combined into a single turn.
496
500
  *
497
501
  * Each input message must be an object with a `role` and `content`. You can
498
502
  * specify a single `user`-role message, or you can include multiple `user` and
499
- * `assistant` messages. The first message must always use the `user` role.
503
+ * `assistant` messages.
500
504
  *
501
505
  * If the final message uses the `assistant` role, the response content will
502
506
  * continue immediately from the content in that message. This can be used to
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.29.2'; // x-release-please-version
1
+ export const VERSION = '0.30.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.29.2";
1
+ export declare const VERSION = "0.30.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.29.2'; // x-release-please-version
4
+ exports.VERSION = '0.30.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.29.2'; // x-release-please-version
1
+ export const VERSION = '0.30.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map