@anthropic-ai/sdk 0.37.0 → 0.39.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 (47) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/index.d.mts +2 -2
  3. package/index.d.ts +2 -2
  4. package/index.d.ts.map +1 -1
  5. package/index.js.map +1 -1
  6. package/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/resources/beta/beta.d.ts +2 -2
  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/index.d.ts +1 -1
  17. package/resources/beta/messages/index.d.ts.map +1 -1
  18. package/resources/beta/messages/index.js.map +1 -1
  19. package/resources/beta/messages/index.mjs.map +1 -1
  20. package/resources/beta/messages/messages.d.ts +28 -16
  21. package/resources/beta/messages/messages.d.ts.map +1 -1
  22. package/resources/beta/messages/messages.js.map +1 -1
  23. package/resources/beta/messages/messages.mjs.map +1 -1
  24. package/resources/index.d.ts +1 -1
  25. package/resources/index.d.ts.map +1 -1
  26. package/resources/index.js.map +1 -1
  27. package/resources/index.mjs.map +1 -1
  28. package/resources/messages/index.d.ts +1 -1
  29. package/resources/messages/index.d.ts.map +1 -1
  30. package/resources/messages/index.js.map +1 -1
  31. package/resources/messages/index.mjs.map +1 -1
  32. package/resources/messages/messages.d.ts +28 -16
  33. package/resources/messages/messages.d.ts.map +1 -1
  34. package/resources/messages/messages.js.map +1 -1
  35. package/resources/messages/messages.mjs.map +1 -1
  36. package/src/index.ts +8 -0
  37. package/src/resources/beta/beta.ts +8 -0
  38. package/src/resources/beta/index.ts +4 -0
  39. package/src/resources/beta/messages/index.ts +4 -0
  40. package/src/resources/beta/messages/messages.ts +40 -19
  41. package/src/resources/index.ts +4 -0
  42. package/src/resources/messages/index.ts +4 -0
  43. package/src/resources/messages/messages.ts +39 -18
  44. package/src/version.ts +1 -1
  45. package/version.d.ts +1 -1
  46. package/version.js +1 -1
  47. package/version.mjs +1 -1
@@ -91,6 +91,14 @@ export class Messages extends APIResource {
91
91
  }
92
92
  }
93
93
 
