@anthropic-ai/sdk 0.58.0 → 0.60.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 (52) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +34 -0
  3. package/client.d.mts +2 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +2 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +4 -1
  10. package/resources/beta/beta.d.mts +1 -1
  11. package/resources/beta/beta.d.mts.map +1 -1
  12. package/resources/beta/beta.d.ts +1 -1
  13. package/resources/beta/beta.d.ts.map +1 -1
  14. package/resources/beta/beta.js.map +1 -1
  15. package/resources/beta/beta.mjs.map +1 -1
  16. package/resources/beta/messages/messages.d.mts.map +1 -1
  17. package/resources/beta/messages/messages.d.ts.map +1 -1
  18. package/resources/beta/messages/messages.js +2 -0
  19. package/resources/beta/messages/messages.js.map +1 -1
  20. package/resources/beta/messages/messages.mjs +2 -0
  21. package/resources/beta/messages/messages.mjs.map +1 -1
  22. package/resources/index.d.mts +1 -1
  23. package/resources/index.d.mts.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.mts +1 -1
  29. package/resources/messages/index.d.mts.map +1 -1
  30. package/resources/messages/index.d.ts +1 -1
  31. package/resources/messages/index.d.ts.map +1 -1
  32. package/resources/messages/index.js.map +1 -1
  33. package/resources/messages/index.mjs.map +1 -1
  34. package/resources/messages/messages.d.mts +60 -6
  35. package/resources/messages/messages.d.mts.map +1 -1
  36. package/resources/messages/messages.d.ts +60 -6
  37. package/resources/messages/messages.d.ts.map +1 -1
  38. package/resources/messages/messages.js +2 -0
  39. package/resources/messages/messages.js.map +1 -1
  40. package/resources/messages/messages.mjs +2 -0
  41. package/resources/messages/messages.mjs.map +1 -1
  42. package/src/client.ts +8 -0
  43. package/src/resources/beta/beta.ts +2 -1
  44. package/src/resources/beta/messages/messages.ts +2 -0
  45. package/src/resources/index.ts +4 -0
  46. package/src/resources/messages/index.ts +4 -0
  47. package/src/resources/messages/messages.ts +92 -4
  48. package/src/version.ts +1 -1
  49. package/version.d.mts +1 -1
  50. package/version.d.ts +1 -1
  51. package/version.js +1 -1
  52. package/version.mjs +1 -1
