@anthropic-ai/sdk 0.33.0 → 0.34.0-alpha.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 +13 -0
- package/README.md +15 -11
- package/_vendor/partial-json-parser/parser.d.mts +3 -0
- package/_vendor/partial-json-parser/parser.d.mts.map +1 -0
- package/api-promise.d.mts +48 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +48 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +71 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +67 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +212 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +212 -0
- package/client.d.ts.map +1 -0
- package/client.js +505 -0
- package/client.js.map +1 -0
- package/client.mjs +477 -0
- package/client.mjs.map +1 -0
- package/error.d.mts +48 -0
- package/error.d.mts.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 +5 -150
- package/index.d.mts.map +1 -0
- package/index.d.ts +5 -150
- package/index.d.ts.map +1 -1
- package/index.js +18 -159
- package/index.js.map +1 -1
- package/index.mjs +5 -133
- package/index.mjs.map +1 -1
- package/internal/builtin-types.d.mts +65 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +65 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/decoders/jsonl.d.mts +11 -0
- package/internal/decoders/jsonl.d.mts.map +1 -0
- package/internal/decoders/jsonl.d.ts +0 -1
- package/internal/decoders/jsonl.d.ts.map +1 -1
- package/internal/decoders/jsonl.js.map +1 -1
- package/internal/decoders/jsonl.mjs.map +1 -1
- package/internal/decoders/line.d.mts +21 -0
- package/internal/decoders/line.d.mts.map +1 -0
- package/internal/decoders/line.d.ts +1 -0
- package/internal/decoders/line.d.ts.map +1 -1
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +22 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +17 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +21 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +21 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +77 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +72 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +14 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +14 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +48 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +43 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/polyfill/crypto.node.d.ts +10 -0
- package/internal/polyfill/crypto.node.js +11 -0
- package/internal/polyfill/crypto.node.mjs +2 -0
- package/internal/polyfill/file.node.d.ts +9 -0
- package/internal/polyfill/file.node.js +17 -0
- package/internal/polyfill/file.node.mjs +9 -0
- package/internal/request-options.d.mts +37 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +37 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +40 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +35 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +28 -0
- package/internal/shim-types.d.ts +28 -0
- package/internal/shims.d.mts +65 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +65 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +66 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +58 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/types.d.mts +6 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +6 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +33 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +28 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +2 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +2 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +12 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +8 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +15 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +11 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +15 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +15 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +100 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +84 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/{_shims/auto/runtime-bun.js → internal/utils.js} +8 -5
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/lib/MessageStream.d.mts +95 -0
- package/lib/MessageStream.d.mts.map +1 -0
- package/lib/MessageStream.d.ts +7 -7
- package/lib/MessageStream.d.ts.map +1 -1
- package/lib/MessageStream.js +2 -2
- package/lib/MessageStream.js.map +1 -1
- package/lib/MessageStream.mjs +2 -2
- package/lib/MessageStream.mjs.map +1 -1
- package/package.json +120 -64
- package/pagination.d.mts +63 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +41 -4
- package/pagination.d.ts.map +1 -1
- package/pagination.js +95 -21
- package/pagination.js.map +1 -1
- package/pagination.mjs +91 -19
- package/pagination.mjs.map +1 -1
- package/resource.d.mts +6 -0
- package/resource.d.mts.map +1 -0
- 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.mts +57 -0
- package/resources/beta/beta.d.mts.map +1 -0
- package/resources/beta/beta.d.ts +1 -1
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +0 -1
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +1 -2
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.mts +4 -0
- package/resources/beta/index.d.mts.map +1 -0
- package/resources/beta/index.d.ts +1 -1
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +3 -4
- 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.mts +261 -0
- package/resources/beta/messages/batches.d.mts.map +1 -0
- package/resources/beta/messages/batches.d.ts +33 -13
- package/resources/beta/messages/batches.d.ts.map +1 -1
- package/resources/beta/messages/batches.js +54 -29
- package/resources/beta/messages/batches.js.map +1 -1
- package/resources/beta/messages/batches.mjs +53 -27
- package/resources/beta/messages/batches.mjs.map +1 -1
- package/resources/beta/messages/index.d.mts +3 -0
- package/resources/beta/messages/index.d.mts.map +1 -0
- package/resources/beta/messages/index.d.ts +1 -1
- package/resources/beta/messages/index.d.ts.map +1 -1
- package/resources/beta/messages/index.js +1 -2
- 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.mts +879 -0
- package/resources/beta/messages/messages.d.mts.map +1 -0
- package/resources/beta/messages/messages.d.ts +8 -8
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js +0 -1
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs +1 -2
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/models.d.mts +48 -0
- package/resources/beta/models.d.mts.map +1 -0
- package/resources/beta/models.d.ts +7 -8
- package/resources/beta/models.d.ts.map +1 -1
- package/resources/beta/models.js +10 -12
- package/resources/beta/models.js.map +1 -1
- package/resources/beta/models.mjs +9 -10
- package/resources/beta/models.mjs.map +1 -1
- package/resources/completions.d.mts +166 -0
- package/resources/completions.d.mts.map +1 -0
- 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.mts +6 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +1 -2
- 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.mts +229 -0
- package/resources/messages/batches.d.mts.map +1 -0
- package/resources/messages/batches.d.ts +27 -10
- package/resources/messages/batches.d.ts.map +1 -1
- package/resources/messages/batches.js +20 -16
- package/resources/messages/batches.js.map +1 -1
- package/resources/messages/batches.mjs +19 -14
- package/resources/messages/batches.mjs.map +1 -1
- package/resources/messages/index.d.mts +3 -0
- package/resources/messages/index.d.mts.map +1 -0
- package/resources/messages/index.d.ts +1 -1
- package/resources/messages/index.d.ts.map +1 -1
- package/resources/messages/index.js +1 -2
- 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.mts +859 -0
- package/resources/messages/messages.d.mts.map +1 -0
- package/resources/messages/messages.d.ts +9 -9
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +0 -1
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +1 -2
- package/resources/messages/messages.mjs.map +1 -1
- package/resources/models.d.mts +48 -0
- package/resources/models.d.mts.map +1 -0
- package/resources/models.d.ts +7 -8
- package/resources/models.d.ts.map +1 -1
- package/resources/models.js +10 -12
- package/resources/models.js.map +1 -1
- package/resources/models.mjs +9 -10
- package/resources/models.mjs.map +1 -1
- package/resources/shared.d.mts +42 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/top-level.d.mts +2 -0
- package/resources/top-level.d.mts.map +1 -0
- package/src/api-promise.ts +93 -0
- package/src/client.ts +863 -0
- package/src/error.ts +3 -3
- package/src/index.ts +12 -406
- package/src/internal/builtin-types.ts +79 -0
- package/src/internal/decoders/jsonl.ts +3 -4
- package/src/internal/decoders/line.ts +1 -1
- package/src/internal/detect-platform.ts +192 -0
- package/src/internal/errors.ts +18 -0
- package/src/internal/headers.ts +96 -0
- package/src/internal/parse.ts +70 -0
- package/src/internal/polyfill/crypto.node.d.ts +10 -0
- package/src/internal/polyfill/crypto.node.js +11 -0
- package/src/internal/polyfill/crypto.node.mjs +2 -0
- package/src/internal/polyfill/file.node.d.ts +9 -0
- package/src/internal/polyfill/file.node.js +17 -0
- package/src/internal/polyfill/file.node.mjs +9 -0
- package/src/internal/request-options.ts +71 -0
- package/src/internal/shim-types.d.ts +28 -0
- package/src/internal/shims.ts +124 -0
- package/src/internal/types.ts +6 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/env.ts +20 -0
- package/src/internal/utils/log.ts +9 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +13 -0
- package/src/internal/utils/values.ts +94 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/MessageStream.ts +9 -9
- package/src/pagination.ts +122 -18
- package/src/resource.ts +3 -3
- package/src/resources/beta/beta.ts +6 -7
- package/src/resources/beta/index.ts +3 -3
- package/src/resources/beta/messages/batches.ts +76 -74
- package/src/resources/beta/messages/index.ts +5 -3
- package/src/resources/beta/messages/messages.ts +20 -17
- package/src/resources/beta/models.ts +12 -22
- package/src/resources/completions.ts +10 -13
- package/src/resources/index.ts +5 -5
- package/src/resources/messages/batches.ts +46 -32
- package/src/resources/messages/index.ts +4 -3
- package/src/resources/messages/messages.ts +18 -20
- package/src/resources/models.ts +12 -19
- package/src/streaming.ts +7 -12
- package/src/tsconfig.json +1 -1
- package/src/uploads.ts +57 -54
- package/src/version.ts +1 -1
- package/streaming.d.mts +41 -0
- package/streaming.d.mts.map +1 -0
- package/streaming.d.ts +1 -1
- package/streaming.d.ts.map +1 -1
- package/streaming.js +3 -4
- package/streaming.js.map +1 -1
- package/streaming.mjs +3 -4
- package/streaming.mjs.map +1 -1
- package/uploads.d.mts +79 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +23 -19
- package/uploads.d.ts.map +1 -1
- package/uploads.js +33 -27
- package/uploads.js.map +1 -1
- package/uploads.mjs +29 -21
- package/uploads.mjs.map +1 -1
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- 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/_shims/MultipartBody.d.ts +0 -9
- package/_shims/MultipartBody.d.ts.map +0 -1
- package/_shims/MultipartBody.js +0 -16
- package/_shims/MultipartBody.js.map +0 -1
- package/_shims/MultipartBody.mjs +0 -12
- package/_shims/MultipartBody.mjs.map +0 -1
- package/_shims/README.md +0 -46
- package/_shims/auto/runtime-bun.d.ts +0 -5
- package/_shims/auto/runtime-bun.d.ts.map +0 -1
- package/_shims/auto/runtime-bun.js.map +0 -1
- package/_shims/auto/runtime-bun.mjs +0 -2
- package/_shims/auto/runtime-bun.mjs.map +0 -1
- package/_shims/auto/runtime-node.d.ts +0 -5
- package/_shims/auto/runtime-node.d.ts.map +0 -1
- package/_shims/auto/runtime-node.js +0 -21
- package/_shims/auto/runtime-node.js.map +0 -1
- package/_shims/auto/runtime-node.mjs +0 -2
- package/_shims/auto/runtime-node.mjs.map +0 -1
- package/_shims/auto/runtime.d.ts +0 -5
- package/_shims/auto/runtime.d.ts.map +0 -1
- package/_shims/auto/runtime.js +0 -21
- package/_shims/auto/runtime.js.map +0 -1
- package/_shims/auto/runtime.mjs +0 -2
- package/_shims/auto/runtime.mjs.map +0 -1
- package/_shims/auto/types-node.d.ts +0 -5
- package/_shims/auto/types-node.d.ts.map +0 -1
- package/_shims/auto/types-node.js +0 -21
- package/_shims/auto/types-node.js.map +0 -1
- package/_shims/auto/types-node.mjs +0 -2
- package/_shims/auto/types-node.mjs.map +0 -1
- package/_shims/auto/types.d.ts +0 -101
- package/_shims/auto/types.js +0 -3
- package/_shims/auto/types.mjs +0 -3
- package/_shims/bun-runtime.d.ts +0 -6
- package/_shims/bun-runtime.d.ts.map +0 -1
- package/_shims/bun-runtime.js +0 -14
- package/_shims/bun-runtime.js.map +0 -1
- package/_shims/bun-runtime.mjs +0 -10
- package/_shims/bun-runtime.mjs.map +0 -1
- package/_shims/index.d.ts +0 -81
- package/_shims/index.js +0 -13
- package/_shims/index.mjs +0 -7
- package/_shims/manual-types.d.ts +0 -12
- package/_shims/manual-types.js +0 -3
- package/_shims/manual-types.mjs +0 -3
- package/_shims/node-runtime.d.ts +0 -3
- package/_shims/node-runtime.d.ts.map +0 -1
- package/_shims/node-runtime.js +0 -89
- package/_shims/node-runtime.js.map +0 -1
- package/_shims/node-runtime.mjs +0 -56
- package/_shims/node-runtime.mjs.map +0 -1
- package/_shims/node-types.d.ts +0 -42
- package/_shims/node-types.js +0 -3
- package/_shims/node-types.mjs +0 -3
- package/_shims/registry.d.ts +0 -37
- package/_shims/registry.d.ts.map +0 -1
- package/_shims/registry.js +0 -41
- package/_shims/registry.js.map +0 -1
- package/_shims/registry.mjs +0 -37
- package/_shims/registry.mjs.map +0 -1
- package/_shims/web-runtime.d.ts +0 -5
- package/_shims/web-runtime.d.ts.map +0 -1
- package/_shims/web-runtime.js +0 -78
- package/_shims/web-runtime.js.map +0 -1
- package/_shims/web-runtime.mjs +0 -71
- package/_shims/web-runtime.mjs.map +0 -1
- package/_shims/web-types.d.ts +0 -83
- package/_shims/web-types.js +0 -3
- package/_shims/web-types.mjs +0 -3
- package/core.d.ts +0 -248
- package/core.d.ts.map +0 -1
- package/core.js +0 -920
- package/core.js.map +0 -1
- package/core.mjs +0 -888
- package/core.mjs.map +0 -1
- package/shims/node.d.ts +0 -30
- package/shims/node.d.ts.map +0 -1
- package/shims/node.js +0 -31
- package/shims/node.js.map +0 -1
- package/shims/node.mjs +0 -5
- package/shims/node.mjs.map +0 -1
- package/shims/web.d.ts +0 -26
- package/shims/web.d.ts.map +0 -1
- package/shims/web.js +0 -31
- package/shims/web.js.map +0 -1
- package/shims/web.mjs +0 -5
- package/shims/web.mjs.map +0 -1
- package/src/_shims/MultipartBody.ts +0 -9
- package/src/_shims/README.md +0 -46
- package/src/_shims/auto/runtime-bun.ts +0 -4
- package/src/_shims/auto/runtime-node.ts +0 -4
- package/src/_shims/auto/runtime.ts +0 -4
- package/src/_shims/auto/types-node.ts +0 -4
- package/src/_shims/auto/types.d.ts +0 -101
- package/src/_shims/auto/types.js +0 -3
- package/src/_shims/auto/types.mjs +0 -3
- package/src/_shims/bun-runtime.ts +0 -14
- package/src/_shims/index.d.ts +0 -81
- package/src/_shims/index.js +0 -13
- package/src/_shims/index.mjs +0 -7
- package/src/_shims/manual-types.d.ts +0 -12
- package/src/_shims/manual-types.js +0 -3
- package/src/_shims/manual-types.mjs +0 -3
- package/src/_shims/node-runtime.ts +0 -81
- package/src/_shims/node-types.d.ts +0 -42
- package/src/_shims/node-types.js +0 -3
- package/src/_shims/node-types.mjs +0 -3
- package/src/_shims/registry.ts +0 -67
- package/src/_shims/web-runtime.ts +0 -103
- package/src/_shims/web-types.d.ts +0 -83
- package/src/_shims/web-types.js +0 -3
- package/src/_shims/web-types.mjs +0 -3
- package/src/core.ts +0 -1232
- package/src/shims/node.ts +0 -50
- package/src/shims/web.ts +0 -50
package/error.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.mjs","sourceRoot":"","sources":["src/error.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"error.mjs","sourceRoot":"","sources":["src/error.ts"],"names":[],"mappings":"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"}
|
package/index.d.mts
CHANGED
|
@@ -1,152 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import * as Uploads from "./uploads.js";
|
|
7
|
-
import * as API from "./resources/index.js";
|
|
8
|
-
import { Completion, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, Completions } from "./resources/completions.js";
|
|
9
|
-
import { ModelInfo, ModelInfosPage, ModelListParams, Models } from "./resources/models.js";
|
|
10
|
-
import { AnthropicBeta, Beta, BetaAPIError, BetaAuthenticationError, BetaBillingError, BetaError, BetaErrorResponse, BetaGatewayTimeoutError, BetaInvalidRequestError, BetaNotFoundError, BetaOverloadedError, BetaPermissionError, BetaRateLimitError } from "./resources/beta/beta.js";
|
|
11
|
-
import { Base64PDFSource, CacheControlEphemeral, ContentBlock, ContentBlockDeltaEvent, ContentBlockParam, ContentBlockStartEvent, ContentBlockStopEvent, DocumentBlockParam, ImageBlockParam, InputJSONDelta, Message, MessageCountTokensParams, MessageCreateParams, MessageCreateParamsNonStreaming, MessageCreateParamsStreaming, MessageDeltaEvent, MessageDeltaUsage, MessageParam, MessageStartEvent, MessageStopEvent, MessageStreamEvent, MessageStreamParams, MessageTokensCount, Messages, Metadata, Model, RawContentBlockDeltaEvent, RawContentBlockStartEvent, RawContentBlockStopEvent, RawMessageDeltaEvent, RawMessageStartEvent, RawMessageStopEvent, RawMessageStreamEvent, TextBlock, TextBlockParam, TextDelta, Tool, ToolChoice, ToolChoiceAny, ToolChoiceAuto, ToolChoiceTool, ToolResultBlockParam, ToolUseBlock, ToolUseBlockParam, Usage } from "./resources/messages/messages.js";
|
|
12
|
-
export interface ClientOptions {
|
|
13
|
-
/**
|
|
14
|
-
* Defaults to process.env['ANTHROPIC_API_KEY'].
|
|
15
|
-
*/
|
|
16
|
-
apiKey?: string | null | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Defaults to process.env['ANTHROPIC_AUTH_TOKEN'].
|
|
19
|
-
*/
|
|
20
|
-
authToken?: string | null | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
23
|
-
*
|
|
24
|
-
* Defaults to process.env['ANTHROPIC_BASE_URL'].
|
|
25
|
-
*/
|
|
26
|
-
baseURL?: string | null | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
29
|
-
* from the server before timing out a single request.
|
|
30
|
-
*
|
|
31
|
-
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
32
|
-
* much longer than this timeout before the promise succeeds or fails.
|
|
33
|
-
*/
|
|
34
|
-
timeout?: number;
|
|
35
|
-
/**
|
|
36
|
-
* An HTTP agent used to manage HTTP(S) connections.
|
|
37
|
-
*
|
|
38
|
-
* If not provided, an agent will be constructed by default in the Node.js environment,
|
|
39
|
-
* otherwise no agent is used.
|
|
40
|
-
*/
|
|
41
|
-
httpAgent?: Agent;
|
|
42
|
-
/**
|
|
43
|
-
* Specify a custom `fetch` function implementation.
|
|
44
|
-
*
|
|
45
|
-
* If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
|
|
46
|
-
* defined globally.
|
|
47
|
-
*/
|
|
48
|
-
fetch?: Core.Fetch | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* The maximum number of times that the client will retry a request in case of a
|
|
51
|
-
* temporary failure, like a network error or a 5XX error from the server.
|
|
52
|
-
*
|
|
53
|
-
* @default 2
|
|
54
|
-
*/
|
|
55
|
-
maxRetries?: number;
|
|
56
|
-
/**
|
|
57
|
-
* Default headers to include with every request to the API.
|
|
58
|
-
*
|
|
59
|
-
* These can be removed in individual requests by explicitly setting the
|
|
60
|
-
* header to `undefined` or `null` in request options.
|
|
61
|
-
*/
|
|
62
|
-
defaultHeaders?: Core.Headers;
|
|
63
|
-
/**
|
|
64
|
-
* Default query parameters to include with every request to the API.
|
|
65
|
-
*
|
|
66
|
-
* These can be removed in individual requests by explicitly setting the
|
|
67
|
-
* param to `undefined` in request options.
|
|
68
|
-
*/
|
|
69
|
-
defaultQuery?: Core.DefaultQuery;
|
|
70
|
-
/**
|
|
71
|
-
* By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
72
|
-
* Only set this option to `true` if you understand the risks and have appropriate mitigations in place.
|
|
73
|
-
*/
|
|
74
|
-
dangerouslyAllowBrowser?: boolean;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* API Client for interfacing with the Anthropic API.
|
|
78
|
-
*/
|
|
79
|
-
export declare class Anthropic extends Core.APIClient {
|
|
80
|
-
apiKey: string | null;
|
|
81
|
-
authToken: string | null;
|
|
82
|
-
private _options;
|
|
83
|
-
/**
|
|
84
|
-
* API Client for interfacing with the Anthropic API.
|
|
85
|
-
*
|
|
86
|
-
* @param {string | null | undefined} [opts.apiKey=process.env['ANTHROPIC_API_KEY'] ?? null]
|
|
87
|
-
* @param {string | null | undefined} [opts.authToken=process.env['ANTHROPIC_AUTH_TOKEN'] ?? null]
|
|
88
|
-
* @param {string} [opts.baseURL=process.env['ANTHROPIC_BASE_URL'] ?? https://api.anthropic.com] - Override the default base URL for the API.
|
|
89
|
-
* @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
90
|
-
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
91
|
-
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
92
|
-
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
93
|
-
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
94
|
-
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
95
|
-
* @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
96
|
-
*/
|
|
97
|
-
constructor({ baseURL, apiKey, authToken, ...opts }?: ClientOptions);
|
|
98
|
-
completions: API.Completions;
|
|
99
|
-
messages: API.Messages;
|
|
100
|
-
models: API.Models;
|
|
101
|
-
beta: API.Beta;
|
|
102
|
-
protected defaultQuery(): Core.DefaultQuery | undefined;
|
|
103
|
-
protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
104
|
-
protected validateHeaders(headers: Core.Headers, customHeaders: Core.Headers): void;
|
|
105
|
-
protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
106
|
-
protected apiKeyAuth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
107
|
-
protected bearerAuth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
108
|
-
static Anthropic: typeof Anthropic;
|
|
109
|
-
static HUMAN_PROMPT: string;
|
|
110
|
-
static AI_PROMPT: string;
|
|
111
|
-
static DEFAULT_TIMEOUT: number;
|
|
112
|
-
static AnthropicError: typeof Errors.AnthropicError;
|
|
113
|
-
static APIError: typeof Errors.APIError;
|
|
114
|
-
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
115
|
-
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
116
|
-
static APIUserAbortError: typeof Errors.APIUserAbortError;
|
|
117
|
-
static NotFoundError: typeof Errors.NotFoundError;
|
|
118
|
-
static ConflictError: typeof Errors.ConflictError;
|
|
119
|
-
static RateLimitError: typeof Errors.RateLimitError;
|
|
120
|
-
static BadRequestError: typeof Errors.BadRequestError;
|
|
121
|
-
static AuthenticationError: typeof Errors.AuthenticationError;
|
|
122
|
-
static InternalServerError: typeof Errors.InternalServerError;
|
|
123
|
-
static PermissionDeniedError: typeof Errors.PermissionDeniedError;
|
|
124
|
-
static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
|
|
125
|
-
static toFile: typeof Uploads.toFile;
|
|
126
|
-
static fileFromPath: typeof Uploads.fileFromPath;
|
|
127
|
-
}
|
|
128
|
-
export declare namespace Anthropic {
|
|
129
|
-
export type RequestOptions = Core.RequestOptions;
|
|
130
|
-
export import Page = Pagination.Page;
|
|
131
|
-
export { type PageParams as PageParams, type PageResponse as PageResponse };
|
|
132
|
-
export { Completions as Completions, type Completion as Completion, type CompletionCreateParams as CompletionCreateParams, type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, };
|
|
133
|
-
export { Messages as Messages, type Base64PDFSource as Base64PDFSource, type CacheControlEphemeral as CacheControlEphemeral, type ContentBlock as ContentBlock, type ContentBlockDeltaEvent as ContentBlockDeltaEvent, type ContentBlockParam as ContentBlockParam, type ContentBlockStartEvent as ContentBlockStartEvent, type ContentBlockStopEvent as ContentBlockStopEvent, type DocumentBlockParam as DocumentBlockParam, type ImageBlockParam as ImageBlockParam, type InputJSONDelta as InputJSONDelta, type Message as Message, type MessageDeltaEvent as MessageDeltaEvent, type MessageDeltaUsage as MessageDeltaUsage, type MessageParam as MessageParam, type MessageStartEvent as MessageStartEvent, type MessageStopEvent as MessageStopEvent, type MessageStreamEvent as MessageStreamEvent, type MessageTokensCount as MessageTokensCount, type Metadata as Metadata, type Model as Model, type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent, type RawContentBlockStartEvent as RawContentBlockStartEvent, type RawContentBlockStopEvent as RawContentBlockStopEvent, type RawMessageDeltaEvent as RawMessageDeltaEvent, type RawMessageStartEvent as RawMessageStartEvent, type RawMessageStopEvent as RawMessageStopEvent, type RawMessageStreamEvent as RawMessageStreamEvent, type TextBlock as TextBlock, type TextBlockParam as TextBlockParam, type TextDelta as TextDelta, type Tool as Tool, type ToolChoice as ToolChoice, type ToolChoiceAny as ToolChoiceAny, type ToolChoiceAuto as ToolChoiceAuto, type ToolChoiceTool as ToolChoiceTool, type ToolResultBlockParam as ToolResultBlockParam, type ToolUseBlock as ToolUseBlock, type ToolUseBlockParam as ToolUseBlockParam, type Usage as Usage, type MessageCreateParams as MessageCreateParams, type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming, type MessageCreateParamsStreaming as MessageCreateParamsStreaming, type MessageStreamParams as MessageStreamParams, type MessageCountTokensParams as MessageCountTokensParams, };
|
|
134
|
-
export { Models as Models, type ModelInfo as ModelInfo, ModelInfosPage as ModelInfosPage, type ModelListParams as ModelListParams, };
|
|
135
|
-
export { Beta as Beta, type AnthropicBeta as AnthropicBeta, type BetaAPIError as BetaAPIError, type BetaAuthenticationError as BetaAuthenticationError, type BetaBillingError as BetaBillingError, type BetaError as BetaError, type BetaErrorResponse as BetaErrorResponse, type BetaGatewayTimeoutError as BetaGatewayTimeoutError, type BetaInvalidRequestError as BetaInvalidRequestError, type BetaNotFoundError as BetaNotFoundError, type BetaOverloadedError as BetaOverloadedError, type BetaPermissionError as BetaPermissionError, type BetaRateLimitError as BetaRateLimitError, };
|
|
136
|
-
export type APIErrorObject = API.APIErrorObject;
|
|
137
|
-
export type AuthenticationError = API.AuthenticationError;
|
|
138
|
-
export type BillingError = API.BillingError;
|
|
139
|
-
export type ErrorObject = API.ErrorObject;
|
|
140
|
-
export type ErrorResponse = API.ErrorResponse;
|
|
141
|
-
export type GatewayTimeoutError = API.GatewayTimeoutError;
|
|
142
|
-
export type InvalidRequestError = API.InvalidRequestError;
|
|
143
|
-
export type NotFoundError = API.NotFoundError;
|
|
144
|
-
export type OverloadedError = API.OverloadedError;
|
|
145
|
-
export type PermissionError = API.PermissionError;
|
|
146
|
-
export type RateLimitError = API.RateLimitError;
|
|
147
|
-
}
|
|
148
|
-
export declare const HUMAN_PROMPT: string, AI_PROMPT: string;
|
|
149
|
-
export { toFile, fileFromPath } from "./uploads.js";
|
|
1
|
+
export { Anthropic as default } from "./client.js";
|
|
2
|
+
export { multipartFormRequestOptions, maybeMultipartFormRequestOptions, Uploadable, createForm, toFile, } from "./uploads.js";
|
|
3
|
+
export { APIPromise } from "./api-promise.js";
|
|
4
|
+
export { BaseAnthropic, Anthropic, ClientOptions, HUMAN_PROMPT, AI_PROMPT } from "./client.js";
|
|
5
|
+
export { PagePromise } from "./pagination.js";
|
|
150
6
|
export { AnthropicError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js";
|
|
151
|
-
export default Anthropic;
|
|
152
7
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,IAAI,OAAO,EAAE;OAExB,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,UAAU,EACV,UAAU,EACV,MAAM,GACP;OACM,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE;OACpE,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/index.d.ts
CHANGED
|
@@ -1,152 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import * as Uploads from "./uploads.js";
|
|
7
|
-
import * as API from "./resources/index.js";
|
|
8
|
-
import { Completion, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, Completions } from "./resources/completions.js";
|
|
9
|
-
import { ModelInfo, ModelInfosPage, ModelListParams, Models } from "./resources/models.js";
|
|
10
|
-
import { AnthropicBeta, Beta, BetaAPIError, BetaAuthenticationError, BetaBillingError, BetaError, BetaErrorResponse, BetaGatewayTimeoutError, BetaInvalidRequestError, BetaNotFoundError, BetaOverloadedError, BetaPermissionError, BetaRateLimitError } from "./resources/beta/beta.js";
|
|
11
|
-
import { Base64PDFSource, CacheControlEphemeral, ContentBlock, ContentBlockDeltaEvent, ContentBlockParam, ContentBlockStartEvent, ContentBlockStopEvent, DocumentBlockParam, ImageBlockParam, InputJSONDelta, Message, MessageCountTokensParams, MessageCreateParams, MessageCreateParamsNonStreaming, MessageCreateParamsStreaming, MessageDeltaEvent, MessageDeltaUsage, MessageParam, MessageStartEvent, MessageStopEvent, MessageStreamEvent, MessageStreamParams, MessageTokensCount, Messages, Metadata, Model, RawContentBlockDeltaEvent, RawContentBlockStartEvent, RawContentBlockStopEvent, RawMessageDeltaEvent, RawMessageStartEvent, RawMessageStopEvent, RawMessageStreamEvent, TextBlock, TextBlockParam, TextDelta, Tool, ToolChoice, ToolChoiceAny, ToolChoiceAuto, ToolChoiceTool, ToolResultBlockParam, ToolUseBlock, ToolUseBlockParam, Usage } from "./resources/messages/messages.js";
|
|
12
|
-
export interface ClientOptions {
|
|
13
|
-
/**
|
|
14
|
-
* Defaults to process.env['ANTHROPIC_API_KEY'].
|
|
15
|
-
*/
|
|
16
|
-
apiKey?: string | null | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Defaults to process.env['ANTHROPIC_AUTH_TOKEN'].
|
|
19
|
-
*/
|
|
20
|
-
authToken?: string | null | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
23
|
-
*
|
|
24
|
-
* Defaults to process.env['ANTHROPIC_BASE_URL'].
|
|
25
|
-
*/
|
|
26
|
-
baseURL?: string | null | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
29
|
-
* from the server before timing out a single request.
|
|
30
|
-
*
|
|
31
|
-
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
32
|
-
* much longer than this timeout before the promise succeeds or fails.
|
|
33
|
-
*/
|
|
34
|
-
timeout?: number;
|
|
35
|
-
/**
|
|
36
|
-
* An HTTP agent used to manage HTTP(S) connections.
|
|
37
|
-
*
|
|
38
|
-
* If not provided, an agent will be constructed by default in the Node.js environment,
|
|
39
|
-
* otherwise no agent is used.
|
|
40
|
-
*/
|
|
41
|
-
httpAgent?: Agent;
|
|
42
|
-
/**
|
|
43
|
-
* Specify a custom `fetch` function implementation.
|
|
44
|
-
*
|
|
45
|
-
* If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
|
|
46
|
-
* defined globally.
|
|
47
|
-
*/
|
|
48
|
-
fetch?: Core.Fetch | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* The maximum number of times that the client will retry a request in case of a
|
|
51
|
-
* temporary failure, like a network error or a 5XX error from the server.
|
|
52
|
-
*
|
|
53
|
-
* @default 2
|
|
54
|
-
*/
|
|
55
|
-
maxRetries?: number;
|
|
56
|
-
/**
|
|
57
|
-
* Default headers to include with every request to the API.
|
|
58
|
-
*
|
|
59
|
-
* These can be removed in individual requests by explicitly setting the
|
|
60
|
-
* header to `undefined` or `null` in request options.
|
|
61
|
-
*/
|
|
62
|
-
defaultHeaders?: Core.Headers;
|
|
63
|
-
/**
|
|
64
|
-
* Default query parameters to include with every request to the API.
|
|
65
|
-
*
|
|
66
|
-
* These can be removed in individual requests by explicitly setting the
|
|
67
|
-
* param to `undefined` in request options.
|
|
68
|
-
*/
|
|
69
|
-
defaultQuery?: Core.DefaultQuery;
|
|
70
|
-
/**
|
|
71
|
-
* By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
72
|
-
* Only set this option to `true` if you understand the risks and have appropriate mitigations in place.
|
|
73
|
-
*/
|
|
74
|
-
dangerouslyAllowBrowser?: boolean;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* API Client for interfacing with the Anthropic API.
|
|
78
|
-
*/
|
|
79
|
-
export declare class Anthropic extends Core.APIClient {
|
|
80
|
-
apiKey: string | null;
|
|
81
|
-
authToken: string | null;
|
|
82
|
-
private _options;
|
|
83
|
-
/**
|
|
84
|
-
* API Client for interfacing with the Anthropic API.
|
|
85
|
-
*
|
|
86
|
-
* @param {string | null | undefined} [opts.apiKey=process.env['ANTHROPIC_API_KEY'] ?? null]
|
|
87
|
-
* @param {string | null | undefined} [opts.authToken=process.env['ANTHROPIC_AUTH_TOKEN'] ?? null]
|
|
88
|
-
* @param {string} [opts.baseURL=process.env['ANTHROPIC_BASE_URL'] ?? https://api.anthropic.com] - Override the default base URL for the API.
|
|
89
|
-
* @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
90
|
-
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
91
|
-
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
92
|
-
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
93
|
-
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
94
|
-
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
95
|
-
* @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
96
|
-
*/
|
|
97
|
-
constructor({ baseURL, apiKey, authToken, ...opts }?: ClientOptions);
|
|
98
|
-
completions: API.Completions;
|
|
99
|
-
messages: API.Messages;
|
|
100
|
-
models: API.Models;
|
|
101
|
-
beta: API.Beta;
|
|
102
|
-
protected defaultQuery(): Core.DefaultQuery | undefined;
|
|
103
|
-
protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
104
|
-
protected validateHeaders(headers: Core.Headers, customHeaders: Core.Headers): void;
|
|
105
|
-
protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
106
|
-
protected apiKeyAuth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
107
|
-
protected bearerAuth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
108
|
-
static Anthropic: typeof Anthropic;
|
|
109
|
-
static HUMAN_PROMPT: string;
|
|
110
|
-
static AI_PROMPT: string;
|
|
111
|
-
static DEFAULT_TIMEOUT: number;
|
|
112
|
-
static AnthropicError: typeof Errors.AnthropicError;
|
|
113
|
-
static APIError: typeof Errors.APIError;
|
|
114
|
-
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
115
|
-
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
116
|
-
static APIUserAbortError: typeof Errors.APIUserAbortError;
|
|
117
|
-
static NotFoundError: typeof Errors.NotFoundError;
|
|
118
|
-
static ConflictError: typeof Errors.ConflictError;
|
|
119
|
-
static RateLimitError: typeof Errors.RateLimitError;
|
|
120
|
-
static BadRequestError: typeof Errors.BadRequestError;
|
|
121
|
-
static AuthenticationError: typeof Errors.AuthenticationError;
|
|
122
|
-
static InternalServerError: typeof Errors.InternalServerError;
|
|
123
|
-
static PermissionDeniedError: typeof Errors.PermissionDeniedError;
|
|
124
|
-
static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
|
|
125
|
-
static toFile: typeof Uploads.toFile;
|
|
126
|
-
static fileFromPath: typeof Uploads.fileFromPath;
|
|
127
|
-
}
|
|
128
|
-
export declare namespace Anthropic {
|
|
129
|
-
export type RequestOptions = Core.RequestOptions;
|
|
130
|
-
export import Page = Pagination.Page;
|
|
131
|
-
export { type PageParams as PageParams, type PageResponse as PageResponse };
|
|
132
|
-
export { Completions as Completions, type Completion as Completion, type CompletionCreateParams as CompletionCreateParams, type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, };
|
|
133
|
-
export { Messages as Messages, type Base64PDFSource as Base64PDFSource, type CacheControlEphemeral as CacheControlEphemeral, type ContentBlock as ContentBlock, type ContentBlockDeltaEvent as ContentBlockDeltaEvent, type ContentBlockParam as ContentBlockParam, type ContentBlockStartEvent as ContentBlockStartEvent, type ContentBlockStopEvent as ContentBlockStopEvent, type DocumentBlockParam as DocumentBlockParam, type ImageBlockParam as ImageBlockParam, type InputJSONDelta as InputJSONDelta, type Message as Message, type MessageDeltaEvent as MessageDeltaEvent, type MessageDeltaUsage as MessageDeltaUsage, type MessageParam as MessageParam, type MessageStartEvent as MessageStartEvent, type MessageStopEvent as MessageStopEvent, type MessageStreamEvent as MessageStreamEvent, type MessageTokensCount as MessageTokensCount, type Metadata as Metadata, type Model as Model, type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent, type RawContentBlockStartEvent as RawContentBlockStartEvent, type RawContentBlockStopEvent as RawContentBlockStopEvent, type RawMessageDeltaEvent as RawMessageDeltaEvent, type RawMessageStartEvent as RawMessageStartEvent, type RawMessageStopEvent as RawMessageStopEvent, type RawMessageStreamEvent as RawMessageStreamEvent, type TextBlock as TextBlock, type TextBlockParam as TextBlockParam, type TextDelta as TextDelta, type Tool as Tool, type ToolChoice as ToolChoice, type ToolChoiceAny as ToolChoiceAny, type ToolChoiceAuto as ToolChoiceAuto, type ToolChoiceTool as ToolChoiceTool, type ToolResultBlockParam as ToolResultBlockParam, type ToolUseBlock as ToolUseBlock, type ToolUseBlockParam as ToolUseBlockParam, type Usage as Usage, type MessageCreateParams as MessageCreateParams, type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming, type MessageCreateParamsStreaming as MessageCreateParamsStreaming, type MessageStreamParams as MessageStreamParams, type MessageCountTokensParams as MessageCountTokensParams, };
|
|
134
|
-
export { Models as Models, type ModelInfo as ModelInfo, ModelInfosPage as ModelInfosPage, type ModelListParams as ModelListParams, };
|
|
135
|
-
export { Beta as Beta, type AnthropicBeta as AnthropicBeta, type BetaAPIError as BetaAPIError, type BetaAuthenticationError as BetaAuthenticationError, type BetaBillingError as BetaBillingError, type BetaError as BetaError, type BetaErrorResponse as BetaErrorResponse, type BetaGatewayTimeoutError as BetaGatewayTimeoutError, type BetaInvalidRequestError as BetaInvalidRequestError, type BetaNotFoundError as BetaNotFoundError, type BetaOverloadedError as BetaOverloadedError, type BetaPermissionError as BetaPermissionError, type BetaRateLimitError as BetaRateLimitError, };
|
|
136
|
-
export type APIErrorObject = API.APIErrorObject;
|
|
137
|
-
export type AuthenticationError = API.AuthenticationError;
|
|
138
|
-
export type BillingError = API.BillingError;
|
|
139
|
-
export type ErrorObject = API.ErrorObject;
|
|
140
|
-
export type ErrorResponse = API.ErrorResponse;
|
|
141
|
-
export type GatewayTimeoutError = API.GatewayTimeoutError;
|
|
142
|
-
export type InvalidRequestError = API.InvalidRequestError;
|
|
143
|
-
export type NotFoundError = API.NotFoundError;
|
|
144
|
-
export type OverloadedError = API.OverloadedError;
|
|
145
|
-
export type PermissionError = API.PermissionError;
|
|
146
|
-
export type RateLimitError = API.RateLimitError;
|
|
147
|
-
}
|
|
148
|
-
export declare const HUMAN_PROMPT: string, AI_PROMPT: string;
|
|
149
|
-
export { toFile, fileFromPath } from "./uploads.js";
|
|
1
|
+
export { Anthropic as default } from "./client.js";
|
|
2
|
+
export { multipartFormRequestOptions, maybeMultipartFormRequestOptions, Uploadable, createForm, toFile, } from "./uploads.js";
|
|
3
|
+
export { APIPromise } from "./api-promise.js";
|
|
4
|
+
export { BaseAnthropic, Anthropic, ClientOptions, HUMAN_PROMPT, AI_PROMPT } from "./client.js";
|
|
5
|
+
export { PagePromise } from "./pagination.js";
|
|
150
6
|
export { AnthropicError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js";
|
|
151
|
-
export default Anthropic;
|
|
152
7
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,SAAS,IAAI,OAAO,EAAE;OAExB,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,UAAU,EACV,UAAU,EACV,MAAM,GACP;OACM,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE;OACpE,EAAE,WAAW,EAAE;OACf,EACL,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/index.js
CHANGED
|
@@ -1,165 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var _a;
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.AnthropicError = exports.fileFromPath = exports.toFile = exports.AI_PROMPT = exports.HUMAN_PROMPT = exports.Anthropic = void 0;
|
|
29
|
-
const Core = __importStar(require("./core.js"));
|
|
30
|
-
const Errors = __importStar(require("./error.js"));
|
|
31
|
-
const Pagination = __importStar(require("./pagination.js"));
|
|
32
|
-
const Uploads = __importStar(require("./uploads.js"));
|
|
33
|
-
const API = __importStar(require("./resources/index.js"));
|
|
34
|
-
const completions_1 = require("./resources/completions.js");
|
|
35
|
-
const models_1 = require("./resources/models.js");
|
|
36
|
-
const beta_1 = require("./resources/beta/beta.js");
|
|
37
|
-
const messages_1 = require("./resources/messages/messages.js");
|
|
38
|
-
/**
|
|
39
|
-
* API Client for interfacing with the Anthropic API.
|
|
40
|
-
*/
|
|
41
|
-
class Anthropic extends Core.APIClient {
|
|
42
|
-
/**
|
|
43
|
-
* API Client for interfacing with the Anthropic API.
|
|
44
|
-
*
|
|
45
|
-
* @param {string | null | undefined} [opts.apiKey=process.env['ANTHROPIC_API_KEY'] ?? null]
|
|
46
|
-
* @param {string | null | undefined} [opts.authToken=process.env['ANTHROPIC_AUTH_TOKEN'] ?? null]
|
|
47
|
-
* @param {string} [opts.baseURL=process.env['ANTHROPIC_BASE_URL'] ?? https://api.anthropic.com] - Override the default base URL for the API.
|
|
48
|
-
* @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
49
|
-
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
50
|
-
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
51
|
-
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
52
|
-
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
53
|
-
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
54
|
-
* @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
55
|
-
*/
|
|
56
|
-
constructor({ baseURL = Core.readEnv('ANTHROPIC_BASE_URL'), apiKey = Core.readEnv('ANTHROPIC_API_KEY') ?? null, authToken = Core.readEnv('ANTHROPIC_AUTH_TOKEN') ?? null, ...opts } = {}) {
|
|
57
|
-
const options = {
|
|
58
|
-
apiKey,
|
|
59
|
-
authToken,
|
|
60
|
-
...opts,
|
|
61
|
-
baseURL: baseURL || `https://api.anthropic.com`,
|
|
62
|
-
};
|
|
63
|
-
if (!options.dangerouslyAllowBrowser && Core.isRunningInBrowser()) {
|
|
64
|
-
throw new Errors.AnthropicError("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew Anthropic({ apiKey, dangerouslyAllowBrowser: true });\n");
|
|
65
|
-
}
|
|
66
|
-
super({
|
|
67
|
-
baseURL: options.baseURL,
|
|
68
|
-
timeout: options.timeout ?? 600000 /* 10 minutes */,
|
|
69
|
-
httpAgent: options.httpAgent,
|
|
70
|
-
maxRetries: options.maxRetries,
|
|
71
|
-
fetch: options.fetch,
|
|
72
|
-
});
|
|
73
|
-
this.completions = new API.Completions(this);
|
|
74
|
-
this.messages = new API.Messages(this);
|
|
75
|
-
this.models = new API.Models(this);
|
|
76
|
-
this.beta = new API.Beta(this);
|
|
77
|
-
this._options = options;
|
|
78
|
-
this.apiKey = apiKey;
|
|
79
|
-
this.authToken = authToken;
|
|
80
|
-
}
|
|
81
|
-
defaultQuery() {
|
|
82
|
-
return this._options.defaultQuery;
|
|
83
|
-
}
|
|
84
|
-
defaultHeaders(opts) {
|
|
85
|
-
return {
|
|
86
|
-
...super.defaultHeaders(opts),
|
|
87
|
-
...(this._options.dangerouslyAllowBrowser ?
|
|
88
|
-
{ 'anthropic-dangerous-direct-browser-access': 'true' }
|
|
89
|
-
: undefined),
|
|
90
|
-
'anthropic-version': '2023-06-01',
|
|
91
|
-
...this._options.defaultHeaders,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
validateHeaders(headers, customHeaders) {
|
|
95
|
-
if (this.apiKey && headers['x-api-key']) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (customHeaders['x-api-key'] === null) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (this.authToken && headers['authorization']) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (customHeaders['authorization'] === null) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
throw new Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted');
|
|
108
|
-
}
|
|
109
|
-
authHeaders(opts) {
|
|
110
|
-
const apiKeyAuth = this.apiKeyAuth(opts);
|
|
111
|
-
const bearerAuth = this.bearerAuth(opts);
|
|
112
|
-
if (apiKeyAuth != null && !Core.isEmptyObj(apiKeyAuth)) {
|
|
113
|
-
return apiKeyAuth;
|
|
114
|
-
}
|
|
115
|
-
if (bearerAuth != null && !Core.isEmptyObj(bearerAuth)) {
|
|
116
|
-
return bearerAuth;
|
|
117
|
-
}
|
|
118
|
-
return {};
|
|
119
|
-
}
|
|
120
|
-
apiKeyAuth(opts) {
|
|
121
|
-
if (this.apiKey == null) {
|
|
122
|
-
return {};
|
|
123
|
-
}
|
|
124
|
-
return { 'X-Api-Key': this.apiKey };
|
|
125
|
-
}
|
|
126
|
-
bearerAuth(opts) {
|
|
127
|
-
if (this.authToken == null) {
|
|
128
|
-
return {};
|
|
129
|
-
}
|
|
130
|
-
return { Authorization: `Bearer ${this.authToken}` };
|
|
131
|
-
}
|
|
3
|
+
exports = module.exports = function (...args) {
|
|
4
|
+
return new exports.default(...args)
|
|
132
5
|
}
|
|
133
|
-
exports
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
Anthropic.AI_PROMPT = '\n\nAssistant:';
|
|
138
|
-
Anthropic.DEFAULT_TIMEOUT = 600000; // 10 minutes
|
|
139
|
-
Anthropic.AnthropicError = Errors.AnthropicError;
|
|
140
|
-
Anthropic.APIError = Errors.APIError;
|
|
141
|
-
Anthropic.APIConnectionError = Errors.APIConnectionError;
|
|
142
|
-
Anthropic.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
143
|
-
Anthropic.APIUserAbortError = Errors.APIUserAbortError;
|
|
144
|
-
Anthropic.NotFoundError = Errors.NotFoundError;
|
|
145
|
-
Anthropic.ConflictError = Errors.ConflictError;
|
|
146
|
-
Anthropic.RateLimitError = Errors.RateLimitError;
|
|
147
|
-
Anthropic.BadRequestError = Errors.BadRequestError;
|
|
148
|
-
Anthropic.AuthenticationError = Errors.AuthenticationError;
|
|
149
|
-
Anthropic.InternalServerError = Errors.InternalServerError;
|
|
150
|
-
Anthropic.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
151
|
-
Anthropic.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
152
|
-
Anthropic.toFile = Uploads.toFile;
|
|
153
|
-
Anthropic.fileFromPath = Uploads.fileFromPath;
|
|
154
|
-
Anthropic.Completions = completions_1.Completions;
|
|
155
|
-
Anthropic.Messages = messages_1.Messages;
|
|
156
|
-
Anthropic.Models = models_1.Models;
|
|
157
|
-
Anthropic.ModelInfosPage = models_1.ModelInfosPage;
|
|
158
|
-
Anthropic.Beta = beta_1.Beta;
|
|
159
|
-
exports.HUMAN_PROMPT = Anthropic.HUMAN_PROMPT, exports.AI_PROMPT = Anthropic.AI_PROMPT;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.AnthropicError = exports.PagePromise = exports.AI_PROMPT = exports.HUMAN_PROMPT = exports.Anthropic = exports.BaseAnthropic = exports.APIPromise = exports.toFile = exports.createForm = exports.maybeMultipartFormRequestOptions = exports.multipartFormRequestOptions = exports.default = void 0;
|
|
8
|
+
var client_1 = require("./client.js");
|
|
9
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.Anthropic; } });
|
|
160
10
|
var uploads_1 = require("./uploads.js");
|
|
11
|
+
Object.defineProperty(exports, "multipartFormRequestOptions", { enumerable: true, get: function () { return uploads_1.multipartFormRequestOptions; } });
|
|
12
|
+
Object.defineProperty(exports, "maybeMultipartFormRequestOptions", { enumerable: true, get: function () { return uploads_1.maybeMultipartFormRequestOptions; } });
|
|
13
|
+
Object.defineProperty(exports, "createForm", { enumerable: true, get: function () { return uploads_1.createForm; } });
|
|
161
14
|
Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
|
|
162
|
-
|
|
15
|
+
var api_promise_1 = require("./api-promise.js");
|
|
16
|
+
Object.defineProperty(exports, "APIPromise", { enumerable: true, get: function () { return api_promise_1.APIPromise; } });
|
|
17
|
+
var client_2 = require("./client.js");
|
|
18
|
+
Object.defineProperty(exports, "BaseAnthropic", { enumerable: true, get: function () { return client_2.BaseAnthropic; } });
|
|
19
|
+
Object.defineProperty(exports, "Anthropic", { enumerable: true, get: function () { return client_2.Anthropic; } });
|
|
20
|
+
Object.defineProperty(exports, "HUMAN_PROMPT", { enumerable: true, get: function () { return client_2.HUMAN_PROMPT; } });
|
|
21
|
+
Object.defineProperty(exports, "AI_PROMPT", { enumerable: true, get: function () { return client_2.AI_PROMPT; } });
|
|
22
|
+
var pagination_1 = require("./pagination.js");
|
|
23
|
+
Object.defineProperty(exports, "PagePromise", { enumerable: true, get: function () { return pagination_1.PagePromise; } });
|
|
163
24
|
var error_1 = require("./error.js");
|
|
164
25
|
Object.defineProperty(exports, "AnthropicError", { enumerable: true, get: function () { return error_1.AnthropicError; } });
|
|
165
26
|
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
|
|
@@ -174,6 +35,4 @@ Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: f
|
|
|
174
35
|
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
|
|
175
36
|
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
|
|
176
37
|
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
177
|
-
exports = module.exports = Anthropic;
|
|
178
|
-
exports.default = Anthropic;
|
|
179
38
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAAgD;AAAvC,iGAAA,SAAS,OAAW;AAE7B,wCAMmB;AALjB,sHAAA,2BAA2B,OAAA;AAC3B,2HAAA,gCAAgC,OAAA;AAEhC,qGAAA,UAAU,OAAA;AACV,iGAAA,MAAM,OAAA;AAER,gDAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,sCAA4F;AAAnF,uGAAA,aAAa,OAAA;AAAE,mGAAA,SAAS,OAAA;AAAiB,sGAAA,YAAY,OAAA;AAAE,mGAAA,SAAS,OAAA;AACzE,8CAA2C;AAAlC,yGAAA,WAAW,OAAA;AACpB,oCAciB;AAbf,uGAAA,cAAc,OAAA;AACd,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA"}
|