94
+ export interface Base64ImageSource {
95
+ data: string;
96
+
97
+ media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
98
+
99
+ type: 'base64';
100
+ }
101
+
94
102
  export interface Base64PDFSource {
95
103
  data: string;
96
104
 
@@ -223,7 +231,7 @@ export type ContentBlockStartEvent = RawContentBlockStartEvent;
223
231
  export type ContentBlockStopEvent = RawContentBlockStopEvent;
224
232
 
225
233
  export interface DocumentBlockParam {
226
- source: Base64PDFSource | PlainTextSource | ContentBlockSource;
234
+ source: Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource;
227
235
 
228
236
  type: 'document';
229
237
 
@@ -237,23 +245,13 @@ export interface DocumentBlockParam {
237
245
  }
238
246
 
239
247
  export interface ImageBlockParam {
240
- source: ImageBlockParam.Source;
248
+ source: Base64ImageSource | URLImageSource;
241
249
 
242
250
  type: 'image';
243
251
 
244
252
  cache_control?: CacheControlEphemeral | null;
245
253
  }
246
254
 
247
- export namespace ImageBlockParam {
248
- export interface Source {
249
- data: string;
250
-
251
- media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
252
-
253
- type: 'base64';
254
- }
255
- }
256
-
257
255
  export type InputJsonDelta = InputJSONDelta;
258
256
 
259
257
  export interface InputJSONDelta {
@@ -370,7 +368,7 @@ export interface Message {
370
368
  usage: Usage;
371
369
  }
372
370
 
373
- export type MessageCountTokensTool = ToolBash20250124 | ToolTextEditor20250124 | Tool;
371
+ export type MessageCountTokensTool = Tool | ToolBash20250124 | ToolTextEditor20250124;
374
372
 
375
373
  export type MessageDeltaEvent = RawMessageDeltaEvent;
376
374
 
@@ -698,9 +696,9 @@ export interface ToolBash20250124 {
698
696
 
699
697
  /**
700
698
  * How the model should use the provided tools. The model can use a specific tool,
701
- * any available tool, or decide by itself.
699
+ * any available tool, decide by itself, or not use tools at all.
702
700
  */
703
- export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool;
701
+ export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone;
704
702
 
705
703
  /**
706
704
  * The model will use any available tools.
@@ -732,6 +730,13 @@ export interface ToolChoiceAuto {
732
730
  disable_parallel_tool_use?: boolean;
733
731
  }
734
732
 
733
+ /**
734
+ * The model will not be allowed to use tools.
735
+ */
736
+ export interface ToolChoiceNone {
737
+ type: 'none';
738
+ }
739
+
735
740
  /**
736
741
  * The model will use the specified tool with `tool_choice.name`.
737
742
  */
@@ -777,7 +782,7 @@ export interface ToolTextEditor20250124 {
777
782
  cache_control?: CacheControlEphemeral | null;
778
783
  }
779
784
 
780
- export type ToolUnion = ToolBash20250124 | ToolTextEditor20250124 | Tool;
785
+ export type ToolUnion = Tool | ToolBash20250124 | ToolTextEditor20250124;
781
786
 
782
787
  export interface ToolUseBlock {
783
788
  id: string;
@@ -801,6 +806,18 @@ export interface ToolUseBlockParam {
801
806
  cache_control?: CacheControlEphemeral | null;
802
807
  }
803
808
 
809
+ export interface URLImageSource {
810
+ type: 'url';
811
+
812
+ url: string;
813
+ }
814
+
815
+ export interface URLPDFSource {
816
+ type: 'url';
817
+
818
+ url: string;
819
+ }
820
+
804
821
  export interface Usage {
805
822
  /**
806
823
  * The number of input tokens used to create the cache entry.
@@ -996,7 +1013,7 @@ export interface MessageCreateParamsBase {
996
1013
 
997
1014
  /**
998
1015
  * How the model should use the provided tools. The model can use a specific tool,
999
- * any available tool, or decide by itself.
1016
+ * any available tool, decide by itself, or not use tools at all.
1000
1017
  */
1001
1018
  tool_choice?: ToolChoice;
1002
1019
 
@@ -1267,7 +1284,7 @@ export interface MessageCountTokensParams {
1267
1284
 
1268
1285
  /**
1269
1286
  * How the model should use the provided tools. The model can use a specific tool,
1270
- * any available tool, or decide by itself.
1287
+ * any available tool, decide by itself, or not use tools at all.
1271
1288
  */
1272
1289
  tool_choice?: ToolChoice;
1273
1290
 
@@ -1350,6 +1367,7 @@ Messages.MessageBatchesPage = MessageBatchesPage;
1350
1367
 
1351
1368
  export declare namespace Messages {
1352
1369
  export {
1370
+ type Base64ImageSource as Base64ImageSource,
1353
1371
  type Base64PDFSource as Base64PDFSource,
1354
1372
  type CacheControlEphemeral as CacheControlEphemeral,
1355
1373
  type CitationCharLocation as CitationCharLocation,
@@ -1409,12 +1427,15 @@ export declare namespace Messages {
1409
1427
  type ToolChoice as ToolChoice,
1410
1428
  type ToolChoiceAny as ToolChoiceAny,
1411
1429
  type ToolChoiceAuto as ToolChoiceAuto,
1430
+ type ToolChoiceNone as ToolChoiceNone,
1412
1431
  type ToolChoiceTool as ToolChoiceTool,
1413
1432
  type ToolResultBlockParam as ToolResultBlockParam,
1414
1433
  type ToolTextEditor20250124 as ToolTextEditor20250124,
1415
1434
  type ToolUnion as ToolUnion,
1416
1435
  type ToolUseBlock as ToolUseBlock,
1417
1436
  type ToolUseBlockParam as ToolUseBlockParam,
1437
+ type URLImageSource as URLImageSource,
1438
+ type URLPDFSource as URLPDFSource,
1418
1439
  type Usage as Usage,
1419
1440
  type MessageCreateParams as MessageCreateParams,
1420
1441
  type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.37.0'; // x-release-please-version
1
+ export const VERSION = '0.39.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.37.0";
1
+ export declare const VERSION = "0.39.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.37.0'; // x-release-please-version
4
+ exports.VERSION = '0.39.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.37.0'; // x-release-please-version
1
+ export const VERSION = '0.39.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map