@@ -127,6 +127,30 @@ export interface Base64PDFSource {
127
127
 
128
128
  export interface CacheControlEphemeral {
129
129
  type: 'ephemeral';
130
+
131
+ /**
132
+ * The time-to-live for the cache control breakpoint.
133
+ *
134
+ * This may be one the following values:
135
+ *
136
+ * - `5m`: 5 minutes
137
+ * - `1h`: 1 hour
138
+ *
139
+ * Defaults to `5m`.
140
+ */
141
+ ttl?: '5m' | '1h';
142
+ }
143
+
144
+ export interface CacheCreation {
145
+ /**
146
+ * The number of input tokens used to create the 1 hour cache entry.
147
+ */
148
+ ephemeral_1h_input_tokens: number;
149
+
150
+ /**
151
+ * The number of input tokens used to create the 5 minute cache entry.
152
+ */
153
+ ephemeral_5m_input_tokens: number;
130
154
  }
131
155
 
132
156
  export interface CitationCharLocation {
@@ -219,6 +243,22 @@ export interface CitationPageLocationParam {
219
243
  type: 'page_location';
220
244
  }
221
245
 
246
+ export interface CitationSearchResultLocationParam {
247
+ cited_text: string;
248
+
249
+ end_block_index: number;
250
+
251
+ search_result_index: number;
252
+
253
+ source: string;
254
+
255
+ start_block_index: number;
256
+
257
+ title: string | null;
258
+
259
+ type: 'search_result_location';
260
+ }
261
+
222
262
  export interface CitationWebSearchResultLocationParam {
223
263
  cited_text: string;
224
264
 
@@ -240,11 +280,28 @@ export interface CitationsDelta {
240
280
  | CitationCharLocation
241
281
  | CitationPageLocation
242
282
  | CitationContentBlockLocation
243
- | CitationsWebSearchResultLocation;
283
+ | CitationsWebSearchResultLocation
284
+ | CitationsSearchResultLocation;
244
285
 
245
286
  type: 'citations_delta';
246
287
  }
247
288
 
289
+ export interface CitationsSearchResultLocation {
290
+ cited_text: string;
291
+
292
+ end_block_index: number;
293
+
294
+ search_result_index: number;
295
+
296
+ source: string;
297
+
298
+ start_block_index: number;
299
+
300
+ title: string | null;
301
+
302
+ type: 'search_result_location';
303
+ }
304
+
248
305
  export interface CitationsWebSearchResultLocation {
249
306
  cited_text: string;
250
307
 
@@ -272,6 +329,7 @@ export type ContentBlockParam =
272
329
  | TextBlockParam
273
330
  | ImageBlockParam
274
331
  | DocumentBlockParam
332
+ | SearchResultBlockParam
275
333
  | ThinkingBlockParam
276
334
  | RedactedThinkingBlockParam
277
335
  | ToolUseBlockParam
@@ -530,6 +588,8 @@ const DEPRECATED_MODELS: {
530
588
  'claude-3-opus-20240229': 'January 5th, 2026',
531
589
  'claude-2.1': 'July 21st, 2025',
532
590
  'claude-2.0': 'July 21st, 2025',
591
+ 'claude-3-5-sonnet-20241022': 'October 22, 2025',
592
+ 'claude-3-5-sonnet-20240620': 'October 22, 2025',
533
593
  };
534
594
 
535
595
  export interface PlainTextSource {
@@ -638,6 +698,23 @@ export interface RedactedThinkingBlockParam {
638
698
  type: 'redacted_thinking';
639
699
  }
640
700
 
701
+ export interface SearchResultBlockParam {
702
+ content: Array<TextBlockParam>;
703
+
704
+ source: string;
705
+
706
+ title: string;
707
+
708
+ type: 'search_result';
709
+
710
+ /**
711
+ * Create a cache control breakpoint at this content block.
712
+ */
713
+ cache_control?: CacheControlEphemeral | null;
714
+
715
+ citations?: CitationsConfigParam;
716
+ }
717
+
641
718
  export interface ServerToolUsage {
642
719
  /**
643
720
  * The number of web search tool requests.
@@ -710,13 +787,15 @@ export type TextCitation =
710
787
  | CitationCharLocation
711
788
  | CitationPageLocation
712
789
  | CitationContentBlockLocation
713
- | CitationsWebSearchResultLocation;
790
+ | CitationsWebSearchResultLocation
791
+ | CitationsSearchResultLocation;
714
792
 
715
793
  export type TextCitationParam =
716
794
  | CitationCharLocationParam
717
795
  | CitationPageLocationParam
718
796
  | CitationContentBlockLocationParam
719
- | CitationWebSearchResultLocationParam;
797
+ | CitationWebSearchResultLocationParam
798
+ | CitationSearchResultLocationParam;
720
799
 
721
800
  export interface TextDelta {
722
801
  text: string;
@@ -921,7 +1000,7 @@ export interface ToolResultBlockParam {
921
1000
  */
922
1001
  cache_control?: CacheControlEphemeral | null;
923
1002
 
924
- content?: string | Array<TextBlockParam | ImageBlockParam>;
1003
+ content?: string | Array<TextBlockParam | ImageBlockParam | SearchResultBlockParam>;
925
1004
 
926
1005
  is_error?: boolean;
927
1006
  }
@@ -1026,6 +1105,11 @@ export interface URLPDFSource {
1026
1105
  }
1027
1106
 
1028
1107
  export interface Usage {
1108
+ /**
1109
+ * Breakdown of cached tokens by TTL
1110
+ */
1111
+ cache_creation: CacheCreation | null;
1112
+
1029
1113
  /**
1030
1114
  * The number of input tokens used to create the cache entry.
1031
1115
  */
@@ -1749,15 +1833,18 @@ export declare namespace Messages {
1749
1833
  type Base64ImageSource as Base64ImageSource,
1750
1834
  type Base64PDFSource as Base64PDFSource,
1751
1835
  type CacheControlEphemeral as CacheControlEphemeral,
1836
+ type CacheCreation as CacheCreation,
1752
1837
  type CitationCharLocation as CitationCharLocation,
1753
1838
  type CitationCharLocationParam as CitationCharLocationParam,
1754
1839
  type CitationContentBlockLocation as CitationContentBlockLocation,
1755
1840
  type CitationContentBlockLocationParam as CitationContentBlockLocationParam,
1756
1841
  type CitationPageLocation as CitationPageLocation,
1757
1842
  type CitationPageLocationParam as CitationPageLocationParam,
1843
+ type CitationSearchResultLocationParam as CitationSearchResultLocationParam,
1758
1844
  type CitationWebSearchResultLocationParam as CitationWebSearchResultLocationParam,
1759
1845
  type CitationsConfigParam as CitationsConfigParam,
1760
1846
  type CitationsDelta as CitationsDelta,
1847
+ type CitationsSearchResultLocation as CitationsSearchResultLocation,
1761
1848
  type CitationsWebSearchResultLocation as CitationsWebSearchResultLocation,
1762
1849
  type ContentBlock as ContentBlock,
1763
1850
  type ContentBlockParam as ContentBlockParam,
@@ -1787,6 +1874,7 @@ export declare namespace Messages {
1787
1874
  type RawMessageStreamEvent as RawMessageStreamEvent,
1788
1875
  type RedactedThinkingBlock as RedactedThinkingBlock,
1789
1876
  type RedactedThinkingBlockParam as RedactedThinkingBlockParam,
1877
+ type SearchResultBlockParam as SearchResultBlockParam,
1790
1878
  type ServerToolUsage as ServerToolUsage,
1791
1879
  type ServerToolUseBlock as ServerToolUseBlock,
1792
1880
  type ServerToolUseBlockParam as ServerToolUseBlockParam,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.58.0'; // x-release-please-version
1
+ export const VERSION = '0.60.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.58.0";
1
+ export declare const VERSION = "0.60.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.58.0";
1
+ export declare const VERSION = "0.60.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.58.0'; // x-release-please-version
4
+ exports.VERSION = '0.60.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.58.0'; // x-release-please-version
1
+ export const VERSION = '0.60.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map