@anthropic-ai/sdk 0.104.2 → 0.106.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.
- package/CHANGELOG.md +35 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/core/streaming.d.mts.map +1 -1
- package/core/streaming.d.ts.map +1 -1
- package/core/streaming.js +2 -1
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +2 -1
- package/core/streaming.mjs.map +1 -1
- package/helpers/beta/mcp.d.mts +1 -1
- package/helpers/beta/mcp.d.mts.map +1 -1
- package/helpers/beta/mcp.d.ts +1 -1
- package/helpers/beta/mcp.d.ts.map +1 -1
- package/helpers/beta/mcp.js +1 -1
- package/helpers/beta/mcp.js.map +1 -1
- package/helpers/beta/mcp.mjs +1 -1
- package/helpers/beta/mcp.mjs.map +1 -1
- package/internal/headers.d.mts +7 -0
- package/internal/headers.d.mts.map +1 -1
- package/internal/headers.d.ts +7 -0
- package/internal/headers.d.ts.map +1 -1
- package/internal/headers.js +45 -4
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs +43 -3
- package/internal/headers.mjs.map +1 -1
- package/internal/message-stream-utils.d.mts +10 -0
- package/internal/message-stream-utils.d.mts.map +1 -0
- package/internal/message-stream-utils.d.ts +10 -0
- package/internal/message-stream-utils.d.ts.map +1 -0
- package/internal/message-stream-utils.js +34 -0
- package/internal/message-stream-utils.js.map +1 -0
- package/internal/message-stream-utils.mjs +30 -0
- package/internal/message-stream-utils.mjs.map +1 -0
- package/internal/stainless-helper-header.d.mts +60 -0
- package/internal/stainless-helper-header.d.mts.map +1 -0
- package/internal/stainless-helper-header.d.ts +60 -0
- package/internal/stainless-helper-header.d.ts.map +1 -0
- package/{lib → internal}/stainless-helper-header.js +27 -6
- package/internal/stainless-helper-header.js.map +1 -0
- package/{lib → internal}/stainless-helper-header.mjs +25 -5
- package/internal/stainless-helper-header.mjs.map +1 -0
- package/lib/BetaMessageStream.d.mts.map +1 -1
- package/lib/BetaMessageStream.d.ts.map +1 -1
- package/lib/BetaMessageStream.js +38 -28
- package/lib/BetaMessageStream.js.map +1 -1
- package/lib/BetaMessageStream.mjs +38 -28
- package/lib/BetaMessageStream.mjs.map +1 -1
- package/lib/MessageStream.d.mts.map +1 -1
- package/lib/MessageStream.d.ts.map +1 -1
- package/lib/MessageStream.js +20 -23
- package/lib/MessageStream.js.map +1 -1
- package/lib/MessageStream.mjs +17 -20
- package/lib/MessageStream.mjs.map +1 -1
- package/lib/helper-client.d.mts +2 -20
- package/lib/helper-client.d.mts.map +1 -1
- package/lib/helper-client.d.ts +2 -20
- package/lib/helper-client.d.ts.map +1 -1
- package/lib/helper-client.js +2 -1
- package/lib/helper-client.js.map +1 -1
- package/lib/helper-client.mjs +2 -1
- package/lib/helper-client.mjs.map +1 -1
- package/lib/middleware.d.mts.map +1 -1
- package/lib/middleware.d.ts.map +1 -1
- package/lib/middleware.js +14 -6
- package/lib/middleware.js.map +1 -1
- package/lib/middleware.mjs +14 -6
- package/lib/middleware.mjs.map +1 -1
- package/lib/tools/BetaToolRunner.d.mts.map +1 -1
- package/lib/tools/BetaToolRunner.d.ts.map +1 -1
- package/lib/tools/BetaToolRunner.js +11 -5
- package/lib/tools/BetaToolRunner.js.map +1 -1
- package/lib/tools/BetaToolRunner.mjs +11 -5
- package/lib/tools/BetaToolRunner.mjs.map +1 -1
- package/lib/tools/SessionToolRunner.d.mts.map +1 -1
- package/lib/tools/SessionToolRunner.d.ts.map +1 -1
- package/lib/tools/SessionToolRunner.js +2 -3
- package/lib/tools/SessionToolRunner.js.map +1 -1
- package/lib/tools/SessionToolRunner.mjs +2 -3
- package/lib/tools/SessionToolRunner.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/agents/agents.d.mts +7 -2
- package/resources/beta/agents/agents.d.mts.map +1 -1
- package/resources/beta/agents/agents.d.ts +7 -2
- package/resources/beta/agents/agents.d.ts.map +1 -1
- package/resources/beta/agents/agents.js.map +1 -1
- package/resources/beta/agents/agents.mjs.map +1 -1
- package/resources/beta/beta.d.mts +4 -4
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +4 -4
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/files.js +1 -1
- package/resources/beta/files.js.map +1 -1
- package/resources/beta/files.mjs +1 -1
- package/resources/beta/files.mjs.map +1 -1
- package/resources/beta/index.d.mts +2 -2
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +2 -2
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/messages/batches.d.mts +8 -5
- package/resources/beta/messages/batches.d.mts.map +1 -1
- package/resources/beta/messages/batches.d.ts +8 -5
- package/resources/beta/messages/batches.d.ts.map +1 -1
- package/resources/beta/messages/batches.js +5 -2
- package/resources/beta/messages/batches.js.map +1 -1
- package/resources/beta/messages/batches.mjs +5 -2
- package/resources/beta/messages/batches.mjs.map +1 -1
- package/resources/beta/messages/index.d.mts +1 -1
- package/resources/beta/messages/index.d.mts.map +1 -1
- package/resources/beta/messages/index.d.ts +1 -1
- package/resources/beta/messages/index.d.ts.map +1 -1
- package/resources/beta/messages/index.js.map +1 -1
- package/resources/beta/messages/index.mjs.map +1 -1
- package/resources/beta/messages/messages.d.mts +94 -51
- package/resources/beta/messages/messages.d.mts.map +1 -1
- package/resources/beta/messages/messages.d.ts +94 -51
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js +6 -3
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs +6 -3
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/webhooks.d.mts +11 -2
- package/resources/beta/webhooks.d.mts.map +1 -1
- package/resources/beta/webhooks.d.ts +11 -2
- package/resources/beta/webhooks.d.ts.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages/batches.d.mts +11 -3
- package/resources/messages/batches.d.mts.map +1 -1
- package/resources/messages/batches.d.ts +11 -3
- package/resources/messages/batches.d.ts.map +1 -1
- package/resources/messages/batches.js +10 -2
- package/resources/messages/batches.js.map +1 -1
- package/resources/messages/batches.mjs +10 -2
- package/resources/messages/batches.mjs.map +1 -1
- package/resources/messages/index.d.mts +1 -1
- package/resources/messages/index.d.mts.map +1 -1
- package/resources/messages/index.d.ts +1 -1
- package/resources/messages/index.d.ts.map +1 -1
- package/resources/messages/index.js.map +1 -1
- package/resources/messages/index.mjs.map +1 -1
- package/resources/messages/messages.d.mts +84 -48
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +84 -48
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +9 -4
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +9 -4
- package/resources/messages/messages.mjs.map +1 -1
- package/src/client.ts +2 -0
- package/src/core/streaming.ts +2 -1
- package/src/helpers/beta/mcp.ts +1 -1
- package/src/internal/headers.ts +47 -4
- package/src/internal/message-stream-utils.ts +30 -0
- package/src/internal/stainless-helper-header.ts +122 -0
- package/src/lib/BetaMessageStream.ts +39 -31
- package/src/lib/MessageStream.ts +17 -23
- package/src/lib/helper-client.ts +6 -9
- package/src/lib/middleware.ts +17 -5
- package/src/lib/tools/BetaToolRunner.ts +15 -6
- package/src/lib/tools/SessionToolRunner.ts +2 -4
- package/src/resources/beta/agents/agents.ts +7 -2
- package/src/resources/beta/beta.ts +6 -0
- package/src/resources/beta/files.ts +1 -1
- package/src/resources/beta/index.ts +3 -0
- package/src/resources/beta/messages/batches.ts +14 -8
- package/src/resources/beta/messages/index.ts +2 -0
- package/src/resources/beta/messages/messages.ts +157 -51
- package/src/resources/beta/webhooks.ts +16 -1
- package/src/resources/index.ts +1 -0
- package/src/resources/messages/batches.ts +21 -4
- package/src/resources/messages/index.ts +1 -0
- package/src/resources/messages/messages.ts +134 -50
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/lib/stainless-helper-header.d.mts +0 -34
- package/lib/stainless-helper-header.d.mts.map +0 -1
- package/lib/stainless-helper-header.d.ts +0 -34
- package/lib/stainless-helper-header.d.ts.map +0 -1
- package/lib/stainless-helper-header.js.map +0 -1
- package/lib/stainless-helper-header.mjs.map +0 -1
- package/src/lib/stainless-helper-header.ts +0 -80
|
@@ -9,7 +9,7 @@ import { Stream } from '../../../core/streaming';
|
|
|
9
9
|
import { MODEL_NONSTREAMING_TOKENS } from '../../../internal/constants';
|
|
10
10
|
import { buildHeaders } from '../../../internal/headers';
|
|
11
11
|
import { RequestOptions } from '../../../internal/request-options';
|
|
12
|
-
import { stainlessHelperHeader } from '../../../
|
|
12
|
+
import { stainlessHelperHeader } from '../../../internal/stainless-helper-header';
|
|
13
13
|
import {
|
|
14
14
|
parseBetaMessage,
|
|
15
15
|
type ExtractParsedContentFromBetaParams,
|
|
@@ -111,7 +111,7 @@ export class Messages extends APIResource {
|
|
|
111
111
|
// Transform deprecated output_format to output_config.format
|
|
112
112
|
const modifiedParams = transformOutputFormat(params);
|
|
113
113
|
|
|
114
|
-
const { betas, ...body } = modifiedParams;
|
|
114
|
+
const { betas, user_profile_id, ...body } = modifiedParams;
|
|
115
115
|
|
|
116
116
|
if (body.model in DEPRECATED_MODELS) {
|
|
117
117
|
console.warn(
|
|
@@ -145,7 +145,10 @@ export class Messages extends APIResource {
|
|
|
145
145
|
timeout: timeout ?? 600000,
|
|
146
146
|
...options,
|
|
147
147
|
headers: buildHeaders([
|
|
148
|
-
{
|
|
148
|
+
{
|
|
149
|
+
...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined),
|
|
150
|
+
...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined),
|
|
151
|
+
},
|
|
149
152
|
helperHeader,
|
|
150
153
|
options?.headers,
|
|
151
154
|
]),
|
|
@@ -382,7 +385,9 @@ export interface BetaAdvisorTool20260301 {
|
|
|
382
385
|
|
|
383
386
|
type: 'advisor_20260301';
|
|
384
387
|
|
|
385
|
-
allowed_callers?: Array<
|
|
388
|
+
allowed_callers?: Array<
|
|
389
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
390
|
+
>;
|
|
386
391
|
|
|
387
392
|
/**
|
|
388
393
|
* Create a cache control breakpoint at this content block.
|
|
@@ -586,7 +591,9 @@ export interface BetaCacheControlEphemeral {
|
|
|
586
591
|
* - `5m`: 5 minutes
|
|
587
592
|
* - `1h`: 1 hour
|
|
588
593
|
*
|
|
589
|
-
* Defaults to `5m`.
|
|
594
|
+
* Defaults to `5m`. See
|
|
595
|
+
* [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
|
|
596
|
+
* for details.
|
|
590
597
|
*/
|
|
591
598
|
ttl?: '5m' | '1h';
|
|
592
599
|
}
|
|
@@ -1024,7 +1031,9 @@ export interface BetaCodeExecutionTool20250522 {
|
|
|
1024
1031
|
|
|
1025
1032
|
type: 'code_execution_20250522';
|
|
1026
1033
|
|
|
1027
|
-
allowed_callers?: Array<
|
|
1034
|
+
allowed_callers?: Array<
|
|
1035
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
1036
|
+
>;
|
|
1028
1037
|
|
|
1029
1038
|
/**
|
|
1030
1039
|
* Create a cache control breakpoint at this content block.
|
|
@@ -1053,7 +1062,9 @@ export interface BetaCodeExecutionTool20250825 {
|
|
|
1053
1062
|
|
|
1054
1063
|
type: 'code_execution_20250825';
|
|
1055
1064
|
|
|
1056
|
-
allowed_callers?: Array<
|
|
1065
|
+
allowed_callers?: Array<
|
|
1066
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
1067
|
+
>;
|
|
1057
1068
|
|
|
1058
1069
|
/**
|
|
1059
1070
|
* Create a cache control breakpoint at this content block.
|
|
@@ -1086,7 +1097,43 @@ export interface BetaCodeExecutionTool20260120 {
|
|
|
1086
1097
|
|
|
1087
1098
|
type: 'code_execution_20260120';
|
|
1088
1099
|
|
|
1089
|
-
allowed_callers?: Array<
|
|
1100
|
+
allowed_callers?: Array<
|
|
1101
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
1102
|
+
>;
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* Create a cache control breakpoint at this content block.
|
|
1106
|
+
*/
|
|
1107
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* If true, tool will not be included in initial system prompt. Only loaded when
|
|
1111
|
+
* returned via tool_reference from tool search.
|
|
1112
|
+
*/
|
|
1113
|
+
defer_loading?: boolean;
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* When true, guarantees schema validation on tool names and inputs
|
|
1117
|
+
*/
|
|
1118
|
+
strict?: boolean;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Code execution tool with REPL state persistence.
|
|
1123
|
+
*/
|
|
1124
|
+
export interface BetaCodeExecutionTool20260521 {
|
|
1125
|
+
/**
|
|
1126
|
+
* Name of the tool.
|
|
1127
|
+
*
|
|
1128
|
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
|
1129
|
+
*/
|
|
1130
|
+
name: 'code_execution';
|
|
1131
|
+
|
|
1132
|
+
type: 'code_execution_20260521';
|
|
1133
|
+
|
|
1134
|
+
allowed_callers?: Array<
|
|
1135
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
1136
|
+
>;
|
|
1090
1137
|
|
|
1091
1138
|
/**
|
|
1092
1139
|
* Create a cache control breakpoint at this content block.
|
|
@@ -1515,10 +1562,10 @@ export interface BetaEncryptedCodeExecutionResultBlockParam {
|
|
|
1515
1562
|
* Marks the point in `content` where one model's output gives way to the next.
|
|
1516
1563
|
*
|
|
1517
1564
|
* One block appears per hop where a preceding model actually ran this turn and
|
|
1518
|
-
* declined. A turn
|
|
1519
|
-
* carries no block — the signal for whether a fallback model served the
|
|
1520
|
-
* is the presence of a `fallback_message` entry in `usage.iterations`,
|
|
1521
|
-
* block.
|
|
1565
|
+
* declined. A turn where no preceding model ran and declined has no such boundary
|
|
1566
|
+
* and carries no block — the signal for whether a fallback model served the
|
|
1567
|
+
* response is the presence of a `fallback_message` entry in `usage.iterations`,
|
|
1568
|
+
* not this block.
|
|
1522
1569
|
*
|
|
1523
1570
|
* The block is treated like a server-tool content block for streaming: it arrives
|
|
1524
1571
|
* via the standard `content_block_start` / `content_block_stop` pair and carries
|
|
@@ -1539,25 +1586,27 @@ export interface BetaFallbackBlock {
|
|
|
1539
1586
|
*/
|
|
1540
1587
|
to: BetaFallbackInfo;
|
|
1541
1588
|
|
|
1589
|
+
/**
|
|
1590
|
+
* What caused the `from` model to hand over at this hop.
|
|
1591
|
+
*/
|
|
1592
|
+
trigger: BetaFallbackRefusalTrigger;
|
|
1593
|
+
|
|
1542
1594
|
type: 'fallback';
|
|
1543
1595
|
}
|
|
1544
1596
|
|
|
1545
1597
|
/**
|
|
1546
1598
|
* A `fallback` block echoed back from a prior response.
|
|
1547
1599
|
*
|
|
1548
|
-
* Accepted in `messages[].content` and
|
|
1549
|
-
*
|
|
1550
|
-
* stripped before the sticky-routing cache key is computed.
|
|
1600
|
+
* Accepted in `messages[].content` and not rendered into the prompt; not validated
|
|
1601
|
+
* against the request's `fallbacks` chain or top-level `model`.
|
|
1551
1602
|
*
|
|
1552
|
-
*
|
|
1553
|
-
* position
|
|
1554
|
-
*
|
|
1555
|
-
*
|
|
1556
|
-
*
|
|
1557
|
-
*
|
|
1558
|
-
*
|
|
1559
|
-
* rejected; between non-thinking blocks the block's placement has no verification
|
|
1560
|
-
* effect.
|
|
1603
|
+
* Echo the assistant turn back verbatim, including this block in its original
|
|
1604
|
+
* position. The block marks the boundary between content produced before and after
|
|
1605
|
+
* a fallback hop, and the server relies on that boundary to validate the turn:
|
|
1606
|
+
* when thinking runs flank the boundary, omitting the block merges them into one
|
|
1607
|
+
* span the server cannot validate (the request is rejected), and moving it into
|
|
1608
|
+
* the middle of a single run is likewise rejected; between non-thinking blocks the
|
|
1609
|
+
* block's placement has no validation effect.
|
|
1561
1610
|
*/
|
|
1562
1611
|
export interface BetaFallbackBlockParam {
|
|
1563
1612
|
/**
|
|
@@ -1571,6 +1620,12 @@ export interface BetaFallbackBlockParam {
|
|
|
1571
1620
|
to: BetaFallbackInfoParam;
|
|
1572
1621
|
|
|
1573
1622
|
type: 'fallback';
|
|
1623
|
+
|
|
1624
|
+
/**
|
|
1625
|
+
* The response block's `trigger`, echoed verbatim. Accepted and ignored by the
|
|
1626
|
+
* server; any object or `null` is allowed.
|
|
1627
|
+
*/
|
|
1628
|
+
trigger?: unknown;
|
|
1574
1629
|
}
|
|
1575
1630
|
|
|
1576
1631
|
/**
|
|
@@ -1675,6 +1730,18 @@ export interface BetaFallbackParam {
|
|
|
1675
1730
|
[k: string]: unknown;
|
|
1676
1731
|
}
|
|
1677
1732
|
|
|
1733
|
+
/**
|
|
1734
|
+
* The `from` model declined for policy reasons.
|
|
1735
|
+
*/
|
|
1736
|
+
export interface BetaFallbackRefusalTrigger {
|
|
1737
|
+
/**
|
|
1738
|
+
* The policy category that triggered a refusal.
|
|
1739
|
+
*/
|
|
1740
|
+
category: 'cyber' | 'bio' | 'frontier_llm' | 'reasoning_extraction' | 'military_weapons' | null;
|
|
1741
|
+
|
|
1742
|
+
type: 'refusal';
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1678
1745
|
export interface BetaFileDocumentSource {
|
|
1679
1746
|
file_id: string;
|
|
1680
1747
|
|
|
@@ -1848,7 +1915,9 @@ export interface BetaMemoryTool20250818 {
|
|
|
1848
1915
|
|
|
1849
1916
|
type: 'memory_20250818';
|
|
1850
1917
|
|
|
1851
|
-
allowed_callers?: Array<
|
|
1918
|
+
allowed_callers?: Array<
|
|
1919
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
1920
|
+
>;
|
|
1852
1921
|
|
|
1853
1922
|
/**
|
|
1854
1923
|
* Create a cache control breakpoint at this content block.
|
|
@@ -2438,11 +2507,9 @@ export interface BetaRedactedThinkingBlockParam {
|
|
|
2438
2507
|
*/
|
|
2439
2508
|
export interface BetaRefusalStopDetails {
|
|
2440
2509
|
/**
|
|
2441
|
-
* The policy category that triggered
|
|
2442
|
-
*
|
|
2443
|
-
* `null` when the refusal doesn't map to a named category.
|
|
2510
|
+
* The policy category that triggered a refusal.
|
|
2444
2511
|
*/
|
|
2445
|
-
category: 'cyber' | 'bio' | 'frontier_llm' | 'reasoning_extraction' | null;
|
|
2512
|
+
category: 'cyber' | 'bio' | 'frontier_llm' | 'reasoning_extraction' | 'military_weapons' | null;
|
|
2446
2513
|
|
|
2447
2514
|
/**
|
|
2448
2515
|
* Human-readable explanation of the refusal.
|
|
@@ -3019,7 +3086,9 @@ export interface BetaTool {
|
|
|
3019
3086
|
*/
|
|
3020
3087
|
name: string;
|
|
3021
3088
|
|
|
3022
|
-
allowed_callers?: Array<
|
|
3089
|
+
allowed_callers?: Array<
|
|
3090
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3091
|
+
>;
|
|
3023
3092
|
|
|
3024
3093
|
/**
|
|
3025
3094
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3089,7 +3158,9 @@ export interface BetaToolBash20241022 {
|
|
|
3089
3158
|
|
|
3090
3159
|
type: 'bash_20241022';
|
|
3091
3160
|
|
|
3092
|
-
allowed_callers?: Array<
|
|
3161
|
+
allowed_callers?: Array<
|
|
3162
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3163
|
+
>;
|
|
3093
3164
|
|
|
3094
3165
|
/**
|
|
3095
3166
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3120,7 +3191,9 @@ export interface BetaToolBash20250124 {
|
|
|
3120
3191
|
|
|
3121
3192
|
type: 'bash_20250124';
|
|
3122
3193
|
|
|
3123
|
-
allowed_callers?: Array<
|
|
3194
|
+
allowed_callers?: Array<
|
|
3195
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3196
|
+
>;
|
|
3124
3197
|
|
|
3125
3198
|
/**
|
|
3126
3199
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3224,7 +3297,9 @@ export interface BetaToolComputerUse20241022 {
|
|
|
3224
3297
|
|
|
3225
3298
|
type: 'computer_20241022';
|
|
3226
3299
|
|
|
3227
|
-
allowed_callers?: Array<
|
|
3300
|
+
allowed_callers?: Array<
|
|
3301
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3302
|
+
>;
|
|
3228
3303
|
|
|
3229
3304
|
/**
|
|
3230
3305
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3270,7 +3345,9 @@ export interface BetaToolComputerUse20250124 {
|
|
|
3270
3345
|
|
|
3271
3346
|
type: 'computer_20250124';
|
|
3272
3347
|
|
|
3273
|
-
allowed_callers?: Array<
|
|
3348
|
+
allowed_callers?: Array<
|
|
3349
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3350
|
+
>;
|
|
3274
3351
|
|
|
3275
3352
|
/**
|
|
3276
3353
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3316,7 +3393,9 @@ export interface BetaToolComputerUse20251124 {
|
|
|
3316
3393
|
|
|
3317
3394
|
type: 'computer_20251124';
|
|
3318
3395
|
|
|
3319
|
-
allowed_callers?: Array<
|
|
3396
|
+
allowed_callers?: Array<
|
|
3397
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3398
|
+
>;
|
|
3320
3399
|
|
|
3321
3400
|
/**
|
|
3322
3401
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3400,7 +3479,9 @@ export interface BetaToolSearchToolBm25_20251119 {
|
|
|
3400
3479
|
|
|
3401
3480
|
type: 'tool_search_tool_bm25_20251119' | 'tool_search_tool_bm25';
|
|
3402
3481
|
|
|
3403
|
-
allowed_callers?: Array<
|
|
3482
|
+
allowed_callers?: Array<
|
|
3483
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3484
|
+
>;
|
|
3404
3485
|
|
|
3405
3486
|
/**
|
|
3406
3487
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3429,7 +3510,9 @@ export interface BetaToolSearchToolRegex20251119 {
|
|
|
3429
3510
|
|
|
3430
3511
|
type: 'tool_search_tool_regex_20251119' | 'tool_search_tool_regex';
|
|
3431
3512
|
|
|
3432
|
-
allowed_callers?: Array<
|
|
3513
|
+
allowed_callers?: Array<
|
|
3514
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3515
|
+
>;
|
|
3433
3516
|
|
|
3434
3517
|
/**
|
|
3435
3518
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3509,7 +3592,9 @@ export interface BetaToolTextEditor20241022 {
|
|
|
3509
3592
|
|
|
3510
3593
|
type: 'text_editor_20241022';
|
|
3511
3594
|
|
|
3512
|
-
allowed_callers?: Array<
|
|
3595
|
+
allowed_callers?: Array<
|
|
3596
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3597
|
+
>;
|
|
3513
3598
|
|
|
3514
3599
|
/**
|
|
3515
3600
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3540,7 +3625,9 @@ export interface BetaToolTextEditor20250124 {
|
|
|
3540
3625
|
|
|
3541
3626
|
type: 'text_editor_20250124';
|
|
3542
3627
|
|
|
3543
|
-
allowed_callers?: Array<
|
|
3628
|
+
allowed_callers?: Array<
|
|
3629
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3630
|
+
>;
|
|
3544
3631
|
|
|
3545
3632
|
/**
|
|
3546
3633
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3571,7 +3658,9 @@ export interface BetaToolTextEditor20250429 {
|
|
|
3571
3658
|
|
|
3572
3659
|
type: 'text_editor_20250429';
|
|
3573
3660
|
|
|
3574
|
-
allowed_callers?: Array<
|
|
3661
|
+
allowed_callers?: Array<
|
|
3662
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3663
|
+
>;
|
|
3575
3664
|
|
|
3576
3665
|
/**
|
|
3577
3666
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3602,7 +3691,9 @@ export interface BetaToolTextEditor20250728 {
|
|
|
3602
3691
|
|
|
3603
3692
|
type: 'text_editor_20250728';
|
|
3604
3693
|
|
|
3605
|
-
allowed_callers?: Array<
|
|
3694
|
+
allowed_callers?: Array<
|
|
3695
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3696
|
+
>;
|
|
3606
3697
|
|
|
3607
3698
|
/**
|
|
3608
3699
|
* Create a cache control breakpoint at this content block.
|
|
@@ -3640,6 +3731,7 @@ export type BetaToolUnion =
|
|
|
3640
3731
|
| BetaCodeExecutionTool20250522
|
|
3641
3732
|
| BetaCodeExecutionTool20250825
|
|
3642
3733
|
| BetaCodeExecutionTool20260120
|
|
3734
|
+
| BetaCodeExecutionTool20260521
|
|
3643
3735
|
| BetaToolComputerUse20241022
|
|
3644
3736
|
| BetaMemoryTool20250818
|
|
3645
3737
|
| BetaToolComputerUse20250124
|
|
@@ -3854,7 +3946,9 @@ export interface BetaWebFetchTool20250910 {
|
|
|
3854
3946
|
|
|
3855
3947
|
type: 'web_fetch_20250910';
|
|
3856
3948
|
|
|
3857
|
-
allowed_callers?: Array<
|
|
3949
|
+
allowed_callers?: Array<
|
|
3950
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
3951
|
+
>;
|
|
3858
3952
|
|
|
3859
3953
|
/**
|
|
3860
3954
|
* List of domains to allow fetching from
|
|
@@ -3910,7 +4004,9 @@ export interface BetaWebFetchTool20260209 {
|
|
|
3910
4004
|
|
|
3911
4005
|
type: 'web_fetch_20260209';
|
|
3912
4006
|
|
|
3913
|
-
allowed_callers?: Array<
|
|
4007
|
+
allowed_callers?: Array<
|
|
4008
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
4009
|
+
>;
|
|
3914
4010
|
|
|
3915
4011
|
/**
|
|
3916
4012
|
* List of domains to allow fetching from
|
|
@@ -3969,7 +4065,9 @@ export interface BetaWebFetchTool20260309 {
|
|
|
3969
4065
|
|
|
3970
4066
|
type: 'web_fetch_20260309';
|
|
3971
4067
|
|
|
3972
|
-
allowed_callers?: Array<
|
|
4068
|
+
allowed_callers?: Array<
|
|
4069
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
4070
|
+
>;
|
|
3973
4071
|
|
|
3974
4072
|
/**
|
|
3975
4073
|
* List of domains to allow fetching from
|
|
@@ -4110,7 +4208,9 @@ export interface BetaWebSearchTool20250305 {
|
|
|
4110
4208
|
|
|
4111
4209
|
type: 'web_search_20250305';
|
|
4112
4210
|
|
|
4113
|
-
allowed_callers?: Array<
|
|
4211
|
+
allowed_callers?: Array<
|
|
4212
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
4213
|
+
>;
|
|
4114
4214
|
|
|
4115
4215
|
/**
|
|
4116
4216
|
* If provided, only these domains will be included in results. Cannot be used
|
|
@@ -4162,7 +4262,9 @@ export interface BetaWebSearchTool20260209 {
|
|
|
4162
4262
|
|
|
4163
4263
|
type: 'web_search_20260209';
|
|
4164
4264
|
|
|
4165
|
-
allowed_callers?: Array<
|
|
4265
|
+
allowed_callers?: Array<
|
|
4266
|
+
'direct' | 'code_execution_20250825' | 'code_execution_20260120' | 'code_execution_20260521'
|
|
4267
|
+
>;
|
|
4166
4268
|
|
|
4167
4269
|
/**
|
|
4168
4270
|
* If provided, only these domains will be included in results. Cannot be used
|
|
@@ -4613,15 +4715,16 @@ export interface MessageCreateParamsBase {
|
|
|
4613
4715
|
top_p?: number;
|
|
4614
4716
|
|
|
4615
4717
|
/**
|
|
4616
|
-
*
|
|
4617
|
-
* behalf of a party other than your organization.
|
|
4718
|
+
* Header param: Optional header to specify the beta version(s) you want to use.
|
|
4618
4719
|
*/
|
|
4619
|
-
|
|
4720
|
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
|
4620
4721
|
|
|
4621
4722
|
/**
|
|
4622
|
-
* Header param:
|
|
4723
|
+
* Header param: The user profile ID to attribute this request to. Use when acting
|
|
4724
|
+
* on behalf of a party other than your organization. Requires the `user-profiles`
|
|
4725
|
+
* beta header.
|
|
4623
4726
|
*/
|
|
4624
|
-
|
|
4727
|
+
user_profile_id?: string;
|
|
4625
4728
|
}
|
|
4626
4729
|
|
|
4627
4730
|
export namespace MessageCreateParams {
|
|
@@ -4879,6 +4982,7 @@ export interface MessageCountTokensParams {
|
|
|
4879
4982
|
| BetaCodeExecutionTool20250522
|
|
4880
4983
|
| BetaCodeExecutionTool20250825
|
|
4881
4984
|
| BetaCodeExecutionTool20260120
|
|
4985
|
+
| BetaCodeExecutionTool20260521
|
|
4882
4986
|
| BetaToolComputerUse20241022
|
|
4883
4987
|
| BetaMemoryTool20250818
|
|
4884
4988
|
| BetaToolComputerUse20250124
|
|
@@ -4967,6 +5071,7 @@ export declare namespace Messages {
|
|
|
4967
5071
|
type BetaCodeExecutionTool20250522 as BetaCodeExecutionTool20250522,
|
|
4968
5072
|
type BetaCodeExecutionTool20250825 as BetaCodeExecutionTool20250825,
|
|
4969
5073
|
type BetaCodeExecutionTool20260120 as BetaCodeExecutionTool20260120,
|
|
5074
|
+
type BetaCodeExecutionTool20260521 as BetaCodeExecutionTool20260521,
|
|
4970
5075
|
type BetaCodeExecutionToolResultBlock as BetaCodeExecutionToolResultBlock,
|
|
4971
5076
|
type BetaCodeExecutionToolResultBlockContent as BetaCodeExecutionToolResultBlockContent,
|
|
4972
5077
|
type BetaCodeExecutionToolResultBlockParam as BetaCodeExecutionToolResultBlockParam,
|
|
@@ -5002,6 +5107,7 @@ export declare namespace Messages {
|
|
|
5002
5107
|
type BetaFallbackInfoParam as BetaFallbackInfoParam,
|
|
5003
5108
|
type BetaFallbackMessageIterationUsage as BetaFallbackMessageIterationUsage,
|
|
5004
5109
|
type BetaFallbackParam as BetaFallbackParam,
|
|
5110
|
+
type BetaFallbackRefusalTrigger as BetaFallbackRefusalTrigger,
|
|
5005
5111
|
type BetaFileDocumentSource as BetaFileDocumentSource,
|
|
5006
5112
|
type BetaFileImageSource as BetaFileImageSource,
|
|
5007
5113
|
type BetaImageBlockParam as BetaImageBlockParam,
|
|
@@ -59,7 +59,8 @@ export type BetaWebhookEventData =
|
|
|
59
59
|
| BetaWebhookVaultCredentialCreatedEventData
|
|
60
60
|
| BetaWebhookVaultCredentialArchivedEventData
|
|
61
61
|
| BetaWebhookVaultCredentialDeletedEventData
|
|
62
|
-
| BetaWebhookVaultCredentialRefreshFailedEventData
|
|
62
|
+
| BetaWebhookVaultCredentialRefreshFailedEventData
|
|
63
|
+
| BetaWebhookSessionUpdatedEventData;
|
|
63
64
|
|
|
64
65
|
export interface BetaWebhookSessionArchivedEventData {
|
|
65
66
|
/**
|
|
@@ -271,6 +272,19 @@ export interface BetaWebhookSessionThreadTerminatedEventData {
|
|
|
271
272
|
workspace_id: string;
|
|
272
273
|
}
|
|
273
274
|
|
|
275
|
+
export interface BetaWebhookSessionUpdatedEventData {
|
|
276
|
+
/**
|
|
277
|
+
* ID of the session that triggered the event.
|
|
278
|
+
*/
|
|
279
|
+
id: string;
|
|
280
|
+
|
|
281
|
+
organization_id: string;
|
|
282
|
+
|
|
283
|
+
type: 'session.updated';
|
|
284
|
+
|
|
285
|
+
workspace_id: string;
|
|
286
|
+
}
|
|
287
|
+
|
|
274
288
|
export interface BetaWebhookVaultArchivedEventData {
|
|
275
289
|
/**
|
|
276
290
|
* ID of the vault that triggered the event.
|
|
@@ -420,6 +434,7 @@ export declare namespace Webhooks {
|
|
|
420
434
|
type BetaWebhookSessionThreadCreatedEventData as BetaWebhookSessionThreadCreatedEventData,
|
|
421
435
|
type BetaWebhookSessionThreadIdledEventData as BetaWebhookSessionThreadIdledEventData,
|
|
422
436
|
type BetaWebhookSessionThreadTerminatedEventData as BetaWebhookSessionThreadTerminatedEventData,
|
|
437
|
+
type BetaWebhookSessionUpdatedEventData as BetaWebhookSessionUpdatedEventData,
|
|
423
438
|
type BetaWebhookVaultArchivedEventData as BetaWebhookVaultArchivedEventData,
|
|
424
439
|
type BetaWebhookVaultCreatedEventData as BetaWebhookVaultCreatedEventData,
|
|
425
440
|
type BetaWebhookVaultCredentialArchivedEventData as BetaWebhookVaultCredentialArchivedEventData,
|
package/src/resources/index.ts
CHANGED
|
@@ -58,6 +58,7 @@ export {
|
|
|
58
58
|
type CodeExecutionTool20250522,
|
|
59
59
|
type CodeExecutionTool20250825,
|
|
60
60
|
type CodeExecutionTool20260120,
|
|
61
|
+
type CodeExecutionTool20260521,
|
|
61
62
|
type CodeExecutionToolResultBlock,
|
|
62
63
|
type CodeExecutionToolResultBlockContent,
|
|
63
64
|
type CodeExecutionToolResultBlockParam,
|
|
@@ -40,8 +40,16 @@ export class Batches extends APIResource {
|
|
|
40
40
|
* });
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
create(
|
|
44
|
-
|
|
43
|
+
create(params: BatchCreateParams, options?: RequestOptions): APIPromise<MessageBatch> {
|
|
44
|
+
const { user_profile_id, ...body } = params;
|
|
45
|
+
return this._client.post('/v1/messages/batches', {
|
|
46
|
+
body,
|
|
47
|
+
...options,
|
|
48
|
+
headers: buildHeaders([
|
|
49
|
+
{ ...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined) },
|
|
50
|
+
options?.headers,
|
|
51
|
+
]),
|
|
52
|
+
});
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
/**
|
|
@@ -350,10 +358,19 @@ export interface MessageBatchSucceededResult {
|
|
|
350
358
|
|
|
351
359
|
export interface BatchCreateParams {
|
|
352
360
|
/**
|
|
353
|
-
* List of requests for prompt completion. Each is an individual
|
|
354
|
-
* a Message.
|
|
361
|
+
* Body param: List of requests for prompt completion. Each is an individual
|
|
362
|
+
* request to create a Message.
|
|
355
363
|
*/
|
|
356
364
|
requests: Array<BatchCreateParams.Request>;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Header param: The user profile ID to attribute the requests in this batch to.
|
|
368
|
+
* Use when acting on behalf of a party other than your organization. Requires the
|
|
369
|
+
* `user-profiles` beta header. Applies to every request in the batch; an
|
|
370
|
+
* individual request whose `user_profile_id` body field conflicts with this header
|
|
371
|
+
* is errored.
|
|
372
|
+
*/
|
|
373
|
+
user_profile_id?: string;
|
|
357
374
|
}
|
|
358
375
|
|
|
359
376
|
export namespace BatchCreateParams {
|
|
@@ -50,6 +50,7 @@ export {
|
|
|
50
50
|
type CodeExecutionTool20250522,
|
|
51
51
|
type CodeExecutionTool20250825,
|
|
52
52
|
type CodeExecutionTool20260120,
|
|
53
|
+
type CodeExecutionTool20260521,
|
|
53
54
|
type CodeExecutionToolResultBlock,
|
|
54
55
|
type CodeExecutionToolResultBlockContent,
|
|
55
56
|
type CodeExecutionToolResultBlockParam,
|