@anthropic-ai/sdk 0.34.0-alpha.0 → 0.36.2
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 +92 -0
- package/README.md +19 -17
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/{internal/utils.js → _shims/auto/runtime-bun.js} +5 -8
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +89 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +248 -0
- package/core.d.ts.map +1 -0
- package/core.js +929 -0
- package/core.js.map +1 -0
- package/core.mjs +897 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +2 -2
- package/error.d.ts.map +1 -1
- package/error.js +3 -3
- package/error.js.map +1 -1
- package/error.mjs +2 -2
- package/error.mjs.map +1 -1
- package/index.d.mts +150 -5
- package/index.d.ts +150 -5
- package/index.d.ts.map +1 -1
- package/index.js +159 -18
- package/index.js.map +1 -1
- package/index.mjs +133 -5
- package/index.mjs.map +1 -1
- package/internal/decoders/jsonl.d.ts +1 -0
- package/internal/decoders/jsonl.d.ts.map +1 -1
- package/internal/decoders/jsonl.js +2 -2
- package/internal/decoders/jsonl.js.map +1 -1
- package/internal/decoders/jsonl.mjs +2 -2
- package/internal/decoders/jsonl.mjs.map +1 -1
- package/internal/decoders/line.d.ts +0 -1
- package/internal/decoders/line.d.ts.map +1 -1
- package/internal/stream-utils.d.ts +8 -0
- package/internal/stream-utils.d.ts.map +1 -0
- package/internal/stream-utils.js +39 -0
- package/internal/stream-utils.js.map +1 -0
- package/internal/stream-utils.mjs +35 -0
- package/internal/stream-utils.mjs.map +1 -0
- package/lib/{MessageStream.d.mts → BetaMessageStream.d.ts} +39 -22
- package/lib/BetaMessageStream.d.ts.map +1 -0
- package/lib/BetaMessageStream.js +492 -0
- package/lib/BetaMessageStream.js.map +1 -0
- package/lib/BetaMessageStream.mjs +488 -0
- package/lib/BetaMessageStream.mjs.map +1 -0
- package/lib/MessageStream.d.ts +25 -8
- package/lib/MessageStream.d.ts.map +1 -1
- package/lib/MessageStream.js +42 -9
- package/lib/MessageStream.js.map +1 -1
- package/lib/MessageStream.mjs +42 -9
- package/lib/MessageStream.mjs.map +1 -1
- package/package.json +64 -120
- package/pagination.d.ts +4 -41
- package/pagination.d.ts.map +1 -1
- package/pagination.js +21 -95
- package/pagination.js.map +1 -1
- package/pagination.mjs +19 -91
- package/pagination.mjs.map +1 -1
- package/resource.d.ts +3 -3
- package/resource.d.ts.map +1 -1
- package/resource.js.map +1 -1
- package/resource.mjs.map +1 -1
- package/resources/beta/beta.d.ts +3 -3
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +1 -0
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +2 -1
- package/resources/beta/beta.mjs.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 +4 -3
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/messages/batches.d.ts +20 -14
- package/resources/beta/messages/batches.d.ts.map +1 -1
- package/resources/beta/messages/batches.js +36 -47
- package/resources/beta/messages/batches.js.map +1 -1
- package/resources/beta/messages/batches.mjs +34 -46
- package/resources/beta/messages/batches.mjs.map +1 -1
- package/resources/beta/messages/index.d.ts +2 -2
- package/resources/beta/messages/index.d.ts.map +1 -1
- package/resources/beta/messages/index.js +2 -1
- package/resources/beta/messages/index.js.map +1 -1
- package/resources/beta/messages/index.mjs +1 -1
- package/resources/beta/messages/index.mjs.map +1 -1
- package/resources/beta/messages/messages.d.ts +95 -10
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js +21 -0
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs +22 -1
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/models.d.ts +8 -7
- package/resources/beta/models.d.ts.map +1 -1
- package/resources/beta/models.js +12 -10
- package/resources/beta/models.js.map +1 -1
- package/resources/beta/models.mjs +10 -9
- package/resources/beta/models.mjs.map +1 -1
- package/resources/completions.d.ts +5 -5
- package/resources/completions.d.ts.map +1 -1
- package/resources/completions.js.map +1 -1
- package/resources/completions.mjs.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +2 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages/batches.d.ts +16 -14
- package/resources/messages/batches.d.ts.map +1 -1
- package/resources/messages/batches.js +30 -18
- package/resources/messages/batches.js.map +1 -1
- package/resources/messages/batches.mjs +28 -17
- package/resources/messages/batches.mjs.map +1 -1
- package/resources/messages/index.d.ts +2 -2
- package/resources/messages/index.d.ts.map +1 -1
- package/resources/messages/index.js +2 -1
- package/resources/messages/index.js.map +1 -1
- package/resources/messages/index.mjs +1 -1
- package/resources/messages/index.mjs.map +1 -1
- package/resources/messages/messages.d.ts +90 -11
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +4 -0
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +5 -1
- package/resources/messages/messages.mjs.map +1 -1
- package/resources/models.d.ts +8 -7
- package/resources/models.d.ts.map +1 -1
- package/resources/models.js +12 -10
- package/resources/models.js.map +1 -1
- package/resources/models.mjs +10 -9
- package/resources/models.mjs.map +1 -1
- package/shims/node.d.ts +30 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +81 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1242 -0
- package/src/error.ts +3 -3
- package/src/index.ts +432 -12
- package/src/internal/decoders/jsonl.ts +5 -4
- package/src/internal/decoders/line.ts +1 -1
- package/src/internal/stream-utils.ts +32 -0
- package/src/lib/BetaMessageStream.ts +599 -0
- package/src/lib/MessageStream.ts +58 -20
- package/src/pagination.ts +18 -122
- package/src/resource.ts +3 -3
- package/src/resources/beta/beta.ts +33 -6
- package/src/resources/beta/index.ts +16 -3
- package/src/resources/beta/messages/batches.ts +94 -42
- package/src/resources/beta/messages/index.ts +17 -3
- package/src/resources/beta/messages/messages.ts +202 -18
- package/src/resources/beta/models.ts +22 -12
- package/src/resources/completions.ts +13 -10
- package/src/resources/index.ts +18 -5
- package/src/resources/messages/batches.ts +46 -28
- package/src/resources/messages/index.ts +16 -3
- package/src/resources/messages/messages.ts +174 -22
- package/src/resources/models.ts +19 -12
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/streaming.ts +15 -42
- package/src/tsconfig.json +1 -1
- package/src/uploads.ts +54 -57
- package/src/version.ts +1 -1
- package/streaming.d.ts +1 -8
- package/streaming.d.ts.map +1 -1
- package/streaming.js +8 -41
- package/streaming.js.map +1 -1
- package/streaming.mjs +7 -39
- package/streaming.mjs.map +1 -1
- package/uploads.d.ts +19 -23
- package/uploads.d.ts.map +1 -1
- package/uploads.js +27 -33
- package/uploads.js.map +1 -1
- package/uploads.mjs +21 -29
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/_vendor/partial-json-parser/parser.d.mts +0 -3
- package/_vendor/partial-json-parser/parser.d.mts.map +0 -1
- package/api-promise.d.mts +0 -48
- package/api-promise.d.mts.map +0 -1
- package/api-promise.d.ts +0 -48
- package/api-promise.d.ts.map +0 -1
- package/api-promise.js +0 -71
- package/api-promise.js.map +0 -1
- package/api-promise.mjs +0 -67
- package/api-promise.mjs.map +0 -1
- package/client.d.mts +0 -212
- package/client.d.mts.map +0 -1
- package/client.d.ts +0 -212
- package/client.d.ts.map +0 -1
- package/client.js +0 -505
- package/client.js.map +0 -1
- package/client.mjs +0 -477
- package/client.mjs.map +0 -1
- package/error.d.mts +0 -48
- package/error.d.mts.map +0 -1
- package/index.d.mts.map +0 -1
- package/internal/builtin-types.d.mts +0 -65
- package/internal/builtin-types.d.mts.map +0 -1
- package/internal/builtin-types.d.ts +0 -65
- package/internal/builtin-types.d.ts.map +0 -1
- package/internal/builtin-types.js +0 -4
- package/internal/builtin-types.js.map +0 -1
- package/internal/builtin-types.mjs +0 -3
- package/internal/builtin-types.mjs.map +0 -1
- package/internal/decoders/jsonl.d.mts +0 -11
- package/internal/decoders/jsonl.d.mts.map +0 -1
- package/internal/decoders/line.d.mts +0 -21
- package/internal/decoders/line.d.mts.map +0 -1
- package/internal/detect-platform.d.mts +0 -15
- package/internal/detect-platform.d.mts.map +0 -1
- package/internal/detect-platform.d.ts +0 -15
- package/internal/detect-platform.d.ts.map +0 -1
- package/internal/detect-platform.js +0 -162
- package/internal/detect-platform.js.map +0 -1
- package/internal/detect-platform.mjs +0 -157
- package/internal/detect-platform.mjs.map +0 -1
- package/internal/errors.d.mts +0 -3
- package/internal/errors.d.mts.map +0 -1
- package/internal/errors.d.ts +0 -3
- package/internal/errors.d.ts.map +0 -1
- package/internal/errors.js +0 -22
- package/internal/errors.js.map +0 -1
- package/internal/errors.mjs +0 -17
- package/internal/errors.mjs.map +0 -1
- package/internal/headers.d.mts +0 -21
- package/internal/headers.d.mts.map +0 -1
- package/internal/headers.d.ts +0 -21
- package/internal/headers.d.ts.map +0 -1
- package/internal/headers.js +0 -77
- package/internal/headers.js.map +0 -1
- package/internal/headers.mjs +0 -72
- package/internal/headers.mjs.map +0 -1
- package/internal/parse.d.mts +0 -14
- package/internal/parse.d.mts.map +0 -1
- package/internal/parse.d.ts +0 -14
- package/internal/parse.d.ts.map +0 -1
- package/internal/parse.js +0 -48
- package/internal/parse.js.map +0 -1
- package/internal/parse.mjs +0 -43
- package/internal/parse.mjs.map +0 -1
- package/internal/polyfill/crypto.node.d.ts +0 -10
- package/internal/polyfill/crypto.node.js +0 -11
- package/internal/polyfill/crypto.node.mjs +0 -2
- package/internal/polyfill/file.node.d.ts +0 -9
- package/internal/polyfill/file.node.js +0 -17
- package/internal/polyfill/file.node.mjs +0 -9
- package/internal/request-options.d.mts +0 -37
- package/internal/request-options.d.mts.map +0 -1
- package/internal/request-options.d.ts +0 -37
- package/internal/request-options.d.ts.map +0 -1
- package/internal/request-options.js +0 -40
- package/internal/request-options.js.map +0 -1
- package/internal/request-options.mjs +0 -35
- package/internal/request-options.mjs.map +0 -1
- package/internal/shim-types.d.mts +0 -28
- package/internal/shim-types.d.ts +0 -28
- package/internal/shims.d.mts +0 -65
- package/internal/shims.d.mts.map +0 -1
- package/internal/shims.d.ts +0 -65
- package/internal/shims.d.ts.map +0 -1
- package/internal/shims.js +0 -66
- package/internal/shims.js.map +0 -1
- package/internal/shims.mjs +0 -58
- package/internal/shims.mjs.map +0 -1
- package/internal/types.d.mts +0 -6
- package/internal/types.d.mts.map +0 -1
- package/internal/types.d.ts +0 -6
- package/internal/types.d.ts.map +0 -1
- package/internal/types.js +0 -4
- package/internal/types.js.map +0 -1
- package/internal/types.mjs +0 -3
- package/internal/types.mjs.map +0 -1
- package/internal/utils/base64.d.mts +0 -3
- package/internal/utils/base64.d.mts.map +0 -1
- package/internal/utils/base64.d.ts +0 -3
- package/internal/utils/base64.d.ts.map +0 -1
- package/internal/utils/base64.js +0 -33
- package/internal/utils/base64.js.map +0 -1
- package/internal/utils/base64.mjs +0 -28
- package/internal/utils/base64.mjs.map +0 -1
- package/internal/utils/env.d.mts +0 -9
- package/internal/utils/env.d.mts.map +0 -1
- package/internal/utils/env.d.ts +0 -9
- package/internal/utils/env.d.ts.map +0 -1
- package/internal/utils/env.js +0 -22
- package/internal/utils/env.js.map +0 -1
- package/internal/utils/env.mjs +0 -18
- package/internal/utils/env.mjs.map +0 -1
- package/internal/utils/log.d.mts +0 -2
- package/internal/utils/log.d.mts.map +0 -1
- package/internal/utils/log.d.ts +0 -2
- package/internal/utils/log.d.ts.map +0 -1
- package/internal/utils/log.js +0 -12
- package/internal/utils/log.js.map +0 -1
- package/internal/utils/log.mjs +0 -8
- package/internal/utils/log.mjs.map +0 -1
- package/internal/utils/sleep.d.mts +0 -2
- package/internal/utils/sleep.d.mts.map +0 -1
- package/internal/utils/sleep.d.ts +0 -2
- package/internal/utils/sleep.d.ts.map +0 -1
- package/internal/utils/sleep.js +0 -7
- package/internal/utils/sleep.js.map +0 -1
- package/internal/utils/sleep.mjs +0 -3
- package/internal/utils/sleep.mjs.map +0 -1
- package/internal/utils/uuid.d.mts +0 -5
- package/internal/utils/uuid.d.mts.map +0 -1
- package/internal/utils/uuid.d.ts +0 -5
- package/internal/utils/uuid.d.ts.map +0 -1
- package/internal/utils/uuid.js +0 -15
- package/internal/utils/uuid.js.map +0 -1
- package/internal/utils/uuid.mjs +0 -11
- package/internal/utils/uuid.mjs.map +0 -1
- package/internal/utils/values.d.mts +0 -15
- package/internal/utils/values.d.mts.map +0 -1
- package/internal/utils/values.d.ts +0 -15
- package/internal/utils/values.d.ts.map +0 -1
- package/internal/utils/values.js +0 -100
- package/internal/utils/values.js.map +0 -1
- package/internal/utils/values.mjs +0 -84
- package/internal/utils/values.mjs.map +0 -1
- package/internal/utils.d.mts +0 -7
- package/internal/utils.d.mts.map +0 -1
- package/internal/utils.d.ts +0 -7
- package/internal/utils.d.ts.map +0 -1
- package/internal/utils.js.map +0 -1
- package/internal/utils.mjs +0 -8
- package/internal/utils.mjs.map +0 -1
- package/lib/MessageStream.d.mts.map +0 -1
- package/pagination.d.mts +0 -63
- package/pagination.d.mts.map +0 -1
- package/resource.d.mts +0 -6
- package/resource.d.mts.map +0 -1
- package/resources/beta/beta.d.mts +0 -57
- package/resources/beta/beta.d.mts.map +0 -1
- package/resources/beta/index.d.mts +0 -4
- package/resources/beta/index.d.mts.map +0 -1
- package/resources/beta/messages/batches.d.mts +0 -261
- package/resources/beta/messages/batches.d.mts.map +0 -1
- package/resources/beta/messages/index.d.mts +0 -3
- package/resources/beta/messages/index.d.mts.map +0 -1
- package/resources/beta/messages/messages.d.mts +0 -879
- package/resources/beta/messages/messages.d.mts.map +0 -1
- package/resources/beta/models.d.mts +0 -48
- package/resources/beta/models.d.mts.map +0 -1
- package/resources/completions.d.mts +0 -166
- package/resources/completions.d.mts.map +0 -1
- package/resources/index.d.mts +0 -6
- package/resources/index.d.mts.map +0 -1
- package/resources/messages/batches.d.mts +0 -229
- package/resources/messages/batches.d.mts.map +0 -1
- package/resources/messages/index.d.mts +0 -3
- package/resources/messages/index.d.mts.map +0 -1
- package/resources/messages/messages.d.mts +0 -859
- package/resources/messages/messages.d.mts.map +0 -1
- package/resources/models.d.mts +0 -48
- package/resources/models.d.mts.map +0 -1
- package/resources/shared.d.mts +0 -42
- package/resources/shared.d.mts.map +0 -1
- package/resources/top-level.d.mts +0 -2
- package/resources/top-level.d.mts.map +0 -1
- package/src/api-promise.ts +0 -93
- package/src/client.ts +0 -863
- package/src/internal/builtin-types.ts +0 -79
- package/src/internal/detect-platform.ts +0 -192
- package/src/internal/errors.ts +0 -18
- package/src/internal/headers.ts +0 -96
- package/src/internal/parse.ts +0 -70
- package/src/internal/polyfill/crypto.node.d.ts +0 -10
- package/src/internal/polyfill/crypto.node.js +0 -11
- package/src/internal/polyfill/crypto.node.mjs +0 -2
- package/src/internal/polyfill/file.node.d.ts +0 -9
- package/src/internal/polyfill/file.node.js +0 -17
- package/src/internal/polyfill/file.node.mjs +0 -9
- package/src/internal/request-options.ts +0 -71
- package/src/internal/shim-types.d.ts +0 -28
- package/src/internal/shims.ts +0 -124
- package/src/internal/types.ts +0 -6
- package/src/internal/utils/base64.ts +0 -40
- package/src/internal/utils/env.ts +0 -20
- package/src/internal/utils/log.ts +0 -9
- package/src/internal/utils/sleep.ts +0 -3
- package/src/internal/utils/uuid.ts +0 -13
- package/src/internal/utils/values.ts +0 -94
- package/src/internal/utils.ts +0 -8
- package/streaming.d.mts +0 -41
- package/streaming.d.mts.map +0 -1
- package/uploads.d.mts +0 -79
- package/uploads.d.mts.map +0 -1
- package/version.d.mts +0 -2
- package/version.d.mts.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
3
|
+
import { APIResource } from "../resource.js";
|
|
4
|
+
import { APIPromise } from "../core.js";
|
|
5
|
+
import * as Core from "../core.js";
|
|
6
|
+
import * as CompletionsAPI from "./completions.js";
|
|
7
|
+
import * as MessagesAPI from "./messages/messages.js";
|
|
8
|
+
import { Stream } from "../streaming.js";
|
|
9
9
|
|
|
10
10
|
export class Completions extends APIResource {
|
|
11
11
|
/**
|
|
@@ -18,15 +18,18 @@ export class Completions extends APIResource {
|
|
|
18
18
|
* [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages)
|
|
19
19
|
* for guidance in migrating from Text Completions to Messages.
|
|
20
20
|
*/
|
|
21
|
-
create(body: CompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Completion>;
|
|
22
|
-
create(
|
|
21
|
+
create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Completion>;
|
|
22
|
+
create(
|
|
23
|
+
body: CompletionCreateParamsStreaming,
|
|
24
|
+
options?: Core.RequestOptions,
|
|
25
|
+
): APIPromise<Stream<Completion>>;
|
|
23
26
|
create(
|
|
24
27
|
body: CompletionCreateParamsBase,
|
|
25
|
-
options?: RequestOptions,
|
|
28
|
+
options?: Core.RequestOptions,
|
|
26
29
|
): APIPromise<Stream<Completion> | Completion>;
|
|
27
30
|
create(
|
|
28
31
|
body: CompletionCreateParams,
|
|
29
|
-
options?: RequestOptions,
|
|
32
|
+
options?: Core.RequestOptions,
|
|
30
33
|
): APIPromise<Completion> | APIPromise<Stream<Completion>> {
|
|
31
34
|
return this._client.post('/v1/complete', {
|
|
32
35
|
body,
|
package/src/resources/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export * from
|
|
3
|
+
export * from "./shared.js";
|
|
4
4
|
export {
|
|
5
5
|
Beta,
|
|
6
6
|
type AnthropicBeta,
|
|
@@ -15,21 +15,31 @@ export {
|
|
|
15
15
|
type BetaOverloadedError,
|
|
16
16
|
type BetaPermissionError,
|
|
17
17
|
type BetaRateLimitError,
|
|
18
|
-
} from
|
|
18
|
+
} from "./beta/beta.js";
|
|
19
19
|
export {
|
|
20
20
|
Completions,
|
|
21
21
|
type Completion,
|
|
22
22
|
type CompletionCreateParams,
|
|
23
23
|
type CompletionCreateParamsNonStreaming,
|
|
24
24
|
type CompletionCreateParamsStreaming,
|
|
25
|
-
} from
|
|
25
|
+
} from "./completions.js";
|
|
26
26
|
export {
|
|
27
27
|
Messages,
|
|
28
28
|
type Base64PDFSource,
|
|
29
29
|
type CacheControlEphemeral,
|
|
30
|
+
type CitationCharLocation,
|
|
31
|
+
type CitationCharLocationParam,
|
|
32
|
+
type CitationContentBlockLocation,
|
|
33
|
+
type CitationContentBlockLocationParam,
|
|
34
|
+
type CitationPageLocation,
|
|
35
|
+
type CitationPageLocationParam,
|
|
36
|
+
type CitationsConfigParam,
|
|
37
|
+
type CitationsDelta,
|
|
30
38
|
type ContentBlock,
|
|
31
39
|
type ContentBlockDeltaEvent,
|
|
32
40
|
type ContentBlockParam,
|
|
41
|
+
type ContentBlockSource,
|
|
42
|
+
type ContentBlockSourceContent,
|
|
33
43
|
type ContentBlockStartEvent,
|
|
34
44
|
type ContentBlockStopEvent,
|
|
35
45
|
type DocumentBlockParam,
|
|
@@ -47,6 +57,7 @@ export {
|
|
|
47
57
|
type MessageTokensCount,
|
|
48
58
|
type Metadata,
|
|
49
59
|
type Model,
|
|
60
|
+
type PlainTextSource,
|
|
50
61
|
type RawContentBlockDeltaEvent,
|
|
51
62
|
type RawContentBlockStartEvent,
|
|
52
63
|
type RawContentBlockStopEvent,
|
|
@@ -56,6 +67,8 @@ export {
|
|
|
56
67
|
type RawMessageStreamEvent,
|
|
57
68
|
type TextBlock,
|
|
58
69
|
type TextBlockParam,
|
|
70
|
+
type TextCitation,
|
|
71
|
+
type TextCitationParam,
|
|
59
72
|
type TextDelta,
|
|
60
73
|
type Tool,
|
|
61
74
|
type ToolChoice,
|
|
@@ -70,5 +83,5 @@ export {
|
|
|
70
83
|
type MessageCreateParamsNonStreaming,
|
|
71
84
|
type MessageCreateParamsStreaming,
|
|
72
85
|
type MessageCountTokensParams,
|
|
73
|
-
} from
|
|
74
|
-
export { Models, type ModelInfo, type ModelListParams
|
|
86
|
+
} from "./messages/messages.js";
|
|
87
|
+
export { ModelInfosPage, Models, type ModelInfo, type ModelListParams } from "./models.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { JSONLDecoder } from
|
|
10
|
-
import { AnthropicError } from
|
|
3
|
+
import { APIResource } from "../../resource.js";
|
|
4
|
+
import { isRequestOptions } from "../../core.js";
|
|
5
|
+
import * as Core from "../../core.js";
|
|
6
|
+
import * as Shared from "../shared.js";
|
|
7
|
+
import * as MessagesAPI from "./messages.js";
|
|
8
|
+
import { Page, type PageParams } from "../../pagination.js";
|
|
9
|
+
import { JSONLDecoder } from "../../internal/decoders/jsonl.js";
|
|
10
|
+
import { AnthropicError } from "../../error.js";
|
|
11
11
|
|
|
12
12
|
export class Batches extends APIResource {
|
|
13
13
|
/**
|
|
@@ -17,7 +17,7 @@ export class Batches extends APIResource {
|
|
|
17
17
|
* once. Once a Message Batch is created, it begins processing immediately. Batches
|
|
18
18
|
* can take up to 24 hours to complete.
|
|
19
19
|
*/
|
|
20
|
-
create(body: BatchCreateParams, options?: RequestOptions): APIPromise<MessageBatch> {
|
|
20
|
+
create(body: BatchCreateParams, options?: Core.RequestOptions): Core.APIPromise<MessageBatch> {
|
|
21
21
|
return this._client.post('/v1/messages/batches', { body, ...options });
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -26,8 +26,8 @@ export class Batches extends APIResource {
|
|
|
26
26
|
* completion. To access the results of a Message Batch, make a request to the
|
|
27
27
|
* `results_url` field in the response.
|
|
28
28
|
*/
|
|
29
|
-
retrieve(
|
|
30
|
-
return this._client.get(`/v1/messages/batches/${
|
|
29
|
+
retrieve(messageBatchId: string, options?: Core.RequestOptions): Core.APIPromise<MessageBatch> {
|
|
30
|
+
return this._client.get(`/v1/messages/batches/${messageBatchId}`, options);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -35,19 +35,28 @@ export class Batches extends APIResource {
|
|
|
35
35
|
* returned first.
|
|
36
36
|
*/
|
|
37
37
|
list(
|
|
38
|
-
query
|
|
39
|
-
options?: RequestOptions,
|
|
40
|
-
): PagePromise<MessageBatchesPage, MessageBatch
|
|
41
|
-
|
|
38
|
+
query?: BatchListParams,
|
|
39
|
+
options?: Core.RequestOptions,
|
|
40
|
+
): Core.PagePromise<MessageBatchesPage, MessageBatch>;
|
|
41
|
+
list(options?: Core.RequestOptions): Core.PagePromise<MessageBatchesPage, MessageBatch>;
|
|
42
|
+
list(
|
|
43
|
+
query: BatchListParams | Core.RequestOptions = {},
|
|
44
|
+
options?: Core.RequestOptions,
|
|
45
|
+
): Core.PagePromise<MessageBatchesPage, MessageBatch> {
|
|
46
|
+
if (isRequestOptions(query)) {
|
|
47
|
+
return this.list({}, query);
|
|
48
|
+
}
|
|
49
|
+
return this._client.getAPIList('/v1/messages/batches', MessageBatchesPage, { query, ...options });
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
53
|
+
* Delete a Message Batch.
|
|
54
|
+
*
|
|
55
|
+
* Message Batches can only be deleted once they've finished processing. If you'd
|
|
56
|
+
* like to delete an in-progress batch, you must first cancel it.
|
|
48
57
|
*/
|
|
49
|
-
delete(
|
|
50
|
-
return this._client.delete(`/v1/messages/batches/${
|
|
58
|
+
delete(messageBatchId: string, options?: Core.RequestOptions): Core.APIPromise<DeletedMessageBatch> {
|
|
59
|
+
return this._client.delete(`/v1/messages/batches/${messageBatchId}`, options);
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
/**
|
|
@@ -61,8 +70,8 @@ export class Batches extends APIResource {
|
|
|
61
70
|
* Note that cancellation may not result in any canceled requests if they were
|
|
62
71
|
* non-interruptible.
|
|
63
72
|
*/
|
|
64
|
-
cancel(
|
|
65
|
-
return this._client.post(`/v1/messages/batches/${
|
|
73
|
+
cancel(messageBatchId: string, options?: Core.RequestOptions): Core.APIPromise<MessageBatch> {
|
|
74
|
+
return this._client.post(`/v1/messages/batches/${messageBatchId}/cancel`, options);
|
|
66
75
|
}
|
|
67
76
|
|
|
68
77
|
/**
|
|
@@ -73,10 +82,10 @@ export class Batches extends APIResource {
|
|
|
73
82
|
* requests. Use the `custom_id` field to match results to requests.
|
|
74
83
|
*/
|
|
75
84
|
async results(
|
|
76
|
-
|
|
77
|
-
options?: RequestOptions,
|
|
85
|
+
messageBatchId: string,
|
|
86
|
+
options?: Core.RequestOptions,
|
|
78
87
|
): Promise<JSONLDecoder<MessageBatchIndividualResponse>> {
|
|
79
|
-
const batch = await this.retrieve(
|
|
88
|
+
const batch = await this.retrieve(messageBatchId);
|
|
80
89
|
if (!batch.results_url) {
|
|
81
90
|
throw new AnthropicError(
|
|
82
91
|
`No batch \`results_url\`; Has it finished processing? ${batch.processing_status} - ${batch.id}`,
|
|
@@ -84,12 +93,19 @@ export class Batches extends APIResource {
|
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
return this._client
|
|
87
|
-
.get(batch.results_url, {
|
|
96
|
+
.get(batch.results_url, {
|
|
97
|
+
...options,
|
|
98
|
+
headers: {
|
|
99
|
+
Accept: 'application/binary',
|
|
100
|
+
...options?.headers,
|
|
101
|
+
},
|
|
102
|
+
__binaryResponse: true,
|
|
103
|
+
})
|
|
88
104
|
._thenUnwrap((_, props) => JSONLDecoder.fromResponse(props.response, props.controller));
|
|
89
105
|
}
|
|
90
106
|
}
|
|
91
107
|
|
|
92
|
-
export
|
|
108
|
+
export class MessageBatchesPage extends Page<MessageBatch> {}
|
|
93
109
|
|
|
94
110
|
export interface DeletedMessageBatch {
|
|
95
111
|
/**
|
|
@@ -294,6 +310,8 @@ export namespace BatchCreateParams {
|
|
|
294
310
|
|
|
295
311
|
export interface BatchListParams extends PageParams {}
|
|
296
312
|
|
|
313
|
+
Batches.MessageBatchesPage = MessageBatchesPage;
|
|
314
|
+
|
|
297
315
|
export declare namespace Batches {
|
|
298
316
|
export {
|
|
299
317
|
type DeletedMessageBatch as DeletedMessageBatch,
|
|
@@ -305,7 +323,7 @@ export declare namespace Batches {
|
|
|
305
323
|
type MessageBatchRequestCounts as MessageBatchRequestCounts,
|
|
306
324
|
type MessageBatchResult as MessageBatchResult,
|
|
307
325
|
type MessageBatchSucceededResult as MessageBatchSucceededResult,
|
|
308
|
-
|
|
326
|
+
MessageBatchesPage as MessageBatchesPage,
|
|
309
327
|
type BatchCreateParams as BatchCreateParams,
|
|
310
328
|
type BatchListParams as BatchListParams,
|
|
311
329
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
|
+
MessageBatchesPage,
|
|
4
5
|
Batches,
|
|
5
6
|
type DeletedMessageBatch,
|
|
6
7
|
type MessageBatch,
|
|
@@ -13,15 +14,24 @@ export {
|
|
|
13
14
|
type MessageBatchSucceededResult,
|
|
14
15
|
type BatchCreateParams,
|
|
15
16
|
type BatchListParams,
|
|
16
|
-
|
|
17
|
-
} from './batches';
|
|
17
|
+
} from "./batches.js";
|
|
18
18
|
export {
|
|
19
19
|
Messages,
|
|
20
20
|
type Base64PDFSource,
|
|
21
21
|
type CacheControlEphemeral,
|
|
22
|
+
type CitationCharLocation,
|
|
23
|
+
type CitationCharLocationParam,
|
|
24
|
+
type CitationContentBlockLocation,
|
|
25
|
+
type CitationContentBlockLocationParam,
|
|
26
|
+
type CitationPageLocation,
|
|
27
|
+
type CitationPageLocationParam,
|
|
28
|
+
type CitationsConfigParam,
|
|
29
|
+
type CitationsDelta,
|
|
22
30
|
type ContentBlock,
|
|
23
31
|
type ContentBlockDeltaEvent,
|
|
24
32
|
type ContentBlockParam,
|
|
33
|
+
type ContentBlockSource,
|
|
34
|
+
type ContentBlockSourceContent,
|
|
25
35
|
type ContentBlockStartEvent,
|
|
26
36
|
type ContentBlockStopEvent,
|
|
27
37
|
type DocumentBlockParam,
|
|
@@ -37,6 +47,7 @@ export {
|
|
|
37
47
|
type MessageTokensCount,
|
|
38
48
|
type Metadata,
|
|
39
49
|
type Model,
|
|
50
|
+
type PlainTextSource,
|
|
40
51
|
type RawContentBlockDeltaEvent,
|
|
41
52
|
type RawContentBlockStartEvent,
|
|
42
53
|
type RawContentBlockStopEvent,
|
|
@@ -46,6 +57,8 @@ export {
|
|
|
46
57
|
type RawMessageStreamEvent,
|
|
47
58
|
type TextBlock,
|
|
48
59
|
type TextBlockParam,
|
|
60
|
+
type TextCitation,
|
|
61
|
+
type TextCitationParam,
|
|
49
62
|
type TextDelta,
|
|
50
63
|
type Tool,
|
|
51
64
|
type ToolChoice,
|
|
@@ -61,4 +74,4 @@ export {
|
|
|
61
74
|
type MessageCreateParamsNonStreaming,
|
|
62
75
|
type MessageCreateParamsStreaming,
|
|
63
76
|
type MessageCountTokensParams,
|
|
64
|
-
} from
|
|
77
|
+
} from "./messages.js";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
3
|
+
import { APIResource } from "../../resource.js";
|
|
4
|
+
import { APIPromise } from "../../core.js";
|
|
5
|
+
import * as Core from "../../core.js";
|
|
6
|
+
import * as MessagesAPI from "./messages.js";
|
|
7
|
+
import * as BatchesAPI from "./batches.js";
|
|
6
8
|
import {
|
|
7
9
|
BatchCreateParams,
|
|
8
10
|
BatchListParams,
|
|
@@ -17,13 +19,11 @@ import {
|
|
|
17
19
|
MessageBatchResult,
|
|
18
20
|
MessageBatchSucceededResult,
|
|
19
21
|
MessageBatchesPage,
|
|
20
|
-
} from
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { RequestOptions } from '../../internal/request-options';
|
|
24
|
-
import { MessageStream } from '../../lib/MessageStream';
|
|
22
|
+
} from "./batches.js";
|
|
23
|
+
import { Stream } from "../../streaming.js";
|
|
24
|
+
import { MessageStream } from "../../lib/MessageStream.js";
|
|
25
25
|
|
|
26
|
-
export { MessageStream } from
|
|
26
|
+
export { MessageStream } from "../../lib/MessageStream.js";
|
|
27
27
|
|
|
28
28
|
export class Messages extends APIResource {
|
|
29
29
|
batches: BatchesAPI.Batches = new BatchesAPI.Batches(this._client);
|
|
@@ -35,18 +35,18 @@ export class Messages extends APIResource {
|
|
|
35
35
|
* The Messages API can be used for either single queries or stateless multi-turn
|
|
36
36
|
* conversations.
|
|
37
37
|
*/
|
|
38
|
-
create(body: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
|
|
38
|
+
create(body: MessageCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Message>;
|
|
39
39
|
create(
|
|
40
40
|
body: MessageCreateParamsStreaming,
|
|
41
|
-
options?: RequestOptions,
|
|
41
|
+
options?: Core.RequestOptions,
|
|
42
42
|
): APIPromise<Stream<RawMessageStreamEvent>>;
|
|
43
43
|
create(
|
|
44
44
|
body: MessageCreateParamsBase,
|
|
45
|
-
options?: RequestOptions,
|
|
45
|
+
options?: Core.RequestOptions,
|
|
46
46
|
): APIPromise<Stream<RawMessageStreamEvent> | Message>;
|
|
47
47
|
create(
|
|
48
48
|
body: MessageCreateParams,
|
|
49
|
-
options?: RequestOptions,
|
|
49
|
+
options?: Core.RequestOptions,
|
|
50
50
|
): APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>> {
|
|
51
51
|
if (body.model in DEPRECATED_MODELS) {
|
|
52
52
|
console.warn(
|
|
@@ -66,7 +66,7 @@ export class Messages extends APIResource {
|
|
|
66
66
|
/**
|
|
67
67
|
* Create a Message stream
|
|
68
68
|
*/
|
|
69
|
-
stream(body: MessageStreamParams, options?: RequestOptions): MessageStream {
|
|
69
|
+
stream(body: MessageStreamParams, options?: Core.RequestOptions): MessageStream {
|
|
70
70
|
return MessageStream.createMessage(this, body, options);
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -76,7 +76,10 @@ export class Messages extends APIResource {
|
|
|
76
76
|
* The Token Count API can be used to count the number of tokens in a Message,
|
|
77
77
|
* including tools, images, and documents, without creating it.
|
|
78
78
|
*/
|
|
79
|
-
countTokens(
|
|
79
|
+
countTokens(
|
|
80
|
+
body: MessageCountTokensParams,
|
|
81
|
+
options?: Core.RequestOptions,
|
|
82
|
+
): Core.APIPromise<MessageTokensCount> {
|
|
80
83
|
return this._client.post('/v1/messages/count_tokens', { body, ...options });
|
|
81
84
|
}
|
|
82
85
|
}
|
|
@@ -93,6 +96,100 @@ export interface CacheControlEphemeral {
|
|
|
93
96
|
type: 'ephemeral';
|
|
94
97
|
}
|
|
95
98
|
|
|
99
|
+
export interface CitationCharLocation {
|
|
100
|
+
cited_text: string;
|
|
101
|
+
|
|
102
|
+
document_index: number;
|
|
103
|
+
|
|
104
|
+
document_title: string | null;
|
|
105
|
+
|
|
106
|
+
end_char_index: number;
|
|
107
|
+
|
|
108
|
+
start_char_index: number;
|
|
109
|
+
|
|
110
|
+
type: 'char_location';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface CitationCharLocationParam {
|
|
114
|
+
cited_text: string;
|
|
115
|
+
|
|
116
|
+
document_index: number;
|
|
117
|
+
|
|
118
|
+
document_title: string | null;
|
|
119
|
+
|
|
120
|
+
end_char_index: number;
|
|
121
|
+
|
|
122
|
+
start_char_index: number;
|
|
123
|
+
|
|
124
|
+
type: 'char_location';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface CitationContentBlockLocation {
|
|
128
|
+
cited_text: string;
|
|
129
|
+
|
|
130
|
+
document_index: number;
|
|
131
|
+
|
|
132
|
+
document_title: string | null;
|
|
133
|
+
|
|
134
|
+
end_block_index: number;
|
|
135
|
+
|
|
136
|
+
start_block_index: number;
|
|
137
|
+
|
|
138
|
+
type: 'content_block_location';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface CitationContentBlockLocationParam {
|
|
142
|
+
cited_text: string;
|
|
143
|
+
|
|
144
|
+
document_index: number;
|
|
145
|
+
|
|
146
|
+
document_title: string | null;
|
|
147
|
+
|
|
148
|
+
end_block_index: number;
|
|
149
|
+
|
|
150
|
+
start_block_index: number;
|
|
151
|
+
|
|
152
|
+
type: 'content_block_location';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface CitationPageLocation {
|
|
156
|
+
cited_text: string;
|
|
157
|
+
|
|
158
|
+
document_index: number;
|
|
159
|
+
|
|
160
|
+
document_title: string | null;
|
|
161
|
+
|
|
162
|
+
end_page_number: number;
|
|
163
|
+
|
|
164
|
+
start_page_number: number;
|
|
165
|
+
|
|
166
|
+
type: 'page_location';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface CitationPageLocationParam {
|
|
170
|
+
cited_text: string;
|
|
171
|
+
|
|
172
|
+
document_index: number;
|
|
173
|
+
|
|
174
|
+
document_title: string | null;
|
|
175
|
+
|
|
176
|
+
end_page_number: number;
|
|
177
|
+
|
|
178
|
+
start_page_number: number;
|
|
179
|
+
|
|
180
|
+
type: 'page_location';
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface CitationsConfigParam {
|
|
184
|
+
enabled?: boolean;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface CitationsDelta {
|
|
188
|
+
citation: CitationCharLocation | CitationPageLocation | CitationContentBlockLocation;
|
|
189
|
+
|
|
190
|
+
type: 'citations_delta';
|
|
191
|
+
}
|
|
192
|
+
|
|
96
193
|
export type ContentBlock = TextBlock | ToolUseBlock;
|
|
97
194
|
|
|
98
195
|
export type ContentBlockDeltaEvent = RawContentBlockDeltaEvent;
|
|
@@ -104,16 +201,30 @@ export type ContentBlockParam =
|
|
|
104
201
|
| ToolResultBlockParam
|
|
105
202
|
| DocumentBlockParam;
|
|
106
203
|
|
|
204
|
+
export interface ContentBlockSource {
|
|
205
|
+
content: string | Array<ContentBlockSourceContent>;
|
|
206
|
+
|
|
207
|
+
type: 'content';
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export type ContentBlockSourceContent = TextBlockParam | ImageBlockParam;
|
|
211
|
+
|
|
107
212
|
export type ContentBlockStartEvent = RawContentBlockStartEvent;
|
|
108
213
|
|
|
109
214
|
export type ContentBlockStopEvent = RawContentBlockStopEvent;
|
|
110
215
|
|
|
111
216
|
export interface DocumentBlockParam {
|
|
112
|
-
source: Base64PDFSource;
|
|
217
|
+
source: Base64PDFSource | PlainTextSource | ContentBlockSource;
|
|
113
218
|
|
|
114
219
|
type: 'document';
|
|
115
220
|
|
|
116
221
|
cache_control?: CacheControlEphemeral | null;
|
|
222
|
+
|
|
223
|
+
citations?: CitationsConfigParam;
|
|
224
|
+
|
|
225
|
+
context?: string | null;
|
|
226
|
+
|
|
227
|
+
title?: string | null;
|
|
117
228
|
}
|
|
118
229
|
|
|
119
230
|
export interface ImageBlockParam {
|
|
@@ -306,20 +417,29 @@ export type Model =
|
|
|
306
417
|
| 'claude-2.1'
|
|
307
418
|
| 'claude-2.0';
|
|
308
419
|
|
|
309
|
-
|
|
420
|
+
const DEPRECATED_MODELS: {
|
|
310
421
|
[K in Model]?: string;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const DEPRECATED_MODELS: DeprecatedModelsType = {
|
|
422
|
+
} = {
|
|
314
423
|
'claude-1.3': 'November 6th, 2024',
|
|
315
424
|
'claude-1.3-100k': 'November 6th, 2024',
|
|
316
425
|
'claude-instant-1.1': 'November 6th, 2024',
|
|
317
426
|
'claude-instant-1.1-100k': 'November 6th, 2024',
|
|
318
427
|
'claude-instant-1.2': 'November 6th, 2024',
|
|
428
|
+
'claude-3-sonnet-20240229': 'July 21st, 2025',
|
|
429
|
+
'claude-2.1': 'July 21st, 2025',
|
|
430
|
+
'claude-2.0': 'July 21st, 2025',
|
|
319
431
|
};
|
|
320
432
|
|
|
433
|
+
export interface PlainTextSource {
|
|
434
|
+
data: string;
|
|
435
|
+
|
|
436
|
+
media_type: 'text/plain';
|
|
437
|
+
|
|
438
|
+
type: 'text';
|
|
439
|
+
}
|
|
440
|
+
|
|
321
441
|
export interface RawContentBlockDeltaEvent {
|
|
322
|
-
delta: TextDelta | InputJSONDelta;
|
|
442
|
+
delta: TextDelta | InputJSONDelta | CitationsDelta;
|
|
323
443
|
|
|
324
444
|
index: number;
|
|
325
445
|
|
|
@@ -389,6 +509,15 @@ export type RawMessageStreamEvent =
|
|
|
389
509
|
| RawContentBlockStopEvent;
|
|
390
510
|
|
|
391
511
|
export interface TextBlock {
|
|
512
|
+
/**
|
|
513
|
+
* Citations supporting the text block.
|
|
514
|
+
*
|
|
515
|
+
* The type of citation returned will depend on the type of document being cited.
|
|
516
|
+
* Citing a PDF results in `page_location`, plain text results in `char_location`,
|
|
517
|
+
* and content document results in `content_block_location`.
|
|
518
|
+
*/
|
|
519
|
+
citations: Array<TextCitation> | null;
|
|
520
|
+
|
|
392
521
|
text: string;
|
|
393
522
|
|
|
394
523
|
type: 'text';
|
|
@@ -400,8 +529,17 @@ export interface TextBlockParam {
|
|
|
400
529
|
type: 'text';
|
|
401
530
|
|
|
402
531
|
cache_control?: CacheControlEphemeral | null;
|
|
532
|
+
|
|
533
|
+
citations?: Array<TextCitationParam> | null;
|
|
403
534
|
}
|
|
404
535
|
|
|
536
|
+
export type TextCitation = CitationCharLocation | CitationPageLocation | CitationContentBlockLocation;
|
|
537
|
+
|
|
538
|
+
export type TextCitationParam =
|
|
539
|
+
| CitationCharLocationParam
|
|
540
|
+
| CitationPageLocationParam
|
|
541
|
+
| CitationContentBlockLocationParam;
|
|
542
|
+
|
|
405
543
|
export interface TextDelta {
|
|
406
544
|
text: string;
|
|
407
545
|
|
|
@@ -1059,14 +1197,25 @@ export interface MessageCountTokensParams {
|
|
|
1059
1197
|
}
|
|
1060
1198
|
|
|
1061
1199
|
Messages.Batches = Batches;
|
|
1200
|
+
Messages.MessageBatchesPage = MessageBatchesPage;
|
|
1062
1201
|
|
|
1063
1202
|
export declare namespace Messages {
|
|
1064
1203
|
export {
|
|
1065
1204
|
type Base64PDFSource as Base64PDFSource,
|
|
1066
1205
|
type CacheControlEphemeral as CacheControlEphemeral,
|
|
1206
|
+
type CitationCharLocation as CitationCharLocation,
|
|
1207
|
+
type CitationCharLocationParam as CitationCharLocationParam,
|
|
1208
|
+
type CitationContentBlockLocation as CitationContentBlockLocation,
|
|
1209
|
+
type CitationContentBlockLocationParam as CitationContentBlockLocationParam,
|
|
1210
|
+
type CitationPageLocation as CitationPageLocation,
|
|
1211
|
+
type CitationPageLocationParam as CitationPageLocationParam,
|
|
1212
|
+
type CitationsConfigParam as CitationsConfigParam,
|
|
1213
|
+
type CitationsDelta as CitationsDelta,
|
|
1067
1214
|
type ContentBlock as ContentBlock,
|
|
1068
1215
|
type ContentBlockDeltaEvent as ContentBlockDeltaEvent,
|
|
1069
1216
|
type ContentBlockParam as ContentBlockParam,
|
|
1217
|
+
type ContentBlockSource as ContentBlockSource,
|
|
1218
|
+
type ContentBlockSourceContent as ContentBlockSourceContent,
|
|
1070
1219
|
type ContentBlockStartEvent as ContentBlockStartEvent,
|
|
1071
1220
|
type ContentBlockStopEvent as ContentBlockStopEvent,
|
|
1072
1221
|
type DocumentBlockParam as DocumentBlockParam,
|
|
@@ -1083,6 +1232,7 @@ export declare namespace Messages {
|
|
|
1083
1232
|
type MessageTokensCount as MessageTokensCount,
|
|
1084
1233
|
type Metadata as Metadata,
|
|
1085
1234
|
type Model as Model,
|
|
1235
|
+
type PlainTextSource as PlainTextSource,
|
|
1086
1236
|
type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent,
|
|
1087
1237
|
type RawContentBlockStartEvent as RawContentBlockStartEvent,
|
|
1088
1238
|
type RawContentBlockStopEvent as RawContentBlockStopEvent,
|
|
@@ -1092,6 +1242,8 @@ export declare namespace Messages {
|
|
|
1092
1242
|
type RawMessageStreamEvent as RawMessageStreamEvent,
|
|
1093
1243
|
type TextBlock as TextBlock,
|
|
1094
1244
|
type TextBlockParam as TextBlockParam,
|
|
1245
|
+
type TextCitation as TextCitation,
|
|
1246
|
+
type TextCitationParam as TextCitationParam,
|
|
1095
1247
|
type TextDelta as TextDelta,
|
|
1096
1248
|
type Tool as Tool,
|
|
1097
1249
|
type ToolChoice as ToolChoice,
|
|
@@ -1120,7 +1272,7 @@ export declare namespace Messages {
|
|
|
1120
1272
|
type MessageBatchRequestCounts as MessageBatchRequestCounts,
|
|
1121
1273
|
type MessageBatchResult as MessageBatchResult,
|
|
1122
1274
|
type MessageBatchSucceededResult as MessageBatchSucceededResult,
|
|
1123
|
-
|
|
1275
|
+
MessageBatchesPage as MessageBatchesPage,
|
|
1124
1276
|
type BatchCreateParams as BatchCreateParams,
|
|
1125
1277
|
type BatchListParams as BatchListParams,
|
|
1126
1278
|
};
|