@anthropic-ai/sdk 0.123.0 → 0.124.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 +28 -0
- package/client.d.mts +6 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -5
- package/client.d.ts.map +1 -1
- package/client.js +2 -1
- package/client.js.map +1 -1
- package/client.mjs +2 -1
- package/client.mjs.map +1 -1
- package/core/streaming.js +4 -2
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +4 -2
- package/core/streaming.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/agents/agents.d.mts +45 -0
- package/resources/beta/agents/agents.d.mts.map +1 -1
- package/resources/beta/agents/agents.d.ts +45 -0
- package/resources/beta/agents/agents.d.ts.map +1 -1
- package/resources/beta/agents/agents.js +25 -10
- package/resources/beta/agents/agents.js.map +1 -1
- package/resources/beta/agents/agents.mjs +25 -10
- package/resources/beta/agents/agents.mjs.map +1 -1
- package/resources/beta/agents/versions.d.mts +9 -0
- package/resources/beta/agents/versions.d.mts.map +1 -1
- package/resources/beta/agents/versions.d.ts +9 -0
- package/resources/beta/agents/versions.d.ts.map +1 -1
- package/resources/beta/agents/versions.js +5 -2
- package/resources/beta/agents/versions.js.map +1 -1
- package/resources/beta/agents/versions.mjs +5 -2
- package/resources/beta/agents/versions.mjs.map +1 -1
- package/resources/beta/deployment-runs.d.mts +18 -0
- package/resources/beta/deployment-runs.d.mts.map +1 -1
- package/resources/beta/deployment-runs.d.ts +18 -0
- package/resources/beta/deployment-runs.d.ts.map +1 -1
- package/resources/beta/deployment-runs.js +10 -4
- package/resources/beta/deployment-runs.js.map +1 -1
- package/resources/beta/deployment-runs.mjs +10 -4
- package/resources/beta/deployment-runs.mjs.map +1 -1
- package/resources/beta/deployments.d.mts +72 -0
- package/resources/beta/deployments.d.mts.map +1 -1
- package/resources/beta/deployments.d.ts +72 -0
- package/resources/beta/deployments.d.ts.map +1 -1
- package/resources/beta/deployments.js +40 -16
- package/resources/beta/deployments.js.map +1 -1
- package/resources/beta/deployments.mjs +40 -16
- package/resources/beta/deployments.mjs.map +1 -1
- package/resources/beta/dreams.d.mts +45 -0
- package/resources/beta/dreams.d.mts.map +1 -1
- package/resources/beta/dreams.d.ts +45 -0
- package/resources/beta/dreams.d.ts.map +1 -1
- package/resources/beta/dreams.js +25 -10
- package/resources/beta/dreams.js.map +1 -1
- package/resources/beta/dreams.mjs +25 -10
- package/resources/beta/dreams.mjs.map +1 -1
- package/resources/beta/environments/environments.d.mts +54 -0
- package/resources/beta/environments/environments.d.mts.map +1 -1
- package/resources/beta/environments/environments.d.ts +54 -0
- package/resources/beta/environments/environments.d.ts.map +1 -1
- package/resources/beta/environments/environments.js +30 -12
- package/resources/beta/environments/environments.js.map +1 -1
- package/resources/beta/environments/environments.mjs +30 -12
- package/resources/beta/environments/environments.mjs.map +1 -1
- package/resources/beta/environments/work.d.mts +36 -0
- package/resources/beta/environments/work.d.mts.map +1 -1
- package/resources/beta/environments/work.d.ts +36 -0
- package/resources/beta/environments/work.d.ts.map +1 -1
- package/resources/beta/environments/work.js +20 -8
- package/resources/beta/environments/work.js.map +1 -1
- package/resources/beta/environments/work.mjs +20 -8
- package/resources/beta/environments/work.mjs.map +1 -1
- package/resources/beta/files.d.mts +48 -1
- package/resources/beta/files.d.mts.map +1 -1
- package/resources/beta/files.d.ts +48 -1
- package/resources/beta/files.d.ts.map +1 -1
- package/resources/beta/files.js +22 -9
- package/resources/beta/files.js.map +1 -1
- package/resources/beta/files.mjs +22 -9
- package/resources/beta/files.mjs.map +1 -1
- package/resources/beta/memory-stores/memories.d.mts +45 -0
- package/resources/beta/memory-stores/memories.d.mts.map +1 -1
- package/resources/beta/memory-stores/memories.d.ts +45 -0
- package/resources/beta/memory-stores/memories.d.ts.map +1 -1
- package/resources/beta/memory-stores/memories.js +25 -10
- package/resources/beta/memory-stores/memories.js.map +1 -1
- package/resources/beta/memory-stores/memories.mjs +25 -10
- package/resources/beta/memory-stores/memories.mjs.map +1 -1
- package/resources/beta/memory-stores/memory-stores.d.mts +54 -0
- package/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
- package/resources/beta/memory-stores/memory-stores.d.ts +54 -0
- package/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
- package/resources/beta/memory-stores/memory-stores.js +30 -12
- package/resources/beta/memory-stores/memory-stores.js.map +1 -1
- package/resources/beta/memory-stores/memory-stores.mjs +30 -12
- package/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
- package/resources/beta/memory-stores/memory-versions.d.mts +31 -4
- package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
- package/resources/beta/memory-stores/memory-versions.d.ts +31 -4
- package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
- package/resources/beta/memory-stores/memory-versions.js +15 -6
- package/resources/beta/memory-stores/memory-versions.js.map +1 -1
- package/resources/beta/memory-stores/memory-versions.mjs +15 -6
- package/resources/beta/memory-stores/memory-versions.mjs.map +1 -1
- package/resources/beta/messages/batches.d.mts +54 -0
- package/resources/beta/messages/batches.d.mts.map +1 -1
- package/resources/beta/messages/batches.d.ts +54 -0
- package/resources/beta/messages/batches.d.ts.map +1 -1
- package/resources/beta/messages/batches.js +25 -11
- package/resources/beta/messages/batches.js.map +1 -1
- package/resources/beta/messages/batches.mjs +25 -11
- package/resources/beta/messages/batches.mjs.map +1 -1
- package/resources/beta/messages/messages.d.mts +18 -0
- package/resources/beta/messages/messages.d.mts.map +1 -1
- package/resources/beta/messages/messages.d.ts +18 -0
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js +4 -2
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs +4 -2
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/models.d.mts +18 -0
- package/resources/beta/models.d.mts.map +1 -1
- package/resources/beta/models.d.ts +18 -0
- package/resources/beta/models.d.ts.map +1 -1
- package/resources/beta/models.js +10 -4
- package/resources/beta/models.js.map +1 -1
- package/resources/beta/models.mjs +10 -4
- package/resources/beta/models.mjs.map +1 -1
- package/resources/beta/organization/compliance-settings.d.mts +5 -3
- package/resources/beta/organization/compliance-settings.d.mts.map +1 -1
- package/resources/beta/organization/compliance-settings.d.ts +5 -3
- package/resources/beta/organization/compliance-settings.d.ts.map +1 -1
- package/resources/beta/organization/index.d.mts +1 -1
- package/resources/beta/organization/index.d.mts.map +1 -1
- package/resources/beta/organization/index.d.ts +1 -1
- package/resources/beta/organization/index.d.ts.map +1 -1
- package/resources/beta/organization/index.js.map +1 -1
- package/resources/beta/organization/index.mjs.map +1 -1
- package/resources/beta/organization/organization.d.mts +2 -2
- package/resources/beta/organization/organization.d.mts.map +1 -1
- package/resources/beta/organization/organization.d.ts +2 -2
- package/resources/beta/organization/organization.d.ts.map +1 -1
- package/resources/beta/organization/organization.js.map +1 -1
- package/resources/beta/organization/organization.mjs.map +1 -1
- package/resources/beta/sessions/events.d.mts +27 -0
- package/resources/beta/sessions/events.d.mts.map +1 -1
- package/resources/beta/sessions/events.d.ts +27 -0
- package/resources/beta/sessions/events.d.ts.map +1 -1
- package/resources/beta/sessions/events.js +15 -6
- package/resources/beta/sessions/events.js.map +1 -1
- package/resources/beta/sessions/events.mjs +15 -6
- package/resources/beta/sessions/events.mjs.map +1 -1
- package/resources/beta/sessions/resources.d.mts +45 -0
- package/resources/beta/sessions/resources.d.mts.map +1 -1
- package/resources/beta/sessions/resources.d.ts +45 -0
- package/resources/beta/sessions/resources.d.ts.map +1 -1
- package/resources/beta/sessions/resources.js +25 -10
- package/resources/beta/sessions/resources.js.map +1 -1
- package/resources/beta/sessions/resources.mjs +25 -10
- package/resources/beta/sessions/resources.mjs.map +1 -1
- package/resources/beta/sessions/sessions.d.mts +54 -0
- package/resources/beta/sessions/sessions.d.mts.map +1 -1
- package/resources/beta/sessions/sessions.d.ts +54 -0
- package/resources/beta/sessions/sessions.d.ts.map +1 -1
- package/resources/beta/sessions/sessions.js +30 -12
- package/resources/beta/sessions/sessions.js.map +1 -1
- package/resources/beta/sessions/sessions.mjs +30 -12
- package/resources/beta/sessions/sessions.mjs.map +1 -1
- package/resources/beta/sessions/threads/events.d.mts +18 -0
- package/resources/beta/sessions/threads/events.d.mts.map +1 -1
- package/resources/beta/sessions/threads/events.d.ts +18 -0
- package/resources/beta/sessions/threads/events.d.ts.map +1 -1
- package/resources/beta/sessions/threads/events.js +10 -4
- package/resources/beta/sessions/threads/events.js.map +1 -1
- package/resources/beta/sessions/threads/events.mjs +10 -4
- package/resources/beta/sessions/threads/events.mjs.map +1 -1
- package/resources/beta/sessions/threads/threads.d.mts +27 -0
- package/resources/beta/sessions/threads/threads.d.mts.map +1 -1
- package/resources/beta/sessions/threads/threads.d.ts +27 -0
- package/resources/beta/sessions/threads/threads.d.ts.map +1 -1
- package/resources/beta/sessions/threads/threads.js +15 -6
- package/resources/beta/sessions/threads/threads.js.map +1 -1
- package/resources/beta/sessions/threads/threads.mjs +15 -6
- package/resources/beta/sessions/threads/threads.mjs.map +1 -1
- package/resources/beta/skills/skills.d.mts +36 -0
- package/resources/beta/skills/skills.d.mts.map +1 -1
- package/resources/beta/skills/skills.d.ts +36 -0
- package/resources/beta/skills/skills.d.ts.map +1 -1
- package/resources/beta/skills/skills.js +20 -8
- package/resources/beta/skills/skills.js.map +1 -1
- package/resources/beta/skills/skills.mjs +20 -8
- package/resources/beta/skills/skills.mjs.map +1 -1
- package/resources/beta/skills/versions.d.mts +45 -0
- package/resources/beta/skills/versions.d.mts.map +1 -1
- package/resources/beta/skills/versions.d.ts +45 -0
- package/resources/beta/skills/versions.d.ts.map +1 -1
- package/resources/beta/skills/versions.js +22 -9
- package/resources/beta/skills/versions.js.map +1 -1
- package/resources/beta/skills/versions.mjs +22 -9
- package/resources/beta/skills/versions.mjs.map +1 -1
- package/resources/beta/tunnels/certificates.d.mts +36 -0
- package/resources/beta/tunnels/certificates.d.mts.map +1 -1
- package/resources/beta/tunnels/certificates.d.ts +36 -0
- package/resources/beta/tunnels/certificates.d.ts.map +1 -1
- package/resources/beta/tunnels/certificates.js +20 -8
- package/resources/beta/tunnels/certificates.js.map +1 -1
- package/resources/beta/tunnels/certificates.mjs +20 -8
- package/resources/beta/tunnels/certificates.mjs.map +1 -1
- package/resources/beta/tunnels/tunnels.d.mts +54 -0
- package/resources/beta/tunnels/tunnels.d.mts.map +1 -1
- package/resources/beta/tunnels/tunnels.d.ts +54 -0
- package/resources/beta/tunnels/tunnels.d.ts.map +1 -1
- package/resources/beta/tunnels/tunnels.js +30 -12
- package/resources/beta/tunnels/tunnels.js.map +1 -1
- package/resources/beta/tunnels/tunnels.mjs +30 -12
- package/resources/beta/tunnels/tunnels.mjs.map +1 -1
- package/resources/beta/vaults/credentials.d.mts +63 -0
- package/resources/beta/vaults/credentials.d.mts.map +1 -1
- package/resources/beta/vaults/credentials.d.ts +63 -0
- package/resources/beta/vaults/credentials.d.ts.map +1 -1
- package/resources/beta/vaults/credentials.js +35 -14
- package/resources/beta/vaults/credentials.js.map +1 -1
- package/resources/beta/vaults/credentials.mjs +35 -14
- package/resources/beta/vaults/credentials.mjs.map +1 -1
- package/resources/beta/vaults/vaults.d.mts +54 -0
- package/resources/beta/vaults/vaults.d.mts.map +1 -1
- package/resources/beta/vaults/vaults.d.ts +54 -0
- package/resources/beta/vaults/vaults.d.ts.map +1 -1
- package/resources/beta/vaults/vaults.js +30 -12
- package/resources/beta/vaults/vaults.js.map +1 -1
- package/resources/beta/vaults/vaults.mjs +30 -12
- package/resources/beta/vaults/vaults.mjs.map +1 -1
- package/resources/completions.d.mts +9 -0
- package/resources/completions.d.mts.map +1 -1
- package/resources/completions.d.ts +9 -0
- package/resources/completions.d.ts.map +1 -1
- package/resources/completions.js +5 -2
- package/resources/completions.js.map +1 -1
- package/resources/completions.mjs +5 -2
- package/resources/completions.mjs.map +1 -1
- package/resources/files.d.mts +104 -15
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +104 -15
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +79 -10
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +79 -10
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +2 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -2
- 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 +68 -6
- package/resources/messages/batches.d.mts.map +1 -1
- package/resources/messages/batches.d.ts +68 -6
- package/resources/messages/batches.d.ts.map +1 -1
- package/resources/messages/batches.js +52 -13
- package/resources/messages/batches.js.map +1 -1
- package/resources/messages/batches.mjs +52 -13
- 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 +20 -2
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +20 -2
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +10 -4
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +10 -4
- package/resources/messages/messages.mjs.map +1 -1
- package/resources/models.d.mts +31 -0
- package/resources/models.d.mts.map +1 -1
- package/resources/models.d.ts +31 -0
- package/resources/models.d.ts.map +1 -1
- package/resources/models.js +23 -4
- package/resources/models.js.map +1 -1
- package/resources/models.mjs +23 -4
- package/resources/models.mjs.map +1 -1
- package/resources/skills/index.d.mts +1 -1
- package/resources/skills/index.d.mts.map +1 -1
- package/resources/skills/index.d.ts +1 -1
- package/resources/skills/index.d.ts.map +1 -1
- package/resources/skills/index.js.map +1 -1
- package/resources/skills/index.mjs.map +1 -1
- package/resources/skills/skills.d.mts +75 -10
- package/resources/skills/skills.d.mts.map +1 -1
- package/resources/skills/skills.d.ts +75 -10
- package/resources/skills/skills.d.ts.map +1 -1
- package/resources/skills/skills.js +64 -8
- package/resources/skills/skills.js.map +1 -1
- package/resources/skills/skills.mjs +64 -8
- package/resources/skills/skills.mjs.map +1 -1
- package/resources/skills/versions.d.mts +75 -5
- package/resources/skills/versions.d.mts.map +1 -1
- package/resources/skills/versions.d.ts +75 -5
- package/resources/skills/versions.d.ts.map +1 -1
- package/resources/skills/versions.js +67 -7
- package/resources/skills/versions.js.map +1 -1
- package/resources/skills/versions.mjs +67 -7
- package/resources/skills/versions.mjs.map +1 -1
- package/src/client.ts +12 -1
- package/src/core/streaming.ts +4 -2
- package/src/resources/beta/agents/agents.ts +75 -10
- package/src/resources/beta/agents/versions.ts +15 -2
- package/src/resources/beta/deployment-runs.ts +30 -4
- package/src/resources/beta/deployments.ts +120 -16
- package/src/resources/beta/dreams.ts +75 -10
- package/src/resources/beta/environments/environments.ts +90 -12
- package/src/resources/beta/environments/work.ts +60 -8
- package/src/resources/beta/files.ts +75 -11
- package/src/resources/beta/memory-stores/memories.ts +75 -10
- package/src/resources/beta/memory-stores/memory-stores.ts +90 -12
- package/src/resources/beta/memory-stores/memory-versions.ts +49 -10
- package/src/resources/beta/messages/batches.ts +85 -11
- package/src/resources/beta/messages/messages.ts +24 -2
- package/src/resources/beta/models.ts +30 -4
- package/src/resources/beta/organization/compliance-settings.ts +12 -2
- package/src/resources/beta/organization/index.ts +2 -0
- package/src/resources/beta/organization/organization.ts +4 -0
- package/src/resources/beta/sessions/events.ts +45 -6
- package/src/resources/beta/sessions/resources.ts +75 -10
- package/src/resources/beta/sessions/sessions.ts +90 -12
- package/src/resources/beta/sessions/threads/events.ts +30 -4
- package/src/resources/beta/sessions/threads/threads.ts +45 -6
- package/src/resources/beta/skills/skills.ts +60 -8
- package/src/resources/beta/skills/versions.ts +72 -9
- package/src/resources/beta/tunnels/certificates.ts +60 -8
- package/src/resources/beta/tunnels/tunnels.ts +90 -12
- package/src/resources/beta/vaults/credentials.ts +105 -14
- package/src/resources/beta/vaults/vaults.ts +90 -12
- package/src/resources/completions.ts +15 -2
- package/src/resources/files.ts +161 -18
- package/src/resources/index.ts +5 -0
- package/src/resources/messages/batches.ts +137 -13
- package/src/resources/messages/index.ts +4 -0
- package/src/resources/messages/messages.ts +38 -4
- package/src/resources/models.ts +43 -4
- package/src/resources/skills/index.ts +2 -0
- package/src/resources/skills/skills.ts +127 -13
- package/src/resources/skills/versions.ts +115 -11
- package/src/tools/agent-toolset/fs-util.ts +16 -4
- package/src/version.ts +1 -1
- package/tools/agent-toolset/fs-util.d.mts +11 -4
- package/tools/agent-toolset/fs-util.d.mts.map +1 -1
- package/tools/agent-toolset/fs-util.d.ts +11 -4
- package/tools/agent-toolset/fs-util.d.ts.map +1 -1
- package/tools/agent-toolset/fs-util.js +14 -4
- package/tools/agent-toolset/fs-util.js.map +1 -1
- package/tools/agent-toolset/fs-util.mjs +14 -4
- package/tools/agent-toolset/fs-util.mjs.map +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/src/resources/files.ts
CHANGED
|
@@ -13,50 +13,131 @@ import { path } from '../internal/utils/path';
|
|
|
13
13
|
export class Files extends APIResource {
|
|
14
14
|
/**
|
|
15
15
|
* List Files
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* // Automatically fetches more pages as needed.
|
|
20
|
+
* for await (const fileMetadata of client.files.list()) {
|
|
21
|
+
* // ...
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
16
24
|
*/
|
|
17
25
|
list(
|
|
18
|
-
|
|
26
|
+
params: FileListParams | null | undefined = {},
|
|
19
27
|
options?: RequestOptions,
|
|
20
28
|
): PagePromise<FileMetadataPageCursor, FileMetadata> {
|
|
21
|
-
|
|
29
|
+
const { workspace_id, ...query } = params ?? {};
|
|
30
|
+
return this._client.getAPIList('/v1/files', PageCursor<FileMetadata>, {
|
|
31
|
+
query,
|
|
32
|
+
...options,
|
|
33
|
+
headers: buildHeaders([
|
|
34
|
+
{ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
|
|
35
|
+
options?.headers,
|
|
36
|
+
]),
|
|
37
|
+
});
|
|
22
38
|
}
|
|
23
39
|
|
|
24
40
|
/**
|
|
25
41
|
* Delete File
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const deletedFile = await client.files.delete('file_id');
|
|
46
|
+
* ```
|
|
26
47
|
*/
|
|
27
|
-
delete(
|
|
28
|
-
|
|
48
|
+
delete(
|
|
49
|
+
fileID: string,
|
|
50
|
+
params: FileDeleteParams | null | undefined = {},
|
|
51
|
+
options?: RequestOptions,
|
|
52
|
+
): APIPromise<DeletedFile> {
|
|
53
|
+
const { workspace_id } = params ?? {};
|
|
54
|
+
return this._client.delete(path`/v1/files/${fileID}`, {
|
|
55
|
+
...options,
|
|
56
|
+
headers: buildHeaders([
|
|
57
|
+
{ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
|
|
58
|
+
options?.headers,
|
|
59
|
+
]),
|
|
60
|
+
});
|
|
29
61
|
}
|
|
30
62
|
|
|
31
63
|
/**
|
|
32
64
|
* Download File
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const response = await client.files.download('file_id');
|
|
69
|
+
*
|
|
70
|
+
* const content = await response.blob();
|
|
71
|
+
* console.log(content);
|
|
72
|
+
* ```
|
|
33
73
|
*/
|
|
34
|
-
download(
|
|
74
|
+
download(
|
|
75
|
+
fileID: string,
|
|
76
|
+
params: FileDownloadParams | null | undefined = {},
|
|
77
|
+
options?: RequestOptions,
|
|
78
|
+
): APIPromise<Response> {
|
|
79
|
+
const { workspace_id } = params ?? {};
|
|
35
80
|
return this._client.get(path`/v1/files/${fileID}/content`, {
|
|
36
81
|
...options,
|
|
37
|
-
headers: buildHeaders([
|
|
82
|
+
headers: buildHeaders([
|
|
83
|
+
{
|
|
84
|
+
Accept: 'application/binary',
|
|
85
|
+
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
|
|
86
|
+
},
|
|
87
|
+
options?.headers,
|
|
88
|
+
]),
|
|
38
89
|
__binaryResponse: true,
|
|
39
90
|
});
|
|
40
91
|
}
|
|
41
92
|
|
|
42
93
|
/**
|
|
43
94
|
* Get File Metadata
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const fileMetadata = await client.files.retrieveMetadata(
|
|
99
|
+
* 'file_id',
|
|
100
|
+
* );
|
|
101
|
+
* ```
|
|
44
102
|
*/
|
|
45
|
-
retrieveMetadata(
|
|
46
|
-
|
|
103
|
+
retrieveMetadata(
|
|
104
|
+
fileID: string,
|
|
105
|
+
params: FileRetrieveMetadataParams | null | undefined = {},
|
|
106
|
+
options?: RequestOptions,
|
|
107
|
+
): APIPromise<FileMetadata> {
|
|
108
|
+
const { workspace_id } = params ?? {};
|
|
109
|
+
return this._client.get(path`/v1/files/${fileID}`, {
|
|
110
|
+
...options,
|
|
111
|
+
headers: buildHeaders([
|
|
112
|
+
{ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
|
|
113
|
+
options?.headers,
|
|
114
|
+
]),
|
|
115
|
+
});
|
|
47
116
|
}
|
|
48
117
|
|
|
49
118
|
/**
|
|
50
119
|
* Upload File
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* const fileMetadata = await client.files.upload({
|
|
124
|
+
* file: fs.createReadStream('path/to/file'),
|
|
125
|
+
* });
|
|
126
|
+
* ```
|
|
51
127
|
*/
|
|
52
|
-
upload(
|
|
128
|
+
upload(params: FileUploadParams, options?: RequestOptions): APIPromise<FileMetadata> {
|
|
129
|
+
const { workspace_id, ...body } = params;
|
|
53
130
|
return this._client.post(
|
|
54
131
|
'/v1/files',
|
|
55
132
|
multipartFormRequestOptions(
|
|
56
133
|
{
|
|
57
134
|
body,
|
|
58
135
|
...options,
|
|
59
|
-
headers: buildHeaders([
|
|
136
|
+
headers: buildHeaders([
|
|
137
|
+
{ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
|
|
138
|
+
stainlessHelperHeaderFromFile(body.file),
|
|
139
|
+
options?.headers,
|
|
140
|
+
]),
|
|
60
141
|
},
|
|
61
142
|
this._client,
|
|
62
143
|
),
|
|
@@ -130,26 +211,85 @@ export interface FileMetadata {
|
|
|
130
211
|
|
|
131
212
|
export interface FileListParams extends PageCursorParams {
|
|
132
213
|
/**
|
|
133
|
-
* Restrict the result set to Files whose `id` is in this list. At
|
|
134
|
-
* (after de-duplication). Mutually exclusive with `page` and
|
|
135
|
-
* supplied, the response is always a single page (`next_page` is
|
|
136
|
-
* do not resolve to a visible File — including deleted Files — are
|
|
137
|
-
* omitted.
|
|
214
|
+
* Query param: Restrict the result set to Files whose `id` is in this list. At
|
|
215
|
+
* most 100 entries (after de-duplication). Mutually exclusive with `page` and
|
|
216
|
+
* `limit`. When supplied, the response is always a single page (`next_page` is
|
|
217
|
+
* null). IDs that do not resolve to a visible File — including deleted Files — are
|
|
218
|
+
* silently omitted.
|
|
138
219
|
*/
|
|
139
220
|
ids?: Array<string> | null;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Header param: Optional header to select the Workspace for this request. The
|
|
224
|
+
* value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
225
|
+
*
|
|
226
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
227
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
228
|
+
* match that Workspace.
|
|
229
|
+
*/
|
|
230
|
+
workspace_id?: string;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface FileDeleteParams {
|
|
234
|
+
/**
|
|
235
|
+
* Optional header to select the Workspace for this request. The value is a
|
|
236
|
+
* Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
237
|
+
*
|
|
238
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
239
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
240
|
+
* match that Workspace.
|
|
241
|
+
*/
|
|
242
|
+
workspace_id?: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface FileDownloadParams {
|
|
246
|
+
/**
|
|
247
|
+
* Optional header to select the Workspace for this request. The value is a
|
|
248
|
+
* Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
249
|
+
*
|
|
250
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
251
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
252
|
+
* match that Workspace.
|
|
253
|
+
*/
|
|
254
|
+
workspace_id?: string;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface FileRetrieveMetadataParams {
|
|
258
|
+
/**
|
|
259
|
+
* Optional header to select the Workspace for this request. The value is a
|
|
260
|
+
* Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
261
|
+
*
|
|
262
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
263
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
264
|
+
* match that Workspace.
|
|
265
|
+
*/
|
|
266
|
+
workspace_id?: string;
|
|
140
267
|
}
|
|
141
268
|
|
|
142
269
|
export interface FileUploadParams {
|
|
143
270
|
/**
|
|
144
|
-
* The file to upload
|
|
271
|
+
* Body param: The file to upload. Only the final path component of the part's
|
|
272
|
+
* `filename` is kept; an absent or empty `filename` is replaced with `unnamed`
|
|
273
|
+
* plus the extension for the file's stored `mime_type`, when known.
|
|
145
274
|
*/
|
|
146
275
|
file: Uploadable;
|
|
147
276
|
|
|
148
277
|
/**
|
|
149
|
-
* Seconds from upload until the file expires and its bytes become
|
|
150
|
-
* unavailable. Must be between 3600 (one hour) and 7776000 (ninety
|
|
278
|
+
* Body param: Seconds from upload until the file expires and its bytes become
|
|
279
|
+
* permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety
|
|
280
|
+
* days).
|
|
151
281
|
*/
|
|
152
282
|
expires_in_seconds?: number;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Header param: Optional header to select the Workspace for this request. The
|
|
286
|
+
* value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
287
|
+
*
|
|
288
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
289
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
290
|
+
* match that Workspace.
|
|
291
|
+
*/
|
|
292
|
+
workspace_id?: string;
|
|
153
293
|
}
|
|
154
294
|
|
|
155
295
|
export declare namespace Files {
|
|
@@ -158,6 +298,9 @@ export declare namespace Files {
|
|
|
158
298
|
type FileMetadata as FileMetadata,
|
|
159
299
|
type FileMetadataPageCursor as FileMetadataPageCursor,
|
|
160
300
|
type FileListParams as FileListParams,
|
|
301
|
+
type FileDeleteParams as FileDeleteParams,
|
|
302
|
+
type FileDownloadParams as FileDownloadParams,
|
|
303
|
+
type FileRetrieveMetadataParams as FileRetrieveMetadataParams,
|
|
161
304
|
type FileUploadParams as FileUploadParams,
|
|
162
305
|
};
|
|
163
306
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -30,6 +30,9 @@ export {
|
|
|
30
30
|
type DeletedFile,
|
|
31
31
|
type FileMetadata,
|
|
32
32
|
type FileListParams,
|
|
33
|
+
type FileDeleteParams,
|
|
34
|
+
type FileDownloadParams,
|
|
35
|
+
type FileRetrieveMetadataParams,
|
|
33
36
|
type FileUploadParams,
|
|
34
37
|
type FileMetadataPageCursor,
|
|
35
38
|
} from './files';
|
|
@@ -290,6 +293,8 @@ export {
|
|
|
290
293
|
type Skill,
|
|
291
294
|
type SkillSource,
|
|
292
295
|
type SkillCreateParams,
|
|
296
|
+
type SkillRetrieveParams,
|
|
293
297
|
type SkillListParams,
|
|
298
|
+
type SkillDeleteParams,
|
|
294
299
|
type SkillsPageCursor,
|
|
295
300
|
} from './skills/skills';
|
|
@@ -41,12 +41,15 @@ export class Batches extends APIResource {
|
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
43
|
create(params: BatchCreateParams, options?: RequestOptions): APIPromise<MessageBatch> {
|
|
44
|
-
const { user_profile_id, ...body } = params;
|
|
44
|
+
const { user_profile_id, workspace_id, ...body } = params;
|
|
45
45
|
return this._client.post('/v1/messages/batches', {
|
|
46
46
|
body,
|
|
47
47
|
...options,
|
|
48
48
|
headers: buildHeaders([
|
|
49
|
-
{
|
|
49
|
+
{
|
|
50
|
+
...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined),
|
|
51
|
+
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
|
|
52
|
+
},
|
|
50
53
|
options?.headers,
|
|
51
54
|
]),
|
|
52
55
|
});
|
|
@@ -67,8 +70,19 @@ export class Batches extends APIResource {
|
|
|
67
70
|
* );
|
|
68
71
|
* ```
|
|
69
72
|
*/
|
|
70
|
-
retrieve(
|
|
71
|
-
|
|
73
|
+
retrieve(
|
|
74
|
+
messageBatchID: string,
|
|
75
|
+
params: BatchRetrieveParams | null | undefined = {},
|
|
76
|
+
options?: RequestOptions,
|
|
77
|
+
): APIPromise<MessageBatch> {
|
|
78
|
+
const { workspace_id } = params ?? {};
|
|
79
|
+
return this._client.get(path`/v1/messages/batches/${messageBatchID}`, {
|
|
80
|
+
...options,
|
|
81
|
+
headers: buildHeaders([
|
|
82
|
+
{ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
|
|
83
|
+
options?.headers,
|
|
84
|
+
]),
|
|
85
|
+
});
|
|
72
86
|
}
|
|
73
87
|
|
|
74
88
|
/**
|
|
@@ -87,10 +101,18 @@ export class Batches extends APIResource {
|
|
|
87
101
|
* ```
|
|
88
102
|
*/
|
|
89
103
|
list(
|
|
90
|
-
|
|
104
|
+
params: BatchListParams | null | undefined = {},
|
|
91
105
|
options?: RequestOptions,
|
|
92
106
|
): PagePromise<MessageBatchesPage, MessageBatch> {
|
|
93
|
-
|
|
107
|
+
const { workspace_id, ...query } = params ?? {};
|
|
108
|
+
return this._client.getAPIList('/v1/messages/batches', Page<MessageBatch>, {
|
|
109
|
+
query,
|
|
110
|
+
...options,
|
|
111
|
+
headers: buildHeaders([
|
|
112
|
+
{ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
|
|
113
|
+
options?.headers,
|
|
114
|
+
]),
|
|
115
|
+
});
|
|
94
116
|
}
|
|
95
117
|
|
|
96
118
|
/**
|
|
@@ -108,8 +130,19 @@ export class Batches extends APIResource {
|
|
|
108
130
|
* await client.messages.batches.delete('message_batch_id');
|
|
109
131
|
* ```
|
|
110
132
|
*/
|
|
111
|
-
delete(
|
|
112
|
-
|
|
133
|
+
delete(
|
|
134
|
+
messageBatchID: string,
|
|
135
|
+
params: BatchDeleteParams | null | undefined = {},
|
|
136
|
+
options?: RequestOptions,
|
|
137
|
+
): APIPromise<DeletedMessageBatch> {
|
|
138
|
+
const { workspace_id } = params ?? {};
|
|
139
|
+
return this._client.delete(path`/v1/messages/batches/${messageBatchID}`, {
|
|
140
|
+
...options,
|
|
141
|
+
headers: buildHeaders([
|
|
142
|
+
{ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
|
|
143
|
+
options?.headers,
|
|
144
|
+
]),
|
|
145
|
+
});
|
|
113
146
|
}
|
|
114
147
|
|
|
115
148
|
/**
|
|
@@ -133,8 +166,19 @@ export class Batches extends APIResource {
|
|
|
133
166
|
* );
|
|
134
167
|
* ```
|
|
135
168
|
*/
|
|
136
|
-
cancel(
|
|
137
|
-
|
|
169
|
+
cancel(
|
|
170
|
+
messageBatchID: string,
|
|
171
|
+
params: BatchCancelParams | null | undefined = {},
|
|
172
|
+
options?: RequestOptions,
|
|
173
|
+
): APIPromise<MessageBatch> {
|
|
174
|
+
const { workspace_id } = params ?? {};
|
|
175
|
+
return this._client.post(path`/v1/messages/batches/${messageBatchID}/cancel`, {
|
|
176
|
+
...options,
|
|
177
|
+
headers: buildHeaders([
|
|
178
|
+
{ ...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined) },
|
|
179
|
+
options?.headers,
|
|
180
|
+
]),
|
|
181
|
+
});
|
|
138
182
|
}
|
|
139
183
|
|
|
140
184
|
/**
|
|
@@ -155,19 +199,27 @@ export class Batches extends APIResource {
|
|
|
155
199
|
*/
|
|
156
200
|
async results(
|
|
157
201
|
messageBatchID: string,
|
|
202
|
+
params: BatchResultsParams | undefined = {},
|
|
158
203
|
options?: RequestOptions,
|
|
159
204
|
): Promise<JSONLDecoder<MessageBatchIndividualResponse>> {
|
|
160
|
-
const batch = await this.retrieve(messageBatchID);
|
|
205
|
+
const batch = await this.retrieve(messageBatchID, params, options);
|
|
161
206
|
if (!batch.results_url) {
|
|
162
207
|
throw new AnthropicError(
|
|
163
208
|
`No batch \`results_url\`; Has it finished processing? ${batch.processing_status} - ${batch.id}`,
|
|
164
209
|
);
|
|
165
210
|
}
|
|
166
211
|
|
|
212
|
+
const { workspace_id } = params ?? {};
|
|
167
213
|
return this._client
|
|
168
214
|
.get(batch.results_url, {
|
|
169
215
|
...options,
|
|
170
|
-
headers: buildHeaders([
|
|
216
|
+
headers: buildHeaders([
|
|
217
|
+
{
|
|
218
|
+
Accept: 'application/binary',
|
|
219
|
+
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
|
|
220
|
+
},
|
|
221
|
+
options?.headers,
|
|
222
|
+
]),
|
|
171
223
|
stream: true,
|
|
172
224
|
__binaryResponse: true,
|
|
173
225
|
})
|
|
@@ -371,6 +423,16 @@ export interface BatchCreateParams {
|
|
|
371
423
|
* is errored.
|
|
372
424
|
*/
|
|
373
425
|
user_profile_id?: string;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Header param: Optional header to select the Workspace for this request. The
|
|
429
|
+
* value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
430
|
+
*
|
|
431
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
432
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
433
|
+
* match that Workspace.
|
|
434
|
+
*/
|
|
435
|
+
workspace_id?: string;
|
|
374
436
|
}
|
|
375
437
|
|
|
376
438
|
export namespace BatchCreateParams {
|
|
@@ -394,7 +456,65 @@ export namespace BatchCreateParams {
|
|
|
394
456
|
}
|
|
395
457
|
}
|
|
396
458
|
|
|
397
|
-
export interface
|
|
459
|
+
export interface BatchRetrieveParams {
|
|
460
|
+
/**
|
|
461
|
+
* Optional header to select the Workspace for this request. The value is a
|
|
462
|
+
* Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
463
|
+
*
|
|
464
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
465
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
466
|
+
* match that Workspace.
|
|
467
|
+
*/
|
|
468
|
+
workspace_id?: string;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export interface BatchListParams extends PageParams {
|
|
472
|
+
/**
|
|
473
|
+
* Header param: Optional header to select the Workspace for this request. The
|
|
474
|
+
* value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
475
|
+
*
|
|
476
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
477
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
478
|
+
* match that Workspace.
|
|
479
|
+
*/
|
|
480
|
+
workspace_id?: string;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export interface BatchDeleteParams {
|
|
484
|
+
/**
|
|
485
|
+
* Optional header to select the Workspace for this request. The value is a
|
|
486
|
+
* Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
487
|
+
*
|
|
488
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
489
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
490
|
+
* match that Workspace.
|
|
491
|
+
*/
|
|
492
|
+
workspace_id?: string;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export interface BatchCancelParams {
|
|
496
|
+
/**
|
|
497
|
+
* Optional header to select the Workspace for this request. The value is a
|
|
498
|
+
* Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
499
|
+
*
|
|
500
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
501
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
502
|
+
* match that Workspace.
|
|
503
|
+
*/
|
|
504
|
+
workspace_id?: string;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export interface BatchResultsParams {
|
|
508
|
+
/**
|
|
509
|
+
* Optional header to select the Workspace for this request. The value is a
|
|
510
|
+
* Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
511
|
+
*
|
|
512
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
513
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
514
|
+
* match that Workspace.
|
|
515
|
+
*/
|
|
516
|
+
workspace_id?: string;
|
|
517
|
+
}
|
|
398
518
|
|
|
399
519
|
export declare namespace Batches {
|
|
400
520
|
export {
|
|
@@ -409,6 +529,10 @@ export declare namespace Batches {
|
|
|
409
529
|
type MessageBatchSucceededResult as MessageBatchSucceededResult,
|
|
410
530
|
type MessageBatchesPage as MessageBatchesPage,
|
|
411
531
|
type BatchCreateParams as BatchCreateParams,
|
|
532
|
+
type BatchRetrieveParams as BatchRetrieveParams,
|
|
412
533
|
type BatchListParams as BatchListParams,
|
|
534
|
+
type BatchDeleteParams as BatchDeleteParams,
|
|
535
|
+
type BatchCancelParams as BatchCancelParams,
|
|
536
|
+
type BatchResultsParams as BatchResultsParams,
|
|
413
537
|
};
|
|
414
538
|
}
|
|
@@ -12,7 +12,11 @@ export {
|
|
|
12
12
|
type MessageBatchResult,
|
|
13
13
|
type MessageBatchSucceededResult,
|
|
14
14
|
type BatchCreateParams,
|
|
15
|
+
type BatchRetrieveParams,
|
|
15
16
|
type BatchListParams,
|
|
17
|
+
type BatchDeleteParams,
|
|
18
|
+
type BatchCancelParams,
|
|
19
|
+
type BatchResultsParams,
|
|
16
20
|
type MessageBatchesPage,
|
|
17
21
|
} from './batches';
|
|
18
22
|
export {
|
|
@@ -15,8 +15,12 @@ import {
|
|
|
15
15
|
} from '../../lib/parser';
|
|
16
16
|
import * as BatchesAPI from './batches';
|
|
17
17
|
import {
|
|
18
|
+
BatchCancelParams,
|
|
18
19
|
BatchCreateParams,
|
|
20
|
+
BatchDeleteParams,
|
|
19
21
|
BatchListParams,
|
|
22
|
+
BatchResultsParams,
|
|
23
|
+
BatchRetrieveParams,
|
|
20
24
|
Batches,
|
|
21
25
|
DeletedMessageBatch,
|
|
22
26
|
MessageBatch,
|
|
@@ -68,7 +72,7 @@ export class Messages extends APIResource {
|
|
|
68
72
|
params: MessageCreateParams,
|
|
69
73
|
options?: RequestOptions,
|
|
70
74
|
): APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>> {
|
|
71
|
-
const { user_profile_id, ...body } = params;
|
|
75
|
+
const { user_profile_id, workspace_id, ...body } = params;
|
|
72
76
|
if (body.model in DEPRECATED_MODELS) {
|
|
73
77
|
console.warn(
|
|
74
78
|
`The model '${body.model}' is deprecated and will reach end-of-life on ${
|
|
@@ -99,7 +103,10 @@ export class Messages extends APIResource {
|
|
|
99
103
|
timeout: timeout ?? 600000,
|
|
100
104
|
...options,
|
|
101
105
|
headers: buildHeaders([
|
|
102
|
-
{
|
|
106
|
+
{
|
|
107
|
+
...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined),
|
|
108
|
+
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
|
|
109
|
+
},
|
|
103
110
|
helperHeader,
|
|
104
111
|
options?.headers,
|
|
105
112
|
]),
|
|
@@ -186,12 +193,15 @@ export class Messages extends APIResource {
|
|
|
186
193
|
* ```
|
|
187
194
|
*/
|
|
188
195
|
countTokens(params: MessageCountTokensParams, options?: RequestOptions): APIPromise<MessageTokensCount> {
|
|
189
|
-
const { user_profile_id, ...body } = params;
|
|
196
|
+
const { user_profile_id, workspace_id, ...body } = params;
|
|
190
197
|
return this._client.post('/v1/messages/count_tokens', {
|
|
191
198
|
body,
|
|
192
199
|
...options,
|
|
193
200
|
headers: buildHeaders([
|
|
194
|
-
{
|
|
201
|
+
{
|
|
202
|
+
...(user_profile_id != null ? { 'anthropic-user-profile-id': user_profile_id } : undefined),
|
|
203
|
+
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
|
|
204
|
+
},
|
|
195
205
|
options?.headers,
|
|
196
206
|
]),
|
|
197
207
|
});
|
|
@@ -4820,6 +4830,16 @@ export interface MessageCreateParamsBase {
|
|
|
4820
4830
|
* beta header.
|
|
4821
4831
|
*/
|
|
4822
4832
|
user_profile_id?: string;
|
|
4833
|
+
|
|
4834
|
+
/**
|
|
4835
|
+
* Header param: Optional header to select the Workspace for this request. The
|
|
4836
|
+
* value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
4837
|
+
*
|
|
4838
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
4839
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
4840
|
+
* match that Workspace.
|
|
4841
|
+
*/
|
|
4842
|
+
workspace_id?: string;
|
|
4823
4843
|
}
|
|
4824
4844
|
|
|
4825
4845
|
export namespace MessageCreateParams {
|
|
@@ -5057,6 +5077,16 @@ export interface MessageCountTokensParams {
|
|
|
5057
5077
|
* beta header.
|
|
5058
5078
|
*/
|
|
5059
5079
|
user_profile_id?: string;
|
|
5080
|
+
|
|
5081
|
+
/**
|
|
5082
|
+
* Header param: Optional header to select the Workspace for this request. The
|
|
5083
|
+
* value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
5084
|
+
*
|
|
5085
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
5086
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
5087
|
+
* match that Workspace.
|
|
5088
|
+
*/
|
|
5089
|
+
workspace_id?: string;
|
|
5060
5090
|
}
|
|
5061
5091
|
|
|
5062
5092
|
Messages.Batches = Batches;
|
|
@@ -5316,6 +5346,10 @@ export declare namespace Messages {
|
|
|
5316
5346
|
type MessageBatchSucceededResult as MessageBatchSucceededResult,
|
|
5317
5347
|
type MessageBatchesPage as MessageBatchesPage,
|
|
5318
5348
|
type BatchCreateParams as BatchCreateParams,
|
|
5349
|
+
type BatchRetrieveParams as BatchRetrieveParams,
|
|
5319
5350
|
type BatchListParams as BatchListParams,
|
|
5351
|
+
type BatchDeleteParams as BatchDeleteParams,
|
|
5352
|
+
type BatchCancelParams as BatchCancelParams,
|
|
5353
|
+
type BatchResultsParams as BatchResultsParams,
|
|
5320
5354
|
};
|
|
5321
5355
|
}
|
package/src/resources/models.ts
CHANGED
|
@@ -14,17 +14,25 @@ export class Models extends APIResource {
|
|
|
14
14
|
*
|
|
15
15
|
* The Models API response can be used to determine information about a specific
|
|
16
16
|
* model or resolve a model alias to a model ID.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const modelInfo = await client.models.retrieve('model_id');
|
|
21
|
+
* ```
|
|
17
22
|
*/
|
|
18
23
|
retrieve(
|
|
19
24
|
modelID: string,
|
|
20
25
|
params: ModelRetrieveParams | null | undefined = {},
|
|
21
26
|
options?: RequestOptions,
|
|
22
27
|
): APIPromise<ModelInfo> {
|
|
23
|
-
const { betas } = params ?? {};
|
|
28
|
+
const { betas, workspace_id } = params ?? {};
|
|
24
29
|
return this._client.get(path`/v1/models/${modelID}`, {
|
|
25
30
|
...options,
|
|
26
31
|
headers: buildHeaders([
|
|
27
|
-
{
|
|
32
|
+
{
|
|
33
|
+
...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined),
|
|
34
|
+
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
|
|
35
|
+
},
|
|
28
36
|
options?.headers,
|
|
29
37
|
]),
|
|
30
38
|
});
|
|
@@ -35,17 +43,28 @@ export class Models extends APIResource {
|
|
|
35
43
|
*
|
|
36
44
|
* The Models API response can be used to determine which models are available for
|
|
37
45
|
* use in the API. More recently released models are listed first.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* // Automatically fetches more pages as needed.
|
|
50
|
+
* for await (const modelInfo of client.models.list()) {
|
|
51
|
+
* // ...
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
38
54
|
*/
|
|
39
55
|
list(
|
|
40
56
|
params: ModelListParams | null | undefined = {},
|
|
41
57
|
options?: RequestOptions,
|
|
42
58
|
): PagePromise<ModelInfosPage, ModelInfo> {
|
|
43
|
-
const { betas, ...query } = params ?? {};
|
|
59
|
+
const { betas, workspace_id, ...query } = params ?? {};
|
|
44
60
|
return this._client.getAPIList('/v1/models', Page<ModelInfo>, {
|
|
45
61
|
query,
|
|
46
62
|
...options,
|
|
47
63
|
headers: buildHeaders([
|
|
48
|
-
{
|
|
64
|
+
{
|
|
65
|
+
...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined),
|
|
66
|
+
...(workspace_id != null ? { 'anthropic-workspace-id': workspace_id } : undefined),
|
|
67
|
+
},
|
|
49
68
|
options?.headers,
|
|
50
69
|
]),
|
|
51
70
|
});
|
|
@@ -249,6 +268,16 @@ export interface ModelRetrieveParams {
|
|
|
249
268
|
* Optional header to specify the beta version(s) you want to use.
|
|
250
269
|
*/
|
|
251
270
|
betas?: Array<BetaAPI.AnthropicBeta>;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Optional header to select the Workspace for this request. The value is a
|
|
274
|
+
* Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
275
|
+
*
|
|
276
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
277
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
278
|
+
* match that Workspace.
|
|
279
|
+
*/
|
|
280
|
+
workspace_id?: string;
|
|
252
281
|
}
|
|
253
282
|
|
|
254
283
|
export interface ModelListParams extends PageParams {
|
|
@@ -256,6 +285,16 @@ export interface ModelListParams extends PageParams {
|
|
|
256
285
|
* Header param: Optional header to specify the beta version(s) you want to use.
|
|
257
286
|
*/
|
|
258
287
|
betas?: Array<BetaAPI.AnthropicBeta>;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Header param: Optional header to select the Workspace for this request. The
|
|
291
|
+
* value is a Workspace ID (for example, `wrkspc_011CZkZaBF1tNoB5wlCeusgy`).
|
|
292
|
+
*
|
|
293
|
+
* Only needed for credentials that can act on more than one Workspace. A
|
|
294
|
+
* credential that belongs to a specific Workspace may omit it; if sent, it must
|
|
295
|
+
* match that Workspace.
|
|
296
|
+
*/
|
|
297
|
+
workspace_id?: string;
|
|
259
298
|
}
|
|
260
299
|
|
|
261
300
|
export declare namespace Models {
|