Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +2 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.ts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils.js +11 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils/bytes.mjs.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils/uuid.d.mts +5 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils/uuid.d.ts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts +5 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/index.js +13 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages.mjs.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts +343 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js +204 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts +1566 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js +86 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/completions.d.ts +183 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/completions.d.ts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/batches.js +153 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts +3 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts +1295 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map +1 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/api-promise.ts +101 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/error.ts +133 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/pagination.ts +201 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/resource.ts +11 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/streaming.ts +331 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/uploads.ts +2 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/constants.ts +12 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/detect-platform.ts +196 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/request-options.ts +39 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/shim-types.ts +26 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/stream-utils.ts +32 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts +698 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/resources/index.ts +121 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts +1831 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/resources/shared.ts +72 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@esbuild/linux-x64/bin/esbuild +3 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@fastify/accept-negotiator/index.js +170 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@fastify/ajv-compiler/types/index.d.ts +72 -0
- platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@fastify/cors/.github/dependabot.yml +13 -0
.gitattributes
CHANGED
|
@@ -1940,3 +1940,5 @@ platform/dbops/archive/databases_old/data/home/x/.npm/_cacache/content-v2/sha512
|
|
| 1940 |
platform/dbops/archive/databases_old/data/home/x/.npm/_cacache/content-v2/sha512/ee/b2/94cb2df7435c9cf7ca50d430262edc17d74f45ed321f5a55b561da3c5a5d628b549e1e279e8741c77cf78bd9f3172bacf4b3c79c2acf5fac2b8b26f9dd06 filter=lfs diff=lfs merge=lfs -text
|
| 1941 |
platform/dbops/archive/databases_old/data/home/x/.npm/_cacache/content-v2/sha512/fd/5f/7bef5b7e1205f3eb6682732a1f9d084633c0d00026d186fcca16c5ca0bd40cfb931a745f199889b472b0cc6b3dfea34874cd77c99dde0485b61bc6cadc17 filter=lfs diff=lfs merge=lfs -text
|
| 1942 |
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/elizabeth_chroma/chroma.sqlite3 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 1940 |
platform/dbops/archive/databases_old/data/home/x/.npm/_cacache/content-v2/sha512/ee/b2/94cb2df7435c9cf7ca50d430262edc17d74f45ed321f5a55b561da3c5a5d628b549e1e279e8741c77cf78bd9f3172bacf4b3c79c2acf5fac2b8b26f9dd06 filter=lfs diff=lfs merge=lfs -text
|
| 1941 |
platform/dbops/archive/databases_old/data/home/x/.npm/_cacache/content-v2/sha512/fd/5f/7bef5b7e1205f3eb6682732a1f9d084633c0d00026d186fcca16c5ca0bd40cfb931a745f199889b472b0cc6b3dfea34874cd77c99dde0485b61bc6cadc17 filter=lfs diff=lfs merge=lfs -text
|
| 1942 |
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/elizabeth_chroma/chroma.sqlite3 filter=lfs diff=lfs merge=lfs -text
|
| 1943 |
+
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@esbuild/linux-x64/bin/esbuild filter=lfs diff=lfs merge=lfs -text
|
| 1944 |
+
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/esbuild/bin/esbuild filter=lfs diff=lfs merge=lfs -text
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/_vendor/partial-json-parser/parser.ts"],"names":[],"mappings":"AAKA,QAAA,MAgQE,YAAY,GAAI,OAAO,MAAM,KAAG,OAAgE,CAAC;AAEnG,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 3 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 4 |
+
const tslib_1 = require("./tslib.js");
|
| 5 |
+
tslib_1.__exportStar(require("./utils/values.js"), exports);
|
| 6 |
+
tslib_1.__exportStar(require("./utils/base64.js"), exports);
|
| 7 |
+
tslib_1.__exportStar(require("./utils/env.js"), exports);
|
| 8 |
+
tslib_1.__exportStar(require("./utils/log.js"), exports);
|
| 9 |
+
tslib_1.__exportStar(require("./utils/uuid.js"), exports);
|
| 10 |
+
tslib_1.__exportStar(require("./utils/sleep.js"), exports);
|
| 11 |
+
//# sourceMappingURL=utils.js.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils/bytes.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"bytes.mjs","sourceRoot":"","sources":["../../src/internal/utils/bytes.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,OAAqB;IAC/C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC;IAC1B,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC1B,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,IAAI,WAAwC,CAAC;AAC7C,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,OAAO,CAAC;IACZ,OAAO,CACL,WAAW;QACX,CAAC,CAAC,OAAO,GAAG,IAAK,UAAkB,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAClG,CAAC,GAAG,CAAC,CAAC;AACT,CAAC;AAED,IAAI,WAA0C,CAAC;AAC/C,MAAM,UAAU,UAAU,CAAC,KAAiB;IAC1C,IAAI,OAAO,CAAC;IACZ,OAAO,CACL,WAAW;QACX,CAAC,CAAC,OAAO,GAAG,IAAK,UAAkB,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAClG,CAAC,KAAK,CAAC,CAAC;AACX,CAAC"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils/uuid.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* https://stackoverflow.com/a/2117523
|
| 3 |
+
*/
|
| 4 |
+
export declare let uuid4: () => any;
|
| 5 |
+
//# sourceMappingURL=uuid.d.mts.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils/uuid.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/internal/utils/uuid.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,IAAI,KAAK,WAWf,CAAC"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"values.mjs","sourceRoot":"","sources":["../../src/internal/utils/values.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,cAAc,EAAE;AAEzB,iDAAiD;AACjD,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAEtD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAW,EAAE;IACpD,OAAO,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,oFAAoF;AACpF,MAAM,UAAU,QAAQ,CAAC,CAAU;IACjC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,UAAU,CAAC,GAA8B;IACvD,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,KAAK,MAAM,EAAE,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC;IACnC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,MAAM,CAA4B,GAAM,EAAE,GAAgB;IACxE,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,GAAY;IAChC,OAAO,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACvE,CAAC;AA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,UAAU,CAAC,CAAQ,IAAG,CAAC"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"beta.d.mts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,QAAQ;OACb,EACL,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,KAAK,EACN;OACM,KAAK,SAAS;OACd,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,EAAE;OACnF,KAAK,WAAW;OAChB,EACL,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,gCAAgC,EAChC,qCAAqC,EACrC,wBAAwB,EACxB,6BAA6B,EAC7B,wCAAwC,EACxC,wBAAwB,EACxB,kBAAkB,EAClB,oCAAoC,EACpC,4BAA4B,EAC5B,iCAAiC,EACjC,4BAA4B,EAC5B,iCAAiC,EACjC,6BAA6B,EAC7B,gCAAgC,EAChC,uCAAuC,EACvC,qCAAqC,EACrC,4CAA4C,EAC5C,gCAAgC,EAChC,oCAAoC,EACpC,qCAAqC,EACrC,aAAa,EACb,wBAAwB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,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old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"beta.d.ts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,QAAQ;OACb,EACL,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,KAAK,EACN;OACM,KAAK,SAAS;OACd,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,EAAE;OACnF,KAAK,WAAW;OAChB,EACL,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,6BAA6B,EAC7B,gCAAgC,EAChC,qCAAqC,EACrC,wBAAwB,EACxB,6BAA6B,EAC7B,wCAAwC,EACxC,wBAAwB,EACxB,kBAAkB,EAClB,oCAAoC,EACpC,4BAA4B,EAC5B,iCAAiC,EACjC,4BAA4B,EAC5B,iCAAiC,EACjC,6BAA6B,EAC7B,gCAAgC,EAChC,uCAAuC,EACvC,qCAAqC,EACrC,4CAA4C,EAC5C,gCAAgC,EAChC,oCAAoC,EACpC,qCAAqC,EACrC,aAAa,EACb,wBAAwB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC5B,wBAAw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resources/beta/beta.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"beta.mjs","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,QAAQ;OACb,EASL,KAAK,GACN;OACM,KAAK,SAAS;OACd,EAA2E,MAAM,EAAE;OACnF,KAAK,WAAW;OAChB,EAgHL,QAAQ,GACT;AAED,MAAM,OAAO,IAAK,SAAQ,WAAW;IAArC;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;CAAA;AA0FD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../../src/resources/beta/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAAE,UAAU,EAAE;OACd,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE;OACtC,EAAE,KAAK,UAAU,EAAE;OAEnB,EAAE,cAAc,EAAE;AAIzB,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;OAUG;IACH,IAAI,CACF,MAAM,GAAE,cAAc,GAAG,IAAI,GAAG,SA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CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EACL,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/beta/files.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;OACZ,EAAE,UAAU,EAAE;OACd,E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dk/resources/beta/index.d.mts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export { Beta, type AnthropicBeta, type BetaAPIError, type BetaAuthenticationError, type BetaBillingError, type BetaError, type BetaErrorResponse, type BetaGatewayTimeoutError, type BetaInvalidRequestError, type BetaNotFoundError, type BetaOverloadedError, type BetaPermissionError, type BetaRateLimitError, } from "./beta.mjs";
|
| 2 |
+
export { Files, type DeletedFile, type FileMetadata, type FileListParams, type FileDeleteParams, type FileDownloadParams, type FileRetrieveMetadataParams, type FileUploadParams, type FileMetadataPage, } from "./files.mjs";
|
| 3 |
+
export { Messages, type BetaBase64ImageSource, type BetaBase64PDFSource, type BetaCacheControlEphemeral, type BetaCacheCreation, type BetaCitationCharLocation, type BetaCitationCharLocationParam, type BetaCitationContentBlockLocation, type BetaCitationContentBlockLocationParam, type BetaCitationPageLocation, type BetaCitationPageLocationParam, type BetaCitationWebSearchResultLocationParam, type BetaCitationsConfigParam, type BetaCitationsDelta, type BetaCitationsWebSearchResultLocation, type BetaCodeExecutionOutputBlock, type BetaCodeExecutionOutputBlockParam, type BetaCodeExecutionResultBlock, type BetaCodeExecutionResultBlockParam, type BetaCodeExecutionTool20250522, type BetaCodeExecutionToolResultBlock, type BetaCodeExecutionToolResultBlockContent, type BetaCodeExecutionToolResultBlockParam, type BetaCodeExecutionToolResultBlockParamContent, type BetaCodeExecutionToolResultError, type BetaCodeExecutionToolResultErrorCode, type BetaCodeExecutionToolResultErrorParam, type BetaContainer, type BetaContainerUploadBlock, type BetaContainerUploadBlockParam, type BetaContentBlock, type BetaContentBlockParam, type BetaContentBlockSource, type BetaContentBlockSourceContent, type BetaFileDocumentSource, type BetaFileImageSource, type BetaImageBlockParam, type BetaInputJSONDelta, type BetaMCPToolResultBlock, type BetaMCPToolUseBlock, type BetaMCPToolUseBlockParam, type BetaMessage, type BetaMessageDeltaUsage, type BetaMessageParam, type BetaMessageTokensCount, type BetaMetadata, type BetaPlainTextSource, type BetaRawContentBlockDelta, type BetaRawContentBlockDeltaEvent, type BetaRawContentBlockStartEvent, type BetaRawContentBlockStopEvent, type BetaRawMessageDeltaEvent, type BetaRawMessageStartEvent, type BetaRawMessageStopEvent, type BetaRawMessageStreamEvent, type BetaRedactedThinkingBlock, type BetaRedactedThinkingBlockParam, type BetaRequestDocumentBlock, type BetaRequestMCPServerToolConfiguration, type BetaRequestMCPServerURLDefinition, type BetaRequestMCPToolResultBlockParam, type BetaServerToolUsage, type BetaServerToolUseBlock, type BetaServerToolUseBlockParam, type BetaSignatureDelta, type BetaStopReason, type BetaTextBlock, type BetaTextBlockParam, type BetaTextCitation, type BetaTextCitationParam, type BetaTextDelta, type BetaThinkingBlock, type BetaThinkingBlockParam, type BetaThinkingConfigDisabled, type BetaThinkingConfigEnabled, type BetaThinkingConfigParam, type BetaThinkingDelta, type BetaTool, type BetaToolBash20241022, type BetaToolBash20250124, type BetaToolChoice, type BetaToolChoiceAny, type BetaToolChoiceAuto, type BetaToolChoiceNone, type BetaToolChoiceTool, type BetaToolComputerUse20241022, type BetaToolComputerUse20250124, type BetaToolResultBlockParam, type BetaToolTextEditor20241022, type BetaToolTextEditor20250124, type BetaToolTextEditor20250429, type BetaToolUnion, type BetaToolUseBlock, type BetaToolUseBlockParam, type BetaURLImageSource, type BetaURLPDFSource, type BetaUsage, type BetaWebSearchResultBlock, type BetaWebSearchResultBlockParam, type BetaWebSearchTool20250305, type BetaWebSearchToolRequestError, type BetaWebSearchToolResultBlock, type BetaWebSearchToolResultBlockContent, type BetaWebSearchToolResultBlockParam, type BetaWebSearchToolResultBlockParamContent, type BetaWebSearchToolResultError, type BetaWebSearchToolResultErrorCode, type BetaBase64PDFBlock, type MessageCreateParams, type MessageCreateParamsNonStreaming, type MessageCreateParamsStreaming, type MessageCountTokensParams, } from "./messages/index.mjs";
|
| 4 |
+
export { Models, type BetaModelInfo, type ModelRetrieveParams, type ModelListParams, type BetaModelInfosPage, } from "./models.mjs";
|
| 5 |
+
//# sourceMappingURL=index.d.mts.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 3 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 4 |
+
exports.Models = exports.Messages = exports.Files = exports.Beta = void 0;
|
| 5 |
+
var beta_1 = require("./beta.js");
|
| 6 |
+
Object.defineProperty(exports, "Beta", { enumerable: true, get: function () { return beta_1.Beta; } });
|
| 7 |
+
var files_1 = require("./files.js");
|
| 8 |
+
Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
|
| 9 |
+
var index_1 = require("./messages/index.js");
|
| 10 |
+
Object.defineProperty(exports, "Messages", { enumerable: true, get: function () { return index_1.Messages; } });
|
| 11 |
+
var models_1 = require("./models.js");
|
| 12 |
+
Object.defineProperty(exports, "Models", { enumerable: true, get: function () { return models_1.Models; } });
|
| 13 |
+
//# sourceMappingURL=index.js.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../../src/resources/beta/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
import * as BetaAPI from "../beta.mjs";
|
| 3 |
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
| 4 |
+
import * as BetaMessagesAPI from "./messages.mjs";
|
| 5 |
+
import { Page, type PageParams, PagePromise } from "../../../core/pagination.mjs";
|
| 6 |
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
| 7 |
+
import { JSONLDecoder } from "../../../internal/decoders/jsonl.mjs";
|
| 8 |
+
export declare class Batches extends APIResource {
|
| 9 |
+
/**
|
| 10 |
+
* Send a batch of Message creation requests.
|
| 11 |
+
*
|
| 12 |
+
* The Message Batches API can be used to process multiple Messages API requests at
|
| 13 |
+
* once. Once a Message Batch is created, it begins processing immediately. Batches
|
| 14 |
+
* can take up to 24 hours to complete.
|
| 15 |
+
*
|
| 16 |
+
* Learn more about the Message Batches API in our
|
| 17 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* ```ts
|
| 21 |
+
* const betaMessageBatch =
|
| 22 |
+
* await client.beta.messages.batches.create({
|
| 23 |
+
* requests: [
|
| 24 |
+
* {
|
| 25 |
+
* custom_id: 'my-custom-id-1',
|
| 26 |
+
* params: {
|
| 27 |
+
* max_tokens: 1024,
|
| 28 |
+
* messages: [
|
| 29 |
+
* { content: 'Hello, world', role: 'user' },
|
| 30 |
+
* ],
|
| 31 |
+
* model: 'claude-3-7-sonnet-20250219',
|
| 32 |
+
* },
|
| 33 |
+
* },
|
| 34 |
+
* ],
|
| 35 |
+
* });
|
| 36 |
+
* ```
|
| 37 |
+
*/
|
| 38 |
+
create(params: BatchCreateParams, options?: RequestOptions): APIPromise<BetaMessageBatch>;
|
| 39 |
+
/**
|
| 40 |
+
* This endpoint is idempotent and can be used to poll for Message Batch
|
| 41 |
+
* completion. To access the results of a Message Batch, make a request to the
|
| 42 |
+
* `results_url` field in the response.
|
| 43 |
+
*
|
| 44 |
+
* Learn more about the Message Batches API in our
|
| 45 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 46 |
+
*
|
| 47 |
+
* @example
|
| 48 |
+
* ```ts
|
| 49 |
+
* const betaMessageBatch =
|
| 50 |
+
* await client.beta.messages.batches.retrieve(
|
| 51 |
+
* 'message_batch_id',
|
| 52 |
+
* );
|
| 53 |
+
* ```
|
| 54 |
+
*/
|
| 55 |
+
retrieve(messageBatchID: string, params?: BatchRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<BetaMessageBatch>;
|
| 56 |
+
/**
|
| 57 |
+
* List all Message Batches within a Workspace. Most recently created batches are
|
| 58 |
+
* returned first.
|
| 59 |
+
*
|
| 60 |
+
* Learn more about the Message Batches API in our
|
| 61 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 62 |
+
*
|
| 63 |
+
* @example
|
| 64 |
+
* ```ts
|
| 65 |
+
* // Automatically fetches more pages as needed.
|
| 66 |
+
* for await (const betaMessageBatch of client.beta.messages.batches.list()) {
|
| 67 |
+
* // ...
|
| 68 |
+
* }
|
| 69 |
+
* ```
|
| 70 |
+
*/
|
| 71 |
+
list(params?: BatchListParams | null | undefined, options?: RequestOptions): PagePromise<BetaMessageBatchesPage, BetaMessageBatch>;
|
| 72 |
+
/**
|
| 73 |
+
* Delete a Message Batch.
|
| 74 |
+
*
|
| 75 |
+
* Message Batches can only be deleted once they've finished processing. If you'd
|
| 76 |
+
* like to delete an in-progress batch, you must first cancel it.
|
| 77 |
+
*
|
| 78 |
+
* Learn more about the Message Batches API in our
|
| 79 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 80 |
+
*
|
| 81 |
+
* @example
|
| 82 |
+
* ```ts
|
| 83 |
+
* const betaDeletedMessageBatch =
|
| 84 |
+
* await client.beta.messages.batches.delete(
|
| 85 |
+
* 'message_batch_id',
|
| 86 |
+
* );
|
| 87 |
+
* ```
|
| 88 |
+
*/
|
| 89 |
+
delete(messageBatchID: string, params?: BatchDeleteParams | null | undefined, options?: RequestOptions): APIPromise<BetaDeletedMessageBatch>;
|
| 90 |
+
/**
|
| 91 |
+
* Batches may be canceled any time before processing ends. Once cancellation is
|
| 92 |
+
* initiated, the batch enters a `canceling` state, at which time the system may
|
| 93 |
+
* complete any in-progress, non-interruptible requests before finalizing
|
| 94 |
+
* cancellation.
|
| 95 |
+
*
|
| 96 |
+
* The number of canceled requests is specified in `request_counts`. To determine
|
| 97 |
+
* which requests were canceled, check the individual results within the batch.
|
| 98 |
+
* Note that cancellation may not result in any canceled requests if they were
|
| 99 |
+
* non-interruptible.
|
| 100 |
+
*
|
| 101 |
+
* Learn more about the Message Batches API in our
|
| 102 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 103 |
+
*
|
| 104 |
+
* @example
|
| 105 |
+
* ```ts
|
| 106 |
+
* const betaMessageBatch =
|
| 107 |
+
* await client.beta.messages.batches.cancel(
|
| 108 |
+
* 'message_batch_id',
|
| 109 |
+
* );
|
| 110 |
+
* ```
|
| 111 |
+
*/
|
| 112 |
+
cancel(messageBatchID: string, params?: BatchCancelParams | null | undefined, options?: RequestOptions): APIPromise<BetaMessageBatch>;
|
| 113 |
+
/**
|
| 114 |
+
* Streams the results of a Message Batch as a `.jsonl` file.
|
| 115 |
+
*
|
| 116 |
+
* Each line in the file is a JSON object containing the result of a single request
|
| 117 |
+
* in the Message Batch. Results are not guaranteed to be in the same order as
|
| 118 |
+
* requests. Use the `custom_id` field to match results to requests.
|
| 119 |
+
*
|
| 120 |
+
* Learn more about the Message Batches API in our
|
| 121 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 122 |
+
*
|
| 123 |
+
* @example
|
| 124 |
+
* ```ts
|
| 125 |
+
* const betaMessageBatchIndividualResponse =
|
| 126 |
+
* await client.beta.messages.batches.results(
|
| 127 |
+
* 'message_batch_id',
|
| 128 |
+
* );
|
| 129 |
+
* ```
|
| 130 |
+
*/
|
| 131 |
+
results(messageBatchID: string, params?: BatchResultsParams | undefined, options?: RequestOptions): Promise<JSONLDecoder<BetaMessageBatchIndividualResponse>>;
|
| 132 |
+
}
|
| 133 |
+
export type BetaMessageBatchesPage = Page<BetaMessageBatch>;
|
| 134 |
+
export interface BetaDeletedMessageBatch {
|
| 135 |
+
/**
|
| 136 |
+
* ID of the Message Batch.
|
| 137 |
+
*/
|
| 138 |
+
id: string;
|
| 139 |
+
/**
|
| 140 |
+
* Deleted object type.
|
| 141 |
+
*
|
| 142 |
+
* For Message Batches, this is always `"message_batch_deleted"`.
|
| 143 |
+
*/
|
| 144 |
+
type: 'message_batch_deleted';
|
| 145 |
+
}
|
| 146 |
+
export interface BetaMessageBatch {
|
| 147 |
+
/**
|
| 148 |
+
* Unique object identifier.
|
| 149 |
+
*
|
| 150 |
+
* The format and length of IDs may change over time.
|
| 151 |
+
*/
|
| 152 |
+
id: string;
|
| 153 |
+
/**
|
| 154 |
+
* RFC 3339 datetime string representing the time at which the Message Batch was
|
| 155 |
+
* archived and its results became unavailable.
|
| 156 |
+
*/
|
| 157 |
+
archived_at: string | null;
|
| 158 |
+
/**
|
| 159 |
+
* RFC 3339 datetime string representing the time at which cancellation was
|
| 160 |
+
* initiated for the Message Batch. Specified only if cancellation was initiated.
|
| 161 |
+
*/
|
| 162 |
+
cancel_initiated_at: string | null;
|
| 163 |
+
/**
|
| 164 |
+
* RFC 3339 datetime string representing the time at which the Message Batch was
|
| 165 |
+
* created.
|
| 166 |
+
*/
|
| 167 |
+
created_at: string;
|
| 168 |
+
/**
|
| 169 |
+
* RFC 3339 datetime string representing the time at which processing for the
|
| 170 |
+
* Message Batch ended. Specified only once processing ends.
|
| 171 |
+
*
|
| 172 |
+
* Processing ends when every request in a Message Batch has either succeeded,
|
| 173 |
+
* errored, canceled, or expired.
|
| 174 |
+
*/
|
| 175 |
+
ended_at: string | null;
|
| 176 |
+
/**
|
| 177 |
+
* RFC 3339 datetime string representing the time at which the Message Batch will
|
| 178 |
+
* expire and end processing, which is 24 hours after creation.
|
| 179 |
+
*/
|
| 180 |
+
expires_at: string;
|
| 181 |
+
/**
|
| 182 |
+
* Processing status of the Message Batch.
|
| 183 |
+
*/
|
| 184 |
+
processing_status: 'in_progress' | 'canceling' | 'ended';
|
| 185 |
+
/**
|
| 186 |
+
* Tallies requests within the Message Batch, categorized by their status.
|
| 187 |
+
*
|
| 188 |
+
* Requests start as `processing` and move to one of the other statuses only once
|
| 189 |
+
* processing of the entire batch ends. The sum of all values always matches the
|
| 190 |
+
* total number of requests in the batch.
|
| 191 |
+
*/
|
| 192 |
+
request_counts: BetaMessageBatchRequestCounts;
|
| 193 |
+
/**
|
| 194 |
+
* URL to a `.jsonl` file containing the results of the Message Batch requests.
|
| 195 |
+
* Specified only once processing ends.
|
| 196 |
+
*
|
| 197 |
+
* Results in the file are not guaranteed to be in the same order as requests. Use
|
| 198 |
+
* the `custom_id` field to match results to requests.
|
| 199 |
+
*/
|
| 200 |
+
results_url: string | null;
|
| 201 |
+
/**
|
| 202 |
+
* Object type.
|
| 203 |
+
*
|
| 204 |
+
* For Message Batches, this is always `"message_batch"`.
|
| 205 |
+
*/
|
| 206 |
+
type: 'message_batch';
|
| 207 |
+
}
|
| 208 |
+
export interface BetaMessageBatchCanceledResult {
|
| 209 |
+
type: 'canceled';
|
| 210 |
+
}
|
| 211 |
+
export interface BetaMessageBatchErroredResult {
|
| 212 |
+
error: BetaAPI.BetaErrorResponse;
|
| 213 |
+
type: 'errored';
|
| 214 |
+
}
|
| 215 |
+
export interface BetaMessageBatchExpiredResult {
|
| 216 |
+
type: 'expired';
|
| 217 |
+
}
|
| 218 |
+
/**
|
| 219 |
+
* This is a single line in the response `.jsonl` file and does not represent the
|
| 220 |
+
* response as a whole.
|
| 221 |
+
*/
|
| 222 |
+
export interface BetaMessageBatchIndividualResponse {
|
| 223 |
+
/**
|
| 224 |
+
* Developer-provided ID created for each request in a Message Batch. Useful for
|
| 225 |
+
* matching results to requests, as results may be given out of request order.
|
| 226 |
+
*
|
| 227 |
+
* Must be unique for each request within the Message Batch.
|
| 228 |
+
*/
|
| 229 |
+
custom_id: string;
|
| 230 |
+
/**
|
| 231 |
+
* Processing result for this request.
|
| 232 |
+
*
|
| 233 |
+
* Contains a Message output if processing was successful, an error response if
|
| 234 |
+
* processing failed, or the reason why processing was not attempted, such as
|
| 235 |
+
* cancellation or expiration.
|
| 236 |
+
*/
|
| 237 |
+
result: BetaMessageBatchResult;
|
| 238 |
+
}
|
| 239 |
+
export interface BetaMessageBatchRequestCounts {
|
| 240 |
+
/**
|
| 241 |
+
* Number of requests in the Message Batch that have been canceled.
|
| 242 |
+
*
|
| 243 |
+
* This is zero until processing of the entire Message Batch has ended.
|
| 244 |
+
*/
|
| 245 |
+
canceled: number;
|
| 246 |
+
/**
|
| 247 |
+
* Number of requests in the Message Batch that encountered an error.
|
| 248 |
+
*
|
| 249 |
+
* This is zero until processing of the entire Message Batch has ended.
|
| 250 |
+
*/
|
| 251 |
+
errored: number;
|
| 252 |
+
/**
|
| 253 |
+
* Number of requests in the Message Batch that have expired.
|
| 254 |
+
*
|
| 255 |
+
* This is zero until processing of the entire Message Batch has ended.
|
| 256 |
+
*/
|
| 257 |
+
expired: number;
|
| 258 |
+
/**
|
| 259 |
+
* Number of requests in the Message Batch that are processing.
|
| 260 |
+
*/
|
| 261 |
+
processing: number;
|
| 262 |
+
/**
|
| 263 |
+
* Number of requests in the Message Batch that have completed successfully.
|
| 264 |
+
*
|
| 265 |
+
* This is zero until processing of the entire Message Batch has ended.
|
| 266 |
+
*/
|
| 267 |
+
succeeded: number;
|
| 268 |
+
}
|
| 269 |
+
/**
|
| 270 |
+
* Processing result for this request.
|
| 271 |
+
*
|
| 272 |
+
* Contains a Message output if processing was successful, an error response if
|
| 273 |
+
* processing failed, or the reason why processing was not attempted, such as
|
| 274 |
+
* cancellation or expiration.
|
| 275 |
+
*/
|
| 276 |
+
export type BetaMessageBatchResult = BetaMessageBatchSucceededResult | BetaMessageBatchErroredResult | BetaMessageBatchCanceledResult | BetaMessageBatchExpiredResult;
|
| 277 |
+
export interface BetaMessageBatchSucceededResult {
|
| 278 |
+
message: BetaMessagesAPI.BetaMessage;
|
| 279 |
+
type: 'succeeded';
|
| 280 |
+
}
|
| 281 |
+
export interface BatchCreateParams {
|
| 282 |
+
/**
|
| 283 |
+
* Body param: List of requests for prompt completion. Each is an individual
|
| 284 |
+
* request to create a Message.
|
| 285 |
+
*/
|
| 286 |
+
requests: Array<BatchCreateParams.Request>;
|
| 287 |
+
/**
|
| 288 |
+
* Header param: Optional header to specify the beta version(s) you want to use.
|
| 289 |
+
*/
|
| 290 |
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
| 291 |
+
}
|
| 292 |
+
export declare namespace BatchCreateParams {
|
| 293 |
+
interface Request {
|
| 294 |
+
/**
|
| 295 |
+
* Developer-provided ID created for each request in a Message Batch. Useful for
|
| 296 |
+
* matching results to requests, as results may be given out of request order.
|
| 297 |
+
*
|
| 298 |
+
* Must be unique for each request within the Message Batch.
|
| 299 |
+
*/
|
| 300 |
+
custom_id: string;
|
| 301 |
+
/**
|
| 302 |
+
* Messages API creation parameters for the individual request.
|
| 303 |
+
*
|
| 304 |
+
* See the [Messages API reference](/en/api/messages) for full documentation on
|
| 305 |
+
* available parameters.
|
| 306 |
+
*/
|
| 307 |
+
params: Omit<BetaMessagesAPI.MessageCreateParamsNonStreaming, 'betas'>;
|
| 308 |
+
}
|
| 309 |
+
}
|
| 310 |
+
export interface BatchRetrieveParams {
|
| 311 |
+
/**
|
| 312 |
+
* Optional header to specify the beta version(s) you want to use.
|
| 313 |
+
*/
|
| 314 |
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
| 315 |
+
}
|
| 316 |
+
export interface BatchListParams extends PageParams {
|
| 317 |
+
/**
|
| 318 |
+
* Header param: Optional header to specify the beta version(s) you want to use.
|
| 319 |
+
*/
|
| 320 |
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
| 321 |
+
}
|
| 322 |
+
export interface BatchDeleteParams {
|
| 323 |
+
/**
|
| 324 |
+
* Optional header to specify the beta version(s) you want to use.
|
| 325 |
+
*/
|
| 326 |
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
| 327 |
+
}
|
| 328 |
+
export interface BatchCancelParams {
|
| 329 |
+
/**
|
| 330 |
+
* Optional header to specify the beta version(s) you want to use.
|
| 331 |
+
*/
|
| 332 |
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
| 333 |
+
}
|
| 334 |
+
export interface BatchResultsParams {
|
| 335 |
+
/**
|
| 336 |
+
* Optional header to specify the beta version(s) you want to use.
|
| 337 |
+
*/
|
| 338 |
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
| 339 |
+
}
|
| 340 |
+
export declare namespace Batches {
|
| 341 |
+
export { type BetaDeletedMessageBatch as BetaDeletedMessageBatch, type BetaMessageBatch as BetaMessageBatch, type BetaMessageBatchCanceledResult as BetaMessageBatchCanceledResult, type BetaMessageBatchErroredResult as BetaMessageBatchErroredResult, type BetaMessageBatchExpiredResult as BetaMessageBatchExpiredResult, type BetaMessageBatchIndividualResponse as BetaMessageBatchIndividualResponse, type BetaMessageBatchRequestCounts as BetaMessageBatchRequestCounts, type BetaMessageBatchResult as BetaMessageBatchResult, type BetaMessageBatchSucceededResult as BetaMessageBatchSucceededResult, type BetaMessageBatchesPage as BetaMessageBatchesPage, type BatchCreateParams as BatchCreateParams, type BatchRetrieveParams as BatchRetrieveParams, type BatchListParams as BatchListParams, type BatchDeleteParams as BatchDeleteParams, type BatchCancelParams as BatchCancelParams, type BatchResultsParams as BatchResultsParams, };
|
| 342 |
+
}
|
| 343 |
+
//# sourceMappingURL=batches.d.mts.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"batches.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/messages/batches.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,OAAO;O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OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,kCAAkC,IAAI,kCAAkC,EAC7E,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 3 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 4 |
+
exports.Batches = void 0;
|
| 5 |
+
const resource_1 = require("../../../core/resource.js");
|
| 6 |
+
const pagination_1 = require("../../../core/pagination.js");
|
| 7 |
+
const headers_1 = require("../../../internal/headers.js");
|
| 8 |
+
const jsonl_1 = require("../../../internal/decoders/jsonl.js");
|
| 9 |
+
const error_1 = require("../../../error.js");
|
| 10 |
+
const path_1 = require("../../../internal/utils/path.js");
|
| 11 |
+
class Batches extends resource_1.APIResource {
|
| 12 |
+
/**
|
| 13 |
+
* Send a batch of Message creation requests.
|
| 14 |
+
*
|
| 15 |
+
* The Message Batches API can be used to process multiple Messages API requests at
|
| 16 |
+
* once. Once a Message Batch is created, it begins processing immediately. Batches
|
| 17 |
+
* can take up to 24 hours to complete.
|
| 18 |
+
*
|
| 19 |
+
* Learn more about the Message Batches API in our
|
| 20 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 21 |
+
*
|
| 22 |
+
* @example
|
| 23 |
+
* ```ts
|
| 24 |
+
* const betaMessageBatch =
|
| 25 |
+
* await client.beta.messages.batches.create({
|
| 26 |
+
* requests: [
|
| 27 |
+
* {
|
| 28 |
+
* custom_id: 'my-custom-id-1',
|
| 29 |
+
* params: {
|
| 30 |
+
* max_tokens: 1024,
|
| 31 |
+
* messages: [
|
| 32 |
+
* { content: 'Hello, world', role: 'user' },
|
| 33 |
+
* ],
|
| 34 |
+
* model: 'claude-3-7-sonnet-20250219',
|
| 35 |
+
* },
|
| 36 |
+
* },
|
| 37 |
+
* ],
|
| 38 |
+
* });
|
| 39 |
+
* ```
|
| 40 |
+
*/
|
| 41 |
+
create(params, options) {
|
| 42 |
+
const { betas, ...body } = params;
|
| 43 |
+
return this._client.post('/v1/messages/batches?beta=true', {
|
| 44 |
+
body,
|
| 45 |
+
...options,
|
| 46 |
+
headers: (0, headers_1.buildHeaders)([
|
| 47 |
+
{ 'anthropic-beta': [...(betas ?? []), 'message-batches-2024-09-24'].toString() },
|
| 48 |
+
options?.headers,
|
| 49 |
+
]),
|
| 50 |
+
});
|
| 51 |
+
}
|
| 52 |
+
/**
|
| 53 |
+
* This endpoint is idempotent and can be used to poll for Message Batch
|
| 54 |
+
* completion. To access the results of a Message Batch, make a request to the
|
| 55 |
+
* `results_url` field in the response.
|
| 56 |
+
*
|
| 57 |
+
* Learn more about the Message Batches API in our
|
| 58 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 59 |
+
*
|
| 60 |
+
* @example
|
| 61 |
+
* ```ts
|
| 62 |
+
* const betaMessageBatch =
|
| 63 |
+
* await client.beta.messages.batches.retrieve(
|
| 64 |
+
* 'message_batch_id',
|
| 65 |
+
* );
|
| 66 |
+
* ```
|
| 67 |
+
*/
|
| 68 |
+
retrieve(messageBatchID, params = {}, options) {
|
| 69 |
+
const { betas } = params ?? {};
|
| 70 |
+
return this._client.get((0, path_1.path) `/v1/messages/batches/${messageBatchID}?beta=true`, {
|
| 71 |
+
...options,
|
| 72 |
+
headers: (0, headers_1.buildHeaders)([
|
| 73 |
+
{ 'anthropic-beta': [...(betas ?? []), 'message-batches-2024-09-24'].toString() },
|
| 74 |
+
options?.headers,
|
| 75 |
+
]),
|
| 76 |
+
});
|
| 77 |
+
}
|
| 78 |
+
/**
|
| 79 |
+
* List all Message Batches within a Workspace. Most recently created batches are
|
| 80 |
+
* returned first.
|
| 81 |
+
*
|
| 82 |
+
* Learn more about the Message Batches API in our
|
| 83 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 84 |
+
*
|
| 85 |
+
* @example
|
| 86 |
+
* ```ts
|
| 87 |
+
* // Automatically fetches more pages as needed.
|
| 88 |
+
* for await (const betaMessageBatch of client.beta.messages.batches.list()) {
|
| 89 |
+
* // ...
|
| 90 |
+
* }
|
| 91 |
+
* ```
|
| 92 |
+
*/
|
| 93 |
+
list(params = {}, options) {
|
| 94 |
+
const { betas, ...query } = params ?? {};
|
| 95 |
+
return this._client.getAPIList('/v1/messages/batches?beta=true', (pagination_1.Page), {
|
| 96 |
+
query,
|
| 97 |
+
...options,
|
| 98 |
+
headers: (0, headers_1.buildHeaders)([
|
| 99 |
+
{ 'anthropic-beta': [...(betas ?? []), 'message-batches-2024-09-24'].toString() },
|
| 100 |
+
options?.headers,
|
| 101 |
+
]),
|
| 102 |
+
});
|
| 103 |
+
}
|
| 104 |
+
/**
|
| 105 |
+
* Delete a Message Batch.
|
| 106 |
+
*
|
| 107 |
+
* Message Batches can only be deleted once they've finished processing. If you'd
|
| 108 |
+
* like to delete an in-progress batch, you must first cancel it.
|
| 109 |
+
*
|
| 110 |
+
* Learn more about the Message Batches API in our
|
| 111 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 112 |
+
*
|
| 113 |
+
* @example
|
| 114 |
+
* ```ts
|
| 115 |
+
* const betaDeletedMessageBatch =
|
| 116 |
+
* await client.beta.messages.batches.delete(
|
| 117 |
+
* 'message_batch_id',
|
| 118 |
+
* );
|
| 119 |
+
* ```
|
| 120 |
+
*/
|
| 121 |
+
delete(messageBatchID, params = {}, options) {
|
| 122 |
+
const { betas } = params ?? {};
|
| 123 |
+
return this._client.delete((0, path_1.path) `/v1/messages/batches/${messageBatchID}?beta=true`, {
|
| 124 |
+
...options,
|
| 125 |
+
headers: (0, headers_1.buildHeaders)([
|
| 126 |
+
{ 'anthropic-beta': [...(betas ?? []), 'message-batches-2024-09-24'].toString() },
|
| 127 |
+
options?.headers,
|
| 128 |
+
]),
|
| 129 |
+
});
|
| 130 |
+
}
|
| 131 |
+
/**
|
| 132 |
+
* Batches may be canceled any time before processing ends. Once cancellation is
|
| 133 |
+
* initiated, the batch enters a `canceling` state, at which time the system may
|
| 134 |
+
* complete any in-progress, non-interruptible requests before finalizing
|
| 135 |
+
* cancellation.
|
| 136 |
+
*
|
| 137 |
+
* The number of canceled requests is specified in `request_counts`. To determine
|
| 138 |
+
* which requests were canceled, check the individual results within the batch.
|
| 139 |
+
* Note that cancellation may not result in any canceled requests if they were
|
| 140 |
+
* non-interruptible.
|
| 141 |
+
*
|
| 142 |
+
* Learn more about the Message Batches API in our
|
| 143 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 144 |
+
*
|
| 145 |
+
* @example
|
| 146 |
+
* ```ts
|
| 147 |
+
* const betaMessageBatch =
|
| 148 |
+
* await client.beta.messages.batches.cancel(
|
| 149 |
+
* 'message_batch_id',
|
| 150 |
+
* );
|
| 151 |
+
* ```
|
| 152 |
+
*/
|
| 153 |
+
cancel(messageBatchID, params = {}, options) {
|
| 154 |
+
const { betas } = params ?? {};
|
| 155 |
+
return this._client.post((0, path_1.path) `/v1/messages/batches/${messageBatchID}/cancel?beta=true`, {
|
| 156 |
+
...options,
|
| 157 |
+
headers: (0, headers_1.buildHeaders)([
|
| 158 |
+
{ 'anthropic-beta': [...(betas ?? []), 'message-batches-2024-09-24'].toString() },
|
| 159 |
+
options?.headers,
|
| 160 |
+
]),
|
| 161 |
+
});
|
| 162 |
+
}
|
| 163 |
+
/**
|
| 164 |
+
* Streams the results of a Message Batch as a `.jsonl` file.
|
| 165 |
+
*
|
| 166 |
+
* Each line in the file is a JSON object containing the result of a single request
|
| 167 |
+
* in the Message Batch. Results are not guaranteed to be in the same order as
|
| 168 |
+
* requests. Use the `custom_id` field to match results to requests.
|
| 169 |
+
*
|
| 170 |
+
* Learn more about the Message Batches API in our
|
| 171 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 172 |
+
*
|
| 173 |
+
* @example
|
| 174 |
+
* ```ts
|
| 175 |
+
* const betaMessageBatchIndividualResponse =
|
| 176 |
+
* await client.beta.messages.batches.results(
|
| 177 |
+
* 'message_batch_id',
|
| 178 |
+
* );
|
| 179 |
+
* ```
|
| 180 |
+
*/
|
| 181 |
+
async results(messageBatchID, params = {}, options) {
|
| 182 |
+
const batch = await this.retrieve(messageBatchID);
|
| 183 |
+
if (!batch.results_url) {
|
| 184 |
+
throw new error_1.AnthropicError(`No batch \`results_url\`; Has it finished processing? ${batch.processing_status} - ${batch.id}`);
|
| 185 |
+
}
|
| 186 |
+
const { betas } = params ?? {};
|
| 187 |
+
return this._client
|
| 188 |
+
.get(batch.results_url, {
|
| 189 |
+
...options,
|
| 190 |
+
headers: (0, headers_1.buildHeaders)([
|
| 191 |
+
{
|
| 192 |
+
'anthropic-beta': [...(betas ?? []), 'message-batches-2024-09-24'].toString(),
|
| 193 |
+
Accept: 'application/binary',
|
| 194 |
+
},
|
| 195 |
+
options?.headers,
|
| 196 |
+
]),
|
| 197 |
+
stream: true,
|
| 198 |
+
__binaryResponse: true,
|
| 199 |
+
})
|
| 200 |
+
._thenUnwrap((_, props) => jsonl_1.JSONLDecoder.fromResponse(props.response, props.controller));
|
| 201 |
+
}
|
| 202 |
+
}
|
| 203 |
+
exports.Batches = Batches;
|
| 204 |
+
//# sourceMappingURL=batches.js.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts
ADDED
|
@@ -0,0 +1,1566 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { APIResource } from "../../../core/resource.mjs";
|
| 2 |
+
import * as MessagesMessagesAPI from "./messages.mjs";
|
| 3 |
+
import * as BetaAPI from "../beta.mjs";
|
| 4 |
+
import * as MessagesAPI from "../../messages/messages.mjs";
|
| 5 |
+
import * as BatchesAPI from "./batches.mjs";
|
| 6 |
+
import { BatchCancelParams, BatchCreateParams, BatchDeleteParams, BatchListParams, BatchResultsParams, BatchRetrieveParams, Batches, BetaDeletedMessageBatch, BetaMessageBatch, BetaMessageBatchCanceledResult, BetaMessageBatchErroredResult, BetaMessageBatchExpiredResult, BetaMessageBatchIndividualResponse, BetaMessageBatchRequestCounts, BetaMessageBatchResult, BetaMessageBatchSucceededResult, BetaMessageBatchesPage } from "./batches.mjs";
|
| 7 |
+
import { APIPromise } from "../../../core/api-promise.mjs";
|
| 8 |
+
import { Stream } from "../../../core/streaming.mjs";
|
| 9 |
+
import { RequestOptions } from "../../../internal/request-options.mjs";
|
| 10 |
+
import { BetaMessageStream } from "../../../lib/BetaMessageStream.mjs";
|
| 11 |
+
export declare class Messages extends APIResource {
|
| 12 |
+
batches: BatchesAPI.Batches;
|
| 13 |
+
/**
|
| 14 |
+
* Send a structured list of input messages with text and/or image content, and the
|
| 15 |
+
* model will generate the next message in the conversation.
|
| 16 |
+
*
|
| 17 |
+
* The Messages API can be used for either single queries or stateless multi-turn
|
| 18 |
+
* conversations.
|
| 19 |
+
*
|
| 20 |
+
* Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
| 21 |
+
*
|
| 22 |
+
* @example
|
| 23 |
+
* ```ts
|
| 24 |
+
* const betaMessage = await client.beta.messages.create({
|
| 25 |
+
* max_tokens: 1024,
|
| 26 |
+
* messages: [{ content: 'Hello, world', role: 'user' }],
|
| 27 |
+
* model: 'claude-3-7-sonnet-20250219',
|
| 28 |
+
* });
|
| 29 |
+
* ```
|
| 30 |
+
*/
|
| 31 |
+
create(params: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<BetaMessage>;
|
| 32 |
+
create(params: MessageCreateParamsStreaming, options?: RequestOptions): APIPromise<Stream<BetaRawMessageStreamEvent>>;
|
| 33 |
+
create(params: MessageCreateParamsBase, options?: RequestOptions): APIPromise<Stream<BetaRawMessageStreamEvent> | BetaMessage>;
|
| 34 |
+
/**
|
| 35 |
+
* Create a Message stream
|
| 36 |
+
*/
|
| 37 |
+
stream(body: BetaMessageStreamParams, options?: RequestOptions): BetaMessageStream;
|
| 38 |
+
/**
|
| 39 |
+
* Count the number of tokens in a Message.
|
| 40 |
+
*
|
| 41 |
+
* The Token Count API can be used to count the number of tokens in a Message,
|
| 42 |
+
* including tools, images, and documents, without creating it.
|
| 43 |
+
*
|
| 44 |
+
* Learn more about token counting in our
|
| 45 |
+
* [user guide](/en/docs/build-with-claude/token-counting)
|
| 46 |
+
*
|
| 47 |
+
* @example
|
| 48 |
+
* ```ts
|
| 49 |
+
* const betaMessageTokensCount =
|
| 50 |
+
* await client.beta.messages.countTokens({
|
| 51 |
+
* messages: [{ content: 'string', role: 'user' }],
|
| 52 |
+
* model: 'claude-3-7-sonnet-latest',
|
| 53 |
+
* });
|
| 54 |
+
* ```
|
| 55 |
+
*/
|
| 56 |
+
countTokens(params: MessageCountTokensParams, options?: RequestOptions): APIPromise<BetaMessageTokensCount>;
|
| 57 |
+
}
|
| 58 |
+
export type BetaMessageStreamParams = MessageCreateParamsBase;
|
| 59 |
+
export interface BetaBase64ImageSource {
|
| 60 |
+
data: string;
|
| 61 |
+
media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
|
| 62 |
+
type: 'base64';
|
| 63 |
+
}
|
| 64 |
+
export interface BetaBase64PDFSource {
|
| 65 |
+
data: string;
|
| 66 |
+
media_type: 'application/pdf';
|
| 67 |
+
type: 'base64';
|
| 68 |
+
}
|
| 69 |
+
export interface BetaCacheControlEphemeral {
|
| 70 |
+
type: 'ephemeral';
|
| 71 |
+
/**
|
| 72 |
+
* The time-to-live for the cache control breakpoint.
|
| 73 |
+
*
|
| 74 |
+
* This may be one the following values:
|
| 75 |
+
*
|
| 76 |
+
* - `5m`: 5 minutes
|
| 77 |
+
* - `1h`: 1 hour
|
| 78 |
+
*
|
| 79 |
+
* Defaults to `5m`.
|
| 80 |
+
*/
|
| 81 |
+
ttl?: '5m' | '1h';
|
| 82 |
+
}
|
| 83 |
+
export interface BetaCacheCreation {
|
| 84 |
+
/**
|
| 85 |
+
* The number of input tokens used to create the 1 hour cache entry.
|
| 86 |
+
*/
|
| 87 |
+
ephemeral_1h_input_tokens: number;
|
| 88 |
+
/**
|
| 89 |
+
* The number of input tokens used to create the 5 minute cache entry.
|
| 90 |
+
*/
|
| 91 |
+
ephemeral_5m_input_tokens: number;
|
| 92 |
+
}
|
| 93 |
+
export interface BetaCitationCharLocation {
|
| 94 |
+
cited_text: string;
|
| 95 |
+
document_index: number;
|
| 96 |
+
document_title: string | null;
|
| 97 |
+
end_char_index: number;
|
| 98 |
+
start_char_index: number;
|
| 99 |
+
type: 'char_location';
|
| 100 |
+
}
|
| 101 |
+
export interface BetaCitationCharLocationParam {
|
| 102 |
+
cited_text: string;
|
| 103 |
+
document_index: number;
|
| 104 |
+
document_title: string | null;
|
| 105 |
+
end_char_index: number;
|
| 106 |
+
start_char_index: number;
|
| 107 |
+
type: 'char_location';
|
| 108 |
+
}
|
| 109 |
+
export interface BetaCitationContentBlockLocation {
|
| 110 |
+
cited_text: string;
|
| 111 |
+
document_index: number;
|
| 112 |
+
document_title: string | null;
|
| 113 |
+
end_block_index: number;
|
| 114 |
+
start_block_index: number;
|
| 115 |
+
type: 'content_block_location';
|
| 116 |
+
}
|
| 117 |
+
export interface BetaCitationContentBlockLocationParam {
|
| 118 |
+
cited_text: string;
|
| 119 |
+
document_index: number;
|
| 120 |
+
document_title: string | null;
|
| 121 |
+
end_block_index: number;
|
| 122 |
+
start_block_index: number;
|
| 123 |
+
type: 'content_block_location';
|
| 124 |
+
}
|
| 125 |
+
export interface BetaCitationPageLocation {
|
| 126 |
+
cited_text: string;
|
| 127 |
+
document_index: number;
|
| 128 |
+
document_title: string | null;
|
| 129 |
+
end_page_number: number;
|
| 130 |
+
start_page_number: number;
|
| 131 |
+
type: 'page_location';
|
| 132 |
+
}
|
| 133 |
+
export interface BetaCitationPageLocationParam {
|
| 134 |
+
cited_text: string;
|
| 135 |
+
document_index: number;
|
| 136 |
+
document_title: string | null;
|
| 137 |
+
end_page_number: number;
|
| 138 |
+
start_page_number: number;
|
| 139 |
+
type: 'page_location';
|
| 140 |
+
}
|
| 141 |
+
export interface BetaCitationWebSearchResultLocationParam {
|
| 142 |
+
cited_text: string;
|
| 143 |
+
encrypted_index: string;
|
| 144 |
+
title: string | null;
|
| 145 |
+
type: 'web_search_result_location';
|
| 146 |
+
url: string;
|
| 147 |
+
}
|
| 148 |
+
export interface BetaCitationsConfigParam {
|
| 149 |
+
enabled?: boolean;
|
| 150 |
+
}
|
| 151 |
+
export interface BetaCitationsDelta {
|
| 152 |
+
citation: BetaCitationCharLocation | BetaCitationPageLocation | BetaCitationContentBlockLocation | BetaCitationsWebSearchResultLocation;
|
| 153 |
+
type: 'citations_delta';
|
| 154 |
+
}
|
| 155 |
+
export interface BetaCitationsWebSearchResultLocation {
|
| 156 |
+
cited_text: string;
|
| 157 |
+
encrypted_index: string;
|
| 158 |
+
title: string | null;
|
| 159 |
+
type: 'web_search_result_location';
|
| 160 |
+
url: string;
|
| 161 |
+
}
|
| 162 |
+
export interface BetaCodeExecutionOutputBlock {
|
| 163 |
+
file_id: string;
|
| 164 |
+
type: 'code_execution_output';
|
| 165 |
+
}
|
| 166 |
+
export interface BetaCodeExecutionOutputBlockParam {
|
| 167 |
+
file_id: string;
|
| 168 |
+
type: 'code_execution_output';
|
| 169 |
+
}
|
| 170 |
+
export interface BetaCodeExecutionResultBlock {
|
| 171 |
+
content: Array<BetaCodeExecutionOutputBlock>;
|
| 172 |
+
return_code: number;
|
| 173 |
+
stderr: string;
|
| 174 |
+
stdout: string;
|
| 175 |
+
type: 'code_execution_result';
|
| 176 |
+
}
|
| 177 |
+
export interface BetaCodeExecutionResultBlockParam {
|
| 178 |
+
content: Array<BetaCodeExecutionOutputBlockParam>;
|
| 179 |
+
return_code: number;
|
| 180 |
+
stderr: string;
|
| 181 |
+
stdout: string;
|
| 182 |
+
type: 'code_execution_result';
|
| 183 |
+
}
|
| 184 |
+
export interface BetaCodeExecutionTool20250522 {
|
| 185 |
+
/**
|
| 186 |
+
* Name of the tool.
|
| 187 |
+
*
|
| 188 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 189 |
+
*/
|
| 190 |
+
name: 'code_execution';
|
| 191 |
+
type: 'code_execution_20250522';
|
| 192 |
+
/**
|
| 193 |
+
* Create a cache control breakpoint at this content block.
|
| 194 |
+
*/
|
| 195 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 196 |
+
}
|
| 197 |
+
export interface BetaCodeExecutionToolResultBlock {
|
| 198 |
+
content: BetaCodeExecutionToolResultBlockContent;
|
| 199 |
+
tool_use_id: string;
|
| 200 |
+
type: 'code_execution_tool_result';
|
| 201 |
+
}
|
| 202 |
+
export type BetaCodeExecutionToolResultBlockContent = BetaCodeExecutionToolResultError | BetaCodeExecutionResultBlock;
|
| 203 |
+
export interface BetaCodeExecutionToolResultBlockParam {
|
| 204 |
+
content: BetaCodeExecutionToolResultBlockParamContent;
|
| 205 |
+
tool_use_id: string;
|
| 206 |
+
type: 'code_execution_tool_result';
|
| 207 |
+
/**
|
| 208 |
+
* Create a cache control breakpoint at this content block.
|
| 209 |
+
*/
|
| 210 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 211 |
+
}
|
| 212 |
+
export type BetaCodeExecutionToolResultBlockParamContent = BetaCodeExecutionToolResultErrorParam | BetaCodeExecutionResultBlockParam;
|
| 213 |
+
export interface BetaCodeExecutionToolResultError {
|
| 214 |
+
error_code: BetaCodeExecutionToolResultErrorCode;
|
| 215 |
+
type: 'code_execution_tool_result_error';
|
| 216 |
+
}
|
| 217 |
+
export type BetaCodeExecutionToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'too_many_requests' | 'execution_time_exceeded';
|
| 218 |
+
export interface BetaCodeExecutionToolResultErrorParam {
|
| 219 |
+
error_code: BetaCodeExecutionToolResultErrorCode;
|
| 220 |
+
type: 'code_execution_tool_result_error';
|
| 221 |
+
}
|
| 222 |
+
/**
|
| 223 |
+
* Information about the container used in the request (for the code execution
|
| 224 |
+
* tool)
|
| 225 |
+
*/
|
| 226 |
+
export interface BetaContainer {
|
| 227 |
+
/**
|
| 228 |
+
* Identifier for the container used in this request
|
| 229 |
+
*/
|
| 230 |
+
id: string;
|
| 231 |
+
/**
|
| 232 |
+
* The time at which the container will expire.
|
| 233 |
+
*/
|
| 234 |
+
expires_at: string;
|
| 235 |
+
}
|
| 236 |
+
/**
|
| 237 |
+
* Response model for a file uploaded to the container.
|
| 238 |
+
*/
|
| 239 |
+
export interface BetaContainerUploadBlock {
|
| 240 |
+
file_id: string;
|
| 241 |
+
type: 'container_upload';
|
| 242 |
+
}
|
| 243 |
+
/**
|
| 244 |
+
* A content block that represents a file to be uploaded to the container Files
|
| 245 |
+
* uploaded via this block will be available in the container's input directory.
|
| 246 |
+
*/
|
| 247 |
+
export interface BetaContainerUploadBlockParam {
|
| 248 |
+
file_id: string;
|
| 249 |
+
type: 'container_upload';
|
| 250 |
+
/**
|
| 251 |
+
* Create a cache control breakpoint at this content block.
|
| 252 |
+
*/
|
| 253 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 254 |
+
}
|
| 255 |
+
/**
|
| 256 |
+
* Response model for a file uploaded to the container.
|
| 257 |
+
*/
|
| 258 |
+
export type BetaContentBlock = BetaTextBlock | BetaToolUseBlock | BetaServerToolUseBlock | BetaWebSearchToolResultBlock | BetaCodeExecutionToolResultBlock | BetaMCPToolUseBlock | BetaMCPToolResultBlock | BetaContainerUploadBlock | BetaThinkingBlock | BetaRedactedThinkingBlock;
|
| 259 |
+
/**
|
| 260 |
+
* Regular text content.
|
| 261 |
+
*/
|
| 262 |
+
export type BetaContentBlockParam = BetaServerToolUseBlockParam | BetaWebSearchToolResultBlockParam | BetaCodeExecutionToolResultBlockParam | BetaMCPToolUseBlockParam | BetaRequestMCPToolResultBlockParam | BetaTextBlockParam | BetaImageBlockParam | BetaToolUseBlockParam | BetaToolResultBlockParam | BetaRequestDocumentBlock | BetaThinkingBlockParam | BetaRedactedThinkingBlockParam | BetaContainerUploadBlockParam;
|
| 263 |
+
export interface BetaContentBlockSource {
|
| 264 |
+
content: string | Array<BetaContentBlockSourceContent>;
|
| 265 |
+
type: 'content';
|
| 266 |
+
}
|
| 267 |
+
export type BetaContentBlockSourceContent = BetaTextBlockParam | BetaImageBlockParam;
|
| 268 |
+
export interface BetaFileDocumentSource {
|
| 269 |
+
file_id: string;
|
| 270 |
+
type: 'file';
|
| 271 |
+
}
|
| 272 |
+
export interface BetaFileImageSource {
|
| 273 |
+
file_id: string;
|
| 274 |
+
type: 'file';
|
| 275 |
+
}
|
| 276 |
+
export interface BetaImageBlockParam {
|
| 277 |
+
source: BetaBase64ImageSource | BetaURLImageSource | BetaFileImageSource;
|
| 278 |
+
type: 'image';
|
| 279 |
+
/**
|
| 280 |
+
* Create a cache control breakpoint at this content block.
|
| 281 |
+
*/
|
| 282 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 283 |
+
}
|
| 284 |
+
export interface BetaInputJSONDelta {
|
| 285 |
+
partial_json: string;
|
| 286 |
+
type: 'input_json_delta';
|
| 287 |
+
}
|
| 288 |
+
export interface BetaMCPToolResultBlock {
|
| 289 |
+
content: string | Array<BetaTextBlock>;
|
| 290 |
+
is_error: boolean;
|
| 291 |
+
tool_use_id: string;
|
| 292 |
+
type: 'mcp_tool_result';
|
| 293 |
+
}
|
| 294 |
+
export interface BetaMCPToolUseBlock {
|
| 295 |
+
id: string;
|
| 296 |
+
input: unknown;
|
| 297 |
+
/**
|
| 298 |
+
* The name of the MCP tool
|
| 299 |
+
*/
|
| 300 |
+
name: string;
|
| 301 |
+
/**
|
| 302 |
+
* The name of the MCP server
|
| 303 |
+
*/
|
| 304 |
+
server_name: string;
|
| 305 |
+
type: 'mcp_tool_use';
|
| 306 |
+
}
|
| 307 |
+
export interface BetaMCPToolUseBlockParam {
|
| 308 |
+
id: string;
|
| 309 |
+
input: unknown;
|
| 310 |
+
name: string;
|
| 311 |
+
/**
|
| 312 |
+
* The name of the MCP server
|
| 313 |
+
*/
|
| 314 |
+
server_name: string;
|
| 315 |
+
type: 'mcp_tool_use';
|
| 316 |
+
/**
|
| 317 |
+
* Create a cache control breakpoint at this content block.
|
| 318 |
+
*/
|
| 319 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 320 |
+
}
|
| 321 |
+
export interface BetaMessage {
|
| 322 |
+
/**
|
| 323 |
+
* Unique object identifier.
|
| 324 |
+
*
|
| 325 |
+
* The format and length of IDs may change over time.
|
| 326 |
+
*/
|
| 327 |
+
id: string;
|
| 328 |
+
/**
|
| 329 |
+
* Information about the container used in the request (for the code execution
|
| 330 |
+
* tool)
|
| 331 |
+
*/
|
| 332 |
+
container: BetaContainer | null;
|
| 333 |
+
/**
|
| 334 |
+
* Content generated by the model.
|
| 335 |
+
*
|
| 336 |
+
* This is an array of content blocks, each of which has a `type` that determines
|
| 337 |
+
* its shape.
|
| 338 |
+
*
|
| 339 |
+
* Example:
|
| 340 |
+
*
|
| 341 |
+
* ```json
|
| 342 |
+
* [{ "type": "text", "text": "Hi, I'm Claude." }]
|
| 343 |
+
* ```
|
| 344 |
+
*
|
| 345 |
+
* If the request input `messages` ended with an `assistant` turn, then the
|
| 346 |
+
* response `content` will continue directly from that last turn. You can use this
|
| 347 |
+
* to constrain the model's output.
|
| 348 |
+
*
|
| 349 |
+
* For example, if the input `messages` were:
|
| 350 |
+
*
|
| 351 |
+
* ```json
|
| 352 |
+
* [
|
| 353 |
+
* {
|
| 354 |
+
* "role": "user",
|
| 355 |
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
| 356 |
+
* },
|
| 357 |
+
* { "role": "assistant", "content": "The best answer is (" }
|
| 358 |
+
* ]
|
| 359 |
+
* ```
|
| 360 |
+
*
|
| 361 |
+
* Then the response `content` might be:
|
| 362 |
+
*
|
| 363 |
+
* ```json
|
| 364 |
+
* [{ "type": "text", "text": "B)" }]
|
| 365 |
+
* ```
|
| 366 |
+
*/
|
| 367 |
+
content: Array<BetaContentBlock>;
|
| 368 |
+
/**
|
| 369 |
+
* The model that will complete your prompt.\n\nSee
|
| 370 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 371 |
+
* details and options.
|
| 372 |
+
*/
|
| 373 |
+
model: MessagesAPI.Model;
|
| 374 |
+
/**
|
| 375 |
+
* Conversational role of the generated message.
|
| 376 |
+
*
|
| 377 |
+
* This will always be `"assistant"`.
|
| 378 |
+
*/
|
| 379 |
+
role: 'assistant';
|
| 380 |
+
/**
|
| 381 |
+
* The reason that we stopped.
|
| 382 |
+
*
|
| 383 |
+
* This may be one the following values:
|
| 384 |
+
*
|
| 385 |
+
* - `"end_turn"`: the model reached a natural stopping point
|
| 386 |
+
* - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
| 387 |
+
* - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
| 388 |
+
* - `"tool_use"`: the model invoked one or more tools
|
| 389 |
+
*
|
| 390 |
+
* In non-streaming mode this value is always non-null. In streaming mode, it is
|
| 391 |
+
* null in the `message_start` event and non-null otherwise.
|
| 392 |
+
*/
|
| 393 |
+
stop_reason: BetaStopReason | null;
|
| 394 |
+
/**
|
| 395 |
+
* Which custom stop sequence was generated, if any.
|
| 396 |
+
*
|
| 397 |
+
* This value will be a non-null string if one of your custom stop sequences was
|
| 398 |
+
* generated.
|
| 399 |
+
*/
|
| 400 |
+
stop_sequence: string | null;
|
| 401 |
+
/**
|
| 402 |
+
* Object type.
|
| 403 |
+
*
|
| 404 |
+
* For Messages, this is always `"message"`.
|
| 405 |
+
*/
|
| 406 |
+
type: 'message';
|
| 407 |
+
/**
|
| 408 |
+
* Billing and rate-limit usage.
|
| 409 |
+
*
|
| 410 |
+
* Anthropic's API bills and rate-limits by token counts, as tokens represent the
|
| 411 |
+
* underlying cost to our systems.
|
| 412 |
+
*
|
| 413 |
+
* Under the hood, the API transforms requests into a format suitable for the
|
| 414 |
+
* model. The model's output then goes through a parsing stage before becoming an
|
| 415 |
+
* API response. As a result, the token counts in `usage` will not match one-to-one
|
| 416 |
+
* with the exact visible content of an API request or response.
|
| 417 |
+
*
|
| 418 |
+
* For example, `output_tokens` will be non-zero, even for an empty string response
|
| 419 |
+
* from Claude.
|
| 420 |
+
*
|
| 421 |
+
* Total input tokens in a request is the summation of `input_tokens`,
|
| 422 |
+
* `cache_creation_input_tokens`, and `cache_read_input_tokens`.
|
| 423 |
+
*/
|
| 424 |
+
usage: BetaUsage;
|
| 425 |
+
}
|
| 426 |
+
export interface BetaMessageDeltaUsage {
|
| 427 |
+
/**
|
| 428 |
+
* The cumulative number of input tokens used to create the cache entry.
|
| 429 |
+
*/
|
| 430 |
+
cache_creation_input_tokens: number | null;
|
| 431 |
+
/**
|
| 432 |
+
* The cumulative number of input tokens read from the cache.
|
| 433 |
+
*/
|
| 434 |
+
cache_read_input_tokens: number | null;
|
| 435 |
+
/**
|
| 436 |
+
* The cumulative number of input tokens which were used.
|
| 437 |
+
*/
|
| 438 |
+
input_tokens: number | null;
|
| 439 |
+
/**
|
| 440 |
+
* The cumulative number of output tokens which were used.
|
| 441 |
+
*/
|
| 442 |
+
output_tokens: number;
|
| 443 |
+
/**
|
| 444 |
+
* The number of server tool requests.
|
| 445 |
+
*/
|
| 446 |
+
server_tool_use: BetaServerToolUsage | null;
|
| 447 |
+
}
|
| 448 |
+
export interface BetaMessageParam {
|
| 449 |
+
content: string | Array<BetaContentBlockParam>;
|
| 450 |
+
role: 'user' | 'assistant';
|
| 451 |
+
}
|
| 452 |
+
export interface BetaMessageTokensCount {
|
| 453 |
+
/**
|
| 454 |
+
* The total number of tokens across the provided list of messages, system prompt,
|
| 455 |
+
* and tools.
|
| 456 |
+
*/
|
| 457 |
+
input_tokens: number;
|
| 458 |
+
}
|
| 459 |
+
export interface BetaMetadata {
|
| 460 |
+
/**
|
| 461 |
+
* An external identifier for the user who is associated with the request.
|
| 462 |
+
*
|
| 463 |
+
* This should be a uuid, hash value, or other opaque identifier. Anthropic may use
|
| 464 |
+
* this id to help detect abuse. Do not include any identifying information such as
|
| 465 |
+
* name, email address, or phone number.
|
| 466 |
+
*/
|
| 467 |
+
user_id?: string | null;
|
| 468 |
+
}
|
| 469 |
+
export interface BetaPlainTextSource {
|
| 470 |
+
data: string;
|
| 471 |
+
media_type: 'text/plain';
|
| 472 |
+
type: 'text';
|
| 473 |
+
}
|
| 474 |
+
export type BetaRawContentBlockDelta = BetaTextDelta | BetaInputJSONDelta | BetaCitationsDelta | BetaThinkingDelta | BetaSignatureDelta;
|
| 475 |
+
export interface BetaRawContentBlockDeltaEvent {
|
| 476 |
+
delta: BetaRawContentBlockDelta;
|
| 477 |
+
index: number;
|
| 478 |
+
type: 'content_block_delta';
|
| 479 |
+
}
|
| 480 |
+
export interface BetaRawContentBlockStartEvent {
|
| 481 |
+
/**
|
| 482 |
+
* Response model for a file uploaded to the container.
|
| 483 |
+
*/
|
| 484 |
+
content_block: BetaTextBlock | BetaToolUseBlock | BetaServerToolUseBlock | BetaWebSearchToolResultBlock | BetaCodeExecutionToolResultBlock | BetaMCPToolUseBlock | BetaMCPToolResultBlock | BetaContainerUploadBlock | BetaThinkingBlock | BetaRedactedThinkingBlock;
|
| 485 |
+
index: number;
|
| 486 |
+
type: 'content_block_start';
|
| 487 |
+
}
|
| 488 |
+
export interface BetaRawContentBlockStopEvent {
|
| 489 |
+
index: number;
|
| 490 |
+
type: 'content_block_stop';
|
| 491 |
+
}
|
| 492 |
+
export interface BetaRawMessageDeltaEvent {
|
| 493 |
+
delta: BetaRawMessageDeltaEvent.Delta;
|
| 494 |
+
type: 'message_delta';
|
| 495 |
+
/**
|
| 496 |
+
* Billing and rate-limit usage.
|
| 497 |
+
*
|
| 498 |
+
* Anthropic's API bills and rate-limits by token counts, as tokens represent the
|
| 499 |
+
* underlying cost to our systems.
|
| 500 |
+
*
|
| 501 |
+
* Under the hood, the API transforms requests into a format suitable for the
|
| 502 |
+
* model. The model's output then goes through a parsing stage before becoming an
|
| 503 |
+
* API response. As a result, the token counts in `usage` will not match one-to-one
|
| 504 |
+
* with the exact visible content of an API request or response.
|
| 505 |
+
*
|
| 506 |
+
* For example, `output_tokens` will be non-zero, even for an empty string response
|
| 507 |
+
* from Claude.
|
| 508 |
+
*
|
| 509 |
+
* Total input tokens in a request is the summation of `input_tokens`,
|
| 510 |
+
* `cache_creation_input_tokens`, and `cache_read_input_tokens`.
|
| 511 |
+
*/
|
| 512 |
+
usage: BetaMessageDeltaUsage;
|
| 513 |
+
}
|
| 514 |
+
export declare namespace BetaRawMessageDeltaEvent {
|
| 515 |
+
interface Delta {
|
| 516 |
+
/**
|
| 517 |
+
* Information about the container used in the request (for the code execution
|
| 518 |
+
* tool)
|
| 519 |
+
*/
|
| 520 |
+
container: MessagesMessagesAPI.BetaContainer | null;
|
| 521 |
+
stop_reason: MessagesMessagesAPI.BetaStopReason | null;
|
| 522 |
+
stop_sequence: string | null;
|
| 523 |
+
}
|
| 524 |
+
}
|
| 525 |
+
export interface BetaRawMessageStartEvent {
|
| 526 |
+
message: BetaMessage;
|
| 527 |
+
type: 'message_start';
|
| 528 |
+
}
|
| 529 |
+
export interface BetaRawMessageStopEvent {
|
| 530 |
+
type: 'message_stop';
|
| 531 |
+
}
|
| 532 |
+
export type BetaRawMessageStreamEvent = BetaRawMessageStartEvent | BetaRawMessageDeltaEvent | BetaRawMessageStopEvent | BetaRawContentBlockStartEvent | BetaRawContentBlockDeltaEvent | BetaRawContentBlockStopEvent;
|
| 533 |
+
export interface BetaRedactedThinkingBlock {
|
| 534 |
+
data: string;
|
| 535 |
+
type: 'redacted_thinking';
|
| 536 |
+
}
|
| 537 |
+
export interface BetaRedactedThinkingBlockParam {
|
| 538 |
+
data: string;
|
| 539 |
+
type: 'redacted_thinking';
|
| 540 |
+
}
|
| 541 |
+
export interface BetaRequestDocumentBlock {
|
| 542 |
+
source: BetaBase64PDFSource | BetaPlainTextSource | BetaContentBlockSource | BetaURLPDFSource | BetaFileDocumentSource;
|
| 543 |
+
type: 'document';
|
| 544 |
+
/**
|
| 545 |
+
* Create a cache control breakpoint at this content block.
|
| 546 |
+
*/
|
| 547 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 548 |
+
citations?: BetaCitationsConfigParam;
|
| 549 |
+
context?: string | null;
|
| 550 |
+
title?: string | null;
|
| 551 |
+
}
|
| 552 |
+
export interface BetaRequestMCPServerToolConfiguration {
|
| 553 |
+
allowed_tools?: Array<string> | null;
|
| 554 |
+
enabled?: boolean | null;
|
| 555 |
+
}
|
| 556 |
+
export interface BetaRequestMCPServerURLDefinition {
|
| 557 |
+
name: string;
|
| 558 |
+
type: 'url';
|
| 559 |
+
url: string;
|
| 560 |
+
authorization_token?: string | null;
|
| 561 |
+
tool_configuration?: BetaRequestMCPServerToolConfiguration | null;
|
| 562 |
+
}
|
| 563 |
+
export interface BetaRequestMCPToolResultBlockParam {
|
| 564 |
+
tool_use_id: string;
|
| 565 |
+
type: 'mcp_tool_result';
|
| 566 |
+
/**
|
| 567 |
+
* Create a cache control breakpoint at this content block.
|
| 568 |
+
*/
|
| 569 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 570 |
+
content?: string | Array<BetaTextBlockParam>;
|
| 571 |
+
is_error?: boolean;
|
| 572 |
+
}
|
| 573 |
+
export interface BetaServerToolUsage {
|
| 574 |
+
/**
|
| 575 |
+
* The number of web search tool requests.
|
| 576 |
+
*/
|
| 577 |
+
web_search_requests: number;
|
| 578 |
+
}
|
| 579 |
+
export interface BetaServerToolUseBlock {
|
| 580 |
+
id: string;
|
| 581 |
+
input: unknown;
|
| 582 |
+
name: 'web_search' | 'code_execution';
|
| 583 |
+
type: 'server_tool_use';
|
| 584 |
+
}
|
| 585 |
+
export interface BetaServerToolUseBlockParam {
|
| 586 |
+
id: string;
|
| 587 |
+
input: unknown;
|
| 588 |
+
name: 'web_search' | 'code_execution';
|
| 589 |
+
type: 'server_tool_use';
|
| 590 |
+
/**
|
| 591 |
+
* Create a cache control breakpoint at this content block.
|
| 592 |
+
*/
|
| 593 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 594 |
+
}
|
| 595 |
+
export interface BetaSignatureDelta {
|
| 596 |
+
signature: string;
|
| 597 |
+
type: 'signature_delta';
|
| 598 |
+
}
|
| 599 |
+
export type BetaStopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'refusal';
|
| 600 |
+
export interface BetaTextBlock {
|
| 601 |
+
/**
|
| 602 |
+
* Citations supporting the text block.
|
| 603 |
+
*
|
| 604 |
+
* The type of citation returned will depend on the type of document being cited.
|
| 605 |
+
* Citing a PDF results in `page_location`, plain text results in `char_location`,
|
| 606 |
+
* and content document results in `content_block_location`.
|
| 607 |
+
*/
|
| 608 |
+
citations: Array<BetaTextCitation> | null;
|
| 609 |
+
text: string;
|
| 610 |
+
type: 'text';
|
| 611 |
+
}
|
| 612 |
+
export interface BetaTextBlockParam {
|
| 613 |
+
text: string;
|
| 614 |
+
type: 'text';
|
| 615 |
+
/**
|
| 616 |
+
* Create a cache control breakpoint at this content block.
|
| 617 |
+
*/
|
| 618 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 619 |
+
citations?: Array<BetaTextCitationParam> | null;
|
| 620 |
+
}
|
| 621 |
+
export type BetaTextCitation = BetaCitationCharLocation | BetaCitationPageLocation | BetaCitationContentBlockLocation | BetaCitationsWebSearchResultLocation;
|
| 622 |
+
export type BetaTextCitationParam = BetaCitationCharLocationParam | BetaCitationPageLocationParam | BetaCitationContentBlockLocationParam | BetaCitationWebSearchResultLocationParam;
|
| 623 |
+
export interface BetaTextDelta {
|
| 624 |
+
text: string;
|
| 625 |
+
type: 'text_delta';
|
| 626 |
+
}
|
| 627 |
+
export interface BetaThinkingBlock {
|
| 628 |
+
signature: string;
|
| 629 |
+
thinking: string;
|
| 630 |
+
type: 'thinking';
|
| 631 |
+
}
|
| 632 |
+
export interface BetaThinkingBlockParam {
|
| 633 |
+
signature: string;
|
| 634 |
+
thinking: string;
|
| 635 |
+
type: 'thinking';
|
| 636 |
+
}
|
| 637 |
+
export interface BetaThinkingConfigDisabled {
|
| 638 |
+
type: 'disabled';
|
| 639 |
+
}
|
| 640 |
+
export interface BetaThinkingConfigEnabled {
|
| 641 |
+
/**
|
| 642 |
+
* Determines how many tokens Claude can use for its internal reasoning process.
|
| 643 |
+
* Larger budgets can enable more thorough analysis for complex problems, improving
|
| 644 |
+
* response quality.
|
| 645 |
+
*
|
| 646 |
+
* Must be ≥1024 and less than `max_tokens`.
|
| 647 |
+
*
|
| 648 |
+
* See
|
| 649 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 650 |
+
* for details.
|
| 651 |
+
*/
|
| 652 |
+
budget_tokens: number;
|
| 653 |
+
type: 'enabled';
|
| 654 |
+
}
|
| 655 |
+
/**
|
| 656 |
+
* Configuration for enabling Claude's extended thinking.
|
| 657 |
+
*
|
| 658 |
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
| 659 |
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
| 660 |
+
* tokens and counts towards your `max_tokens` limit.
|
| 661 |
+
*
|
| 662 |
+
* See
|
| 663 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 664 |
+
* for details.
|
| 665 |
+
*/
|
| 666 |
+
export type BetaThinkingConfigParam = BetaThinkingConfigEnabled | BetaThinkingConfigDisabled;
|
| 667 |
+
export interface BetaThinkingDelta {
|
| 668 |
+
thinking: string;
|
| 669 |
+
type: 'thinking_delta';
|
| 670 |
+
}
|
| 671 |
+
export interface BetaTool {
|
| 672 |
+
/**
|
| 673 |
+
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
| 674 |
+
*
|
| 675 |
+
* This defines the shape of the `input` that your tool accepts and that the model
|
| 676 |
+
* will produce.
|
| 677 |
+
*/
|
| 678 |
+
input_schema: BetaTool.InputSchema;
|
| 679 |
+
/**
|
| 680 |
+
* Name of the tool.
|
| 681 |
+
*
|
| 682 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 683 |
+
*/
|
| 684 |
+
name: string;
|
| 685 |
+
/**
|
| 686 |
+
* Create a cache control breakpoint at this content block.
|
| 687 |
+
*/
|
| 688 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 689 |
+
/**
|
| 690 |
+
* Description of what this tool does.
|
| 691 |
+
*
|
| 692 |
+
* Tool descriptions should be as detailed as possible. The more information that
|
| 693 |
+
* the model has about what the tool is and how to use it, the better it will
|
| 694 |
+
* perform. You can use natural language descriptions to reinforce important
|
| 695 |
+
* aspects of the tool input JSON schema.
|
| 696 |
+
*/
|
| 697 |
+
description?: string;
|
| 698 |
+
type?: 'custom' | null;
|
| 699 |
+
}
|
| 700 |
+
export declare namespace BetaTool {
|
| 701 |
+
/**
|
| 702 |
+
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
| 703 |
+
*
|
| 704 |
+
* This defines the shape of the `input` that your tool accepts and that the model
|
| 705 |
+
* will produce.
|
| 706 |
+
*/
|
| 707 |
+
interface InputSchema {
|
| 708 |
+
type: 'object';
|
| 709 |
+
properties?: unknown | null;
|
| 710 |
+
required?: Array<string> | null;
|
| 711 |
+
[k: string]: unknown;
|
| 712 |
+
}
|
| 713 |
+
}
|
| 714 |
+
export interface BetaToolBash20241022 {
|
| 715 |
+
/**
|
| 716 |
+
* Name of the tool.
|
| 717 |
+
*
|
| 718 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 719 |
+
*/
|
| 720 |
+
name: 'bash';
|
| 721 |
+
type: 'bash_20241022';
|
| 722 |
+
/**
|
| 723 |
+
* Create a cache control breakpoint at this content block.
|
| 724 |
+
*/
|
| 725 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 726 |
+
}
|
| 727 |
+
export interface BetaToolBash20250124 {
|
| 728 |
+
/**
|
| 729 |
+
* Name of the tool.
|
| 730 |
+
*
|
| 731 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 732 |
+
*/
|
| 733 |
+
name: 'bash';
|
| 734 |
+
type: 'bash_20250124';
|
| 735 |
+
/**
|
| 736 |
+
* Create a cache control breakpoint at this content block.
|
| 737 |
+
*/
|
| 738 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 739 |
+
}
|
| 740 |
+
/**
|
| 741 |
+
* How the model should use the provided tools. The model can use a specific tool,
|
| 742 |
+
* any available tool, decide by itself, or not use tools at all.
|
| 743 |
+
*/
|
| 744 |
+
export type BetaToolChoice = BetaToolChoiceAuto | BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceNone;
|
| 745 |
+
/**
|
| 746 |
+
* The model will use any available tools.
|
| 747 |
+
*/
|
| 748 |
+
export interface BetaToolChoiceAny {
|
| 749 |
+
type: 'any';
|
| 750 |
+
/**
|
| 751 |
+
* Whether to disable parallel tool use.
|
| 752 |
+
*
|
| 753 |
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
|
| 754 |
+
* use.
|
| 755 |
+
*/
|
| 756 |
+
disable_parallel_tool_use?: boolean;
|
| 757 |
+
}
|
| 758 |
+
/**
|
| 759 |
+
* The model will automatically decide whether to use tools.
|
| 760 |
+
*/
|
| 761 |
+
export interface BetaToolChoiceAuto {
|
| 762 |
+
type: 'auto';
|
| 763 |
+
/**
|
| 764 |
+
* Whether to disable parallel tool use.
|
| 765 |
+
*
|
| 766 |
+
* Defaults to `false`. If set to `true`, the model will output at most one tool
|
| 767 |
+
* use.
|
| 768 |
+
*/
|
| 769 |
+
disable_parallel_tool_use?: boolean;
|
| 770 |
+
}
|
| 771 |
+
/**
|
| 772 |
+
* The model will not be allowed to use tools.
|
| 773 |
+
*/
|
| 774 |
+
export interface BetaToolChoiceNone {
|
| 775 |
+
type: 'none';
|
| 776 |
+
}
|
| 777 |
+
/**
|
| 778 |
+
* The model will use the specified tool with `tool_choice.name`.
|
| 779 |
+
*/
|
| 780 |
+
export interface BetaToolChoiceTool {
|
| 781 |
+
/**
|
| 782 |
+
* The name of the tool to use.
|
| 783 |
+
*/
|
| 784 |
+
name: string;
|
| 785 |
+
type: 'tool';
|
| 786 |
+
/**
|
| 787 |
+
* Whether to disable parallel tool use.
|
| 788 |
+
*
|
| 789 |
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
|
| 790 |
+
* use.
|
| 791 |
+
*/
|
| 792 |
+
disable_parallel_tool_use?: boolean;
|
| 793 |
+
}
|
| 794 |
+
export interface BetaToolComputerUse20241022 {
|
| 795 |
+
/**
|
| 796 |
+
* The height of the display in pixels.
|
| 797 |
+
*/
|
| 798 |
+
display_height_px: number;
|
| 799 |
+
/**
|
| 800 |
+
* The width of the display in pixels.
|
| 801 |
+
*/
|
| 802 |
+
display_width_px: number;
|
| 803 |
+
/**
|
| 804 |
+
* Name of the tool.
|
| 805 |
+
*
|
| 806 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 807 |
+
*/
|
| 808 |
+
name: 'computer';
|
| 809 |
+
type: 'computer_20241022';
|
| 810 |
+
/**
|
| 811 |
+
* Create a cache control breakpoint at this content block.
|
| 812 |
+
*/
|
| 813 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 814 |
+
/**
|
| 815 |
+
* The X11 display number (e.g. 0, 1) for the display.
|
| 816 |
+
*/
|
| 817 |
+
display_number?: number | null;
|
| 818 |
+
}
|
| 819 |
+
export interface BetaToolComputerUse20250124 {
|
| 820 |
+
/**
|
| 821 |
+
* The height of the display in pixels.
|
| 822 |
+
*/
|
| 823 |
+
display_height_px: number;
|
| 824 |
+
/**
|
| 825 |
+
* The width of the display in pixels.
|
| 826 |
+
*/
|
| 827 |
+
display_width_px: number;
|
| 828 |
+
/**
|
| 829 |
+
* Name of the tool.
|
| 830 |
+
*
|
| 831 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 832 |
+
*/
|
| 833 |
+
name: 'computer';
|
| 834 |
+
type: 'computer_20250124';
|
| 835 |
+
/**
|
| 836 |
+
* Create a cache control breakpoint at this content block.
|
| 837 |
+
*/
|
| 838 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 839 |
+
/**
|
| 840 |
+
* The X11 display number (e.g. 0, 1) for the display.
|
| 841 |
+
*/
|
| 842 |
+
display_number?: number | null;
|
| 843 |
+
}
|
| 844 |
+
export interface BetaToolResultBlockParam {
|
| 845 |
+
tool_use_id: string;
|
| 846 |
+
type: 'tool_result';
|
| 847 |
+
/**
|
| 848 |
+
* Create a cache control breakpoint at this content block.
|
| 849 |
+
*/
|
| 850 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 851 |
+
content?: string | Array<BetaTextBlockParam | BetaImageBlockParam>;
|
| 852 |
+
is_error?: boolean;
|
| 853 |
+
}
|
| 854 |
+
export interface BetaToolTextEditor20241022 {
|
| 855 |
+
/**
|
| 856 |
+
* Name of the tool.
|
| 857 |
+
*
|
| 858 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 859 |
+
*/
|
| 860 |
+
name: 'str_replace_editor';
|
| 861 |
+
type: 'text_editor_20241022';
|
| 862 |
+
/**
|
| 863 |
+
* Create a cache control breakpoint at this content block.
|
| 864 |
+
*/
|
| 865 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 866 |
+
}
|
| 867 |
+
export interface BetaToolTextEditor20250124 {
|
| 868 |
+
/**
|
| 869 |
+
* Name of the tool.
|
| 870 |
+
*
|
| 871 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 872 |
+
*/
|
| 873 |
+
name: 'str_replace_editor';
|
| 874 |
+
type: 'text_editor_20250124';
|
| 875 |
+
/**
|
| 876 |
+
* Create a cache control breakpoint at this content block.
|
| 877 |
+
*/
|
| 878 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 879 |
+
}
|
| 880 |
+
export interface BetaToolTextEditor20250429 {
|
| 881 |
+
/**
|
| 882 |
+
* Name of the tool.
|
| 883 |
+
*
|
| 884 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 885 |
+
*/
|
| 886 |
+
name: 'str_replace_based_edit_tool';
|
| 887 |
+
type: 'text_editor_20250429';
|
| 888 |
+
/**
|
| 889 |
+
* Create a cache control breakpoint at this content block.
|
| 890 |
+
*/
|
| 891 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 892 |
+
}
|
| 893 |
+
export type BetaToolUnion = BetaTool | BetaToolComputerUse20241022 | BetaToolBash20241022 | BetaToolTextEditor20241022 | BetaToolComputerUse20250124 | BetaToolBash20250124 | BetaToolTextEditor20250124 | BetaToolTextEditor20250429 | BetaWebSearchTool20250305 | BetaCodeExecutionTool20250522;
|
| 894 |
+
export interface BetaToolUseBlock {
|
| 895 |
+
id: string;
|
| 896 |
+
input: unknown;
|
| 897 |
+
name: string;
|
| 898 |
+
type: 'tool_use';
|
| 899 |
+
}
|
| 900 |
+
export interface BetaToolUseBlockParam {
|
| 901 |
+
id: string;
|
| 902 |
+
input: unknown;
|
| 903 |
+
name: string;
|
| 904 |
+
type: 'tool_use';
|
| 905 |
+
/**
|
| 906 |
+
* Create a cache control breakpoint at this content block.
|
| 907 |
+
*/
|
| 908 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 909 |
+
}
|
| 910 |
+
export interface BetaURLImageSource {
|
| 911 |
+
type: 'url';
|
| 912 |
+
url: string;
|
| 913 |
+
}
|
| 914 |
+
export interface BetaURLPDFSource {
|
| 915 |
+
type: 'url';
|
| 916 |
+
url: string;
|
| 917 |
+
}
|
| 918 |
+
export interface BetaUsage {
|
| 919 |
+
/**
|
| 920 |
+
* Breakdown of cached tokens by TTL
|
| 921 |
+
*/
|
| 922 |
+
cache_creation: BetaCacheCreation | null;
|
| 923 |
+
/**
|
| 924 |
+
* The number of input tokens used to create the cache entry.
|
| 925 |
+
*/
|
| 926 |
+
cache_creation_input_tokens: number | null;
|
| 927 |
+
/**
|
| 928 |
+
* The number of input tokens read from the cache.
|
| 929 |
+
*/
|
| 930 |
+
cache_read_input_tokens: number | null;
|
| 931 |
+
/**
|
| 932 |
+
* The number of input tokens which were used.
|
| 933 |
+
*/
|
| 934 |
+
input_tokens: number;
|
| 935 |
+
/**
|
| 936 |
+
* The number of output tokens which were used.
|
| 937 |
+
*/
|
| 938 |
+
output_tokens: number;
|
| 939 |
+
/**
|
| 940 |
+
* The number of server tool requests.
|
| 941 |
+
*/
|
| 942 |
+
server_tool_use: BetaServerToolUsage | null;
|
| 943 |
+
/**
|
| 944 |
+
* If the request used the priority, standard, or batch tier.
|
| 945 |
+
*/
|
| 946 |
+
service_tier: 'standard' | 'priority' | 'batch' | null;
|
| 947 |
+
}
|
| 948 |
+
export interface BetaWebSearchResultBlock {
|
| 949 |
+
encrypted_content: string;
|
| 950 |
+
page_age: string | null;
|
| 951 |
+
title: string;
|
| 952 |
+
type: 'web_search_result';
|
| 953 |
+
url: string;
|
| 954 |
+
}
|
| 955 |
+
export interface BetaWebSearchResultBlockParam {
|
| 956 |
+
encrypted_content: string;
|
| 957 |
+
title: string;
|
| 958 |
+
type: 'web_search_result';
|
| 959 |
+
url: string;
|
| 960 |
+
page_age?: string | null;
|
| 961 |
+
}
|
| 962 |
+
export interface BetaWebSearchTool20250305 {
|
| 963 |
+
/**
|
| 964 |
+
* Name of the tool.
|
| 965 |
+
*
|
| 966 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 967 |
+
*/
|
| 968 |
+
name: 'web_search';
|
| 969 |
+
type: 'web_search_20250305';
|
| 970 |
+
/**
|
| 971 |
+
* If provided, only these domains will be included in results. Cannot be used
|
| 972 |
+
* alongside `blocked_domains`.
|
| 973 |
+
*/
|
| 974 |
+
allowed_domains?: Array<string> | null;
|
| 975 |
+
/**
|
| 976 |
+
* If provided, these domains will never appear in results. Cannot be used
|
| 977 |
+
* alongside `allowed_domains`.
|
| 978 |
+
*/
|
| 979 |
+
blocked_domains?: Array<string> | null;
|
| 980 |
+
/**
|
| 981 |
+
* Create a cache control breakpoint at this content block.
|
| 982 |
+
*/
|
| 983 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 984 |
+
/**
|
| 985 |
+
* Maximum number of times the tool can be used in the API request.
|
| 986 |
+
*/
|
| 987 |
+
max_uses?: number | null;
|
| 988 |
+
/**
|
| 989 |
+
* Parameters for the user's location. Used to provide more relevant search
|
| 990 |
+
* results.
|
| 991 |
+
*/
|
| 992 |
+
user_location?: BetaWebSearchTool20250305.UserLocation | null;
|
| 993 |
+
}
|
| 994 |
+
export declare namespace BetaWebSearchTool20250305 {
|
| 995 |
+
/**
|
| 996 |
+
* Parameters for the user's location. Used to provide more relevant search
|
| 997 |
+
* results.
|
| 998 |
+
*/
|
| 999 |
+
interface UserLocation {
|
| 1000 |
+
type: 'approximate';
|
| 1001 |
+
/**
|
| 1002 |
+
* The city of the user.
|
| 1003 |
+
*/
|
| 1004 |
+
city?: string | null;
|
| 1005 |
+
/**
|
| 1006 |
+
* The two letter
|
| 1007 |
+
* [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
|
| 1008 |
+
* user.
|
| 1009 |
+
*/
|
| 1010 |
+
country?: string | null;
|
| 1011 |
+
/**
|
| 1012 |
+
* The region of the user.
|
| 1013 |
+
*/
|
| 1014 |
+
region?: string | null;
|
| 1015 |
+
/**
|
| 1016 |
+
* The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
| 1017 |
+
*/
|
| 1018 |
+
timezone?: string | null;
|
| 1019 |
+
}
|
| 1020 |
+
}
|
| 1021 |
+
export interface BetaWebSearchToolRequestError {
|
| 1022 |
+
error_code: BetaWebSearchToolResultErrorCode;
|
| 1023 |
+
type: 'web_search_tool_result_error';
|
| 1024 |
+
}
|
| 1025 |
+
export interface BetaWebSearchToolResultBlock {
|
| 1026 |
+
content: BetaWebSearchToolResultBlockContent;
|
| 1027 |
+
tool_use_id: string;
|
| 1028 |
+
type: 'web_search_tool_result';
|
| 1029 |
+
}
|
| 1030 |
+
export type BetaWebSearchToolResultBlockContent = BetaWebSearchToolResultError | Array<BetaWebSearchResultBlock>;
|
| 1031 |
+
export interface BetaWebSearchToolResultBlockParam {
|
| 1032 |
+
content: BetaWebSearchToolResultBlockParamContent;
|
| 1033 |
+
tool_use_id: string;
|
| 1034 |
+
type: 'web_search_tool_result';
|
| 1035 |
+
/**
|
| 1036 |
+
* Create a cache control breakpoint at this content block.
|
| 1037 |
+
*/
|
| 1038 |
+
cache_control?: BetaCacheControlEphemeral | null;
|
| 1039 |
+
}
|
| 1040 |
+
export type BetaWebSearchToolResultBlockParamContent = Array<BetaWebSearchResultBlockParam> | BetaWebSearchToolRequestError;
|
| 1041 |
+
export interface BetaWebSearchToolResultError {
|
| 1042 |
+
error_code: BetaWebSearchToolResultErrorCode;
|
| 1043 |
+
type: 'web_search_tool_result_error';
|
| 1044 |
+
}
|
| 1045 |
+
export type BetaWebSearchToolResultErrorCode = 'invalid_tool_input' | 'unavailable' | 'max_uses_exceeded' | 'too_many_requests' | 'query_too_long';
|
| 1046 |
+
/**
|
| 1047 |
+
* @deprecated BetaRequestDocumentBlock should be used insated
|
| 1048 |
+
*/
|
| 1049 |
+
export type BetaBase64PDFBlock = BetaRequestDocumentBlock;
|
| 1050 |
+
export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming;
|
| 1051 |
+
export interface MessageCreateParamsBase {
|
| 1052 |
+
/**
|
| 1053 |
+
* Body param: The maximum number of tokens to generate before stopping.
|
| 1054 |
+
*
|
| 1055 |
+
* Note that our models may stop _before_ reaching this maximum. This parameter
|
| 1056 |
+
* only specifies the absolute maximum number of tokens to generate.
|
| 1057 |
+
*
|
| 1058 |
+
* Different models have different maximum values for this parameter. See
|
| 1059 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for details.
|
| 1060 |
+
*/
|
| 1061 |
+
max_tokens: number;
|
| 1062 |
+
/**
|
| 1063 |
+
* Body param: Input messages.
|
| 1064 |
+
*
|
| 1065 |
+
* Our models are trained to operate on alternating `user` and `assistant`
|
| 1066 |
+
* conversational turns. When creating a new `Message`, you specify the prior
|
| 1067 |
+
* conversational turns with the `messages` parameter, and the model then generates
|
| 1068 |
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
| 1069 |
+
* in your request will be combined into a single turn.
|
| 1070 |
+
*
|
| 1071 |
+
* Each input message must be an object with a `role` and `content`. You can
|
| 1072 |
+
* specify a single `user`-role message, or you can include multiple `user` and
|
| 1073 |
+
* `assistant` messages.
|
| 1074 |
+
*
|
| 1075 |
+
* If the final message uses the `assistant` role, the response content will
|
| 1076 |
+
* continue immediately from the content in that message. This can be used to
|
| 1077 |
+
* constrain part of the model's response.
|
| 1078 |
+
*
|
| 1079 |
+
* Example with a single `user` message:
|
| 1080 |
+
*
|
| 1081 |
+
* ```json
|
| 1082 |
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
| 1083 |
+
* ```
|
| 1084 |
+
*
|
| 1085 |
+
* Example with multiple conversational turns:
|
| 1086 |
+
*
|
| 1087 |
+
* ```json
|
| 1088 |
+
* [
|
| 1089 |
+
* { "role": "user", "content": "Hello there." },
|
| 1090 |
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
| 1091 |
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
| 1092 |
+
* ]
|
| 1093 |
+
* ```
|
| 1094 |
+
*
|
| 1095 |
+
* Example with a partially-filled response from Claude:
|
| 1096 |
+
*
|
| 1097 |
+
* ```json
|
| 1098 |
+
* [
|
| 1099 |
+
* {
|
| 1100 |
+
* "role": "user",
|
| 1101 |
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
| 1102 |
+
* },
|
| 1103 |
+
* { "role": "assistant", "content": "The best answer is (" }
|
| 1104 |
+
* ]
|
| 1105 |
+
* ```
|
| 1106 |
+
*
|
| 1107 |
+
* Each input message `content` may be either a single `string` or an array of
|
| 1108 |
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
| 1109 |
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
| 1110 |
+
* following input messages are equivalent:
|
| 1111 |
+
*
|
| 1112 |
+
* ```json
|
| 1113 |
+
* { "role": "user", "content": "Hello, Claude" }
|
| 1114 |
+
* ```
|
| 1115 |
+
*
|
| 1116 |
+
* ```json
|
| 1117 |
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
| 1118 |
+
* ```
|
| 1119 |
+
*
|
| 1120 |
+
* Starting with Claude 3 models, you can also send image content blocks:
|
| 1121 |
+
*
|
| 1122 |
+
* ```json
|
| 1123 |
+
* {
|
| 1124 |
+
* "role": "user",
|
| 1125 |
+
* "content": [
|
| 1126 |
+
* {
|
| 1127 |
+
* "type": "image",
|
| 1128 |
+
* "source": {
|
| 1129 |
+
* "type": "base64",
|
| 1130 |
+
* "media_type": "image/jpeg",
|
| 1131 |
+
* "data": "/9j/4AAQSkZJRg..."
|
| 1132 |
+
* }
|
| 1133 |
+
* },
|
| 1134 |
+
* { "type": "text", "text": "What is in this image?" }
|
| 1135 |
+
* ]
|
| 1136 |
+
* }
|
| 1137 |
+
* ```
|
| 1138 |
+
*
|
| 1139 |
+
* We currently support the `base64` source type for images, and the `image/jpeg`,
|
| 1140 |
+
* `image/png`, `image/gif`, and `image/webp` media types.
|
| 1141 |
+
*
|
| 1142 |
+
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
| 1143 |
+
* more input examples.
|
| 1144 |
+
*
|
| 1145 |
+
* Note that if you want to include a
|
| 1146 |
+
* [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
| 1147 |
+
* the top-level `system` parameter — there is no `"system"` role for input
|
| 1148 |
+
* messages in the Messages API.
|
| 1149 |
+
*
|
| 1150 |
+
* There is a limit of 100000 messages in a single request.
|
| 1151 |
+
*/
|
| 1152 |
+
messages: Array<BetaMessageParam>;
|
| 1153 |
+
/**
|
| 1154 |
+
* Body param: The model that will complete your prompt.\n\nSee
|
| 1155 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 1156 |
+
* details and options.
|
| 1157 |
+
*/
|
| 1158 |
+
model: MessagesAPI.Model;
|
| 1159 |
+
/**
|
| 1160 |
+
* Body param: Container identifier for reuse across requests.
|
| 1161 |
+
*/
|
| 1162 |
+
container?: string | null;
|
| 1163 |
+
/**
|
| 1164 |
+
* Body param: MCP servers to be utilized in this request
|
| 1165 |
+
*/
|
| 1166 |
+
mcp_servers?: Array<BetaRequestMCPServerURLDefinition>;
|
| 1167 |
+
/**
|
| 1168 |
+
* Body param: An object describing metadata about the request.
|
| 1169 |
+
*/
|
| 1170 |
+
metadata?: BetaMetadata;
|
| 1171 |
+
/**
|
| 1172 |
+
* Body param: Determines whether to use priority capacity (if available) or
|
| 1173 |
+
* standard capacity for this request.
|
| 1174 |
+
*
|
| 1175 |
+
* Anthropic offers different levels of service for your API requests. See
|
| 1176 |
+
* [service-tiers](https://docs.anthropic.com/en/api/service-tiers) for details.
|
| 1177 |
+
*/
|
| 1178 |
+
service_tier?: 'auto' | 'standard_only';
|
| 1179 |
+
/**
|
| 1180 |
+
* Body param: Custom text sequences that will cause the model to stop generating.
|
| 1181 |
+
*
|
| 1182 |
+
* Our models will normally stop when they have naturally completed their turn,
|
| 1183 |
+
* which will result in a response `stop_reason` of `"end_turn"`.
|
| 1184 |
+
*
|
| 1185 |
+
* If you want the model to stop generating when it encounters custom strings of
|
| 1186 |
+
* text, you can use the `stop_sequences` parameter. If the model encounters one of
|
| 1187 |
+
* the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
|
| 1188 |
+
* and the response `stop_sequence` value will contain the matched stop sequence.
|
| 1189 |
+
*/
|
| 1190 |
+
stop_sequences?: Array<string>;
|
| 1191 |
+
/**
|
| 1192 |
+
* Body param: Whether to incrementally stream the response using server-sent
|
| 1193 |
+
* events.
|
| 1194 |
+
*
|
| 1195 |
+
* See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
|
| 1196 |
+
* details.
|
| 1197 |
+
*/
|
| 1198 |
+
stream?: boolean;
|
| 1199 |
+
/**
|
| 1200 |
+
* Body param: System prompt.
|
| 1201 |
+
*
|
| 1202 |
+
* A system prompt is a way of providing context and instructions to Claude, such
|
| 1203 |
+
* as specifying a particular goal or role. See our
|
| 1204 |
+
* [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
| 1205 |
+
*/
|
| 1206 |
+
system?: string | Array<BetaTextBlockParam>;
|
| 1207 |
+
/**
|
| 1208 |
+
* Body param: Amount of randomness injected into the response.
|
| 1209 |
+
*
|
| 1210 |
+
* Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
|
| 1211 |
+
* for analytical / multiple choice, and closer to `1.0` for creative and
|
| 1212 |
+
* generative tasks.
|
| 1213 |
+
*
|
| 1214 |
+
* Note that even with `temperature` of `0.0`, the results will not be fully
|
| 1215 |
+
* deterministic.
|
| 1216 |
+
*/
|
| 1217 |
+
temperature?: number;
|
| 1218 |
+
/**
|
| 1219 |
+
* Body param: Configuration for enabling Claude's extended thinking.
|
| 1220 |
+
*
|
| 1221 |
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
| 1222 |
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
| 1223 |
+
* tokens and counts towards your `max_tokens` limit.
|
| 1224 |
+
*
|
| 1225 |
+
* See
|
| 1226 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 1227 |
+
* for details.
|
| 1228 |
+
*/
|
| 1229 |
+
thinking?: BetaThinkingConfigParam;
|
| 1230 |
+
/**
|
| 1231 |
+
* Body param: How the model should use the provided tools. The model can use a
|
| 1232 |
+
* specific tool, any available tool, decide by itself, or not use tools at all.
|
| 1233 |
+
*/
|
| 1234 |
+
tool_choice?: BetaToolChoice;
|
| 1235 |
+
/**
|
| 1236 |
+
* Body param: Definitions of tools that the model may use.
|
| 1237 |
+
*
|
| 1238 |
+
* If you include `tools` in your API request, the model may return `tool_use`
|
| 1239 |
+
* content blocks that represent the model's use of those tools. You can then run
|
| 1240 |
+
* those tools using the tool input generated by the model and then optionally
|
| 1241 |
+
* return results back to the model using `tool_result` content blocks.
|
| 1242 |
+
*
|
| 1243 |
+
* Each tool definition includes:
|
| 1244 |
+
*
|
| 1245 |
+
* - `name`: Name of the tool.
|
| 1246 |
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
| 1247 |
+
* - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
| 1248 |
+
* tool `input` shape that the model will produce in `tool_use` output content
|
| 1249 |
+
* blocks.
|
| 1250 |
+
*
|
| 1251 |
+
* For example, if you defined `tools` as:
|
| 1252 |
+
*
|
| 1253 |
+
* ```json
|
| 1254 |
+
* [
|
| 1255 |
+
* {
|
| 1256 |
+
* "name": "get_stock_price",
|
| 1257 |
+
* "description": "Get the current stock price for a given ticker symbol.",
|
| 1258 |
+
* "input_schema": {
|
| 1259 |
+
* "type": "object",
|
| 1260 |
+
* "properties": {
|
| 1261 |
+
* "ticker": {
|
| 1262 |
+
* "type": "string",
|
| 1263 |
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
| 1264 |
+
* }
|
| 1265 |
+
* },
|
| 1266 |
+
* "required": ["ticker"]
|
| 1267 |
+
* }
|
| 1268 |
+
* }
|
| 1269 |
+
* ]
|
| 1270 |
+
* ```
|
| 1271 |
+
*
|
| 1272 |
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
| 1273 |
+
* `tool_use` content blocks in the response like this:
|
| 1274 |
+
*
|
| 1275 |
+
* ```json
|
| 1276 |
+
* [
|
| 1277 |
+
* {
|
| 1278 |
+
* "type": "tool_use",
|
| 1279 |
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1280 |
+
* "name": "get_stock_price",
|
| 1281 |
+
* "input": { "ticker": "^GSPC" }
|
| 1282 |
+
* }
|
| 1283 |
+
* ]
|
| 1284 |
+
* ```
|
| 1285 |
+
*
|
| 1286 |
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
| 1287 |
+
* input, and return the following back to the model in a subsequent `user`
|
| 1288 |
+
* message:
|
| 1289 |
+
*
|
| 1290 |
+
* ```json
|
| 1291 |
+
* [
|
| 1292 |
+
* {
|
| 1293 |
+
* "type": "tool_result",
|
| 1294 |
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1295 |
+
* "content": "259.75 USD"
|
| 1296 |
+
* }
|
| 1297 |
+
* ]
|
| 1298 |
+
* ```
|
| 1299 |
+
*
|
| 1300 |
+
* Tools can be used for workflows that include running client-side tools and
|
| 1301 |
+
* functions, or more generally whenever you want the model to produce a particular
|
| 1302 |
+
* JSON structure of output.
|
| 1303 |
+
*
|
| 1304 |
+
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
| 1305 |
+
*/
|
| 1306 |
+
tools?: Array<BetaToolUnion>;
|
| 1307 |
+
/**
|
| 1308 |
+
* Body param: Only sample from the top K options for each subsequent token.
|
| 1309 |
+
*
|
| 1310 |
+
* Used to remove "long tail" low probability responses.
|
| 1311 |
+
* [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
|
| 1312 |
+
*
|
| 1313 |
+
* Recommended for advanced use cases only. You usually only need to use
|
| 1314 |
+
* `temperature`.
|
| 1315 |
+
*/
|
| 1316 |
+
top_k?: number;
|
| 1317 |
+
/**
|
| 1318 |
+
* Body param: Use nucleus sampling.
|
| 1319 |
+
*
|
| 1320 |
+
* In nucleus sampling, we compute the cumulative distribution over all the options
|
| 1321 |
+
* for each subsequent token in decreasing probability order and cut it off once it
|
| 1322 |
+
* reaches a particular probability specified by `top_p`. You should either alter
|
| 1323 |
+
* `temperature` or `top_p`, but not both.
|
| 1324 |
+
*
|
| 1325 |
+
* Recommended for advanced use cases only. You usually only need to use
|
| 1326 |
+
* `temperature`.
|
| 1327 |
+
*/
|
| 1328 |
+
top_p?: number;
|
| 1329 |
+
/**
|
| 1330 |
+
* Header param: Optional header to specify the beta version(s) you want to use.
|
| 1331 |
+
*/
|
| 1332 |
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
| 1333 |
+
}
|
| 1334 |
+
export declare namespace MessageCreateParams {
|
| 1335 |
+
type MessageCreateParamsNonStreaming = MessagesMessagesAPI.MessageCreateParamsNonStreaming;
|
| 1336 |
+
type MessageCreateParamsStreaming = MessagesMessagesAPI.MessageCreateParamsStreaming;
|
| 1337 |
+
}
|
| 1338 |
+
export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase {
|
| 1339 |
+
/**
|
| 1340 |
+
* Body param: Whether to incrementally stream the response using server-sent
|
| 1341 |
+
* events.
|
| 1342 |
+
*
|
| 1343 |
+
* See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
|
| 1344 |
+
* details.
|
| 1345 |
+
*/
|
| 1346 |
+
stream?: false;
|
| 1347 |
+
}
|
| 1348 |
+
export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
|
| 1349 |
+
/**
|
| 1350 |
+
* Body param: Whether to incrementally stream the response using server-sent
|
| 1351 |
+
* events.
|
| 1352 |
+
*
|
| 1353 |
+
* See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
|
| 1354 |
+
* details.
|
| 1355 |
+
*/
|
| 1356 |
+
stream: true;
|
| 1357 |
+
}
|
| 1358 |
+
export interface MessageCountTokensParams {
|
| 1359 |
+
/**
|
| 1360 |
+
* Body param: Input messages.
|
| 1361 |
+
*
|
| 1362 |
+
* Our models are trained to operate on alternating `user` and `assistant`
|
| 1363 |
+
* conversational turns. When creating a new `Message`, you specify the prior
|
| 1364 |
+
* conversational turns with the `messages` parameter, and the model then generates
|
| 1365 |
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
| 1366 |
+
* in your request will be combined into a single turn.
|
| 1367 |
+
*
|
| 1368 |
+
* Each input message must be an object with a `role` and `content`. You can
|
| 1369 |
+
* specify a single `user`-role message, or you can include multiple `user` and
|
| 1370 |
+
* `assistant` messages.
|
| 1371 |
+
*
|
| 1372 |
+
* If the final message uses the `assistant` role, the response content will
|
| 1373 |
+
* continue immediately from the content in that message. This can be used to
|
| 1374 |
+
* constrain part of the model's response.
|
| 1375 |
+
*
|
| 1376 |
+
* Example with a single `user` message:
|
| 1377 |
+
*
|
| 1378 |
+
* ```json
|
| 1379 |
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
| 1380 |
+
* ```
|
| 1381 |
+
*
|
| 1382 |
+
* Example with multiple conversational turns:
|
| 1383 |
+
*
|
| 1384 |
+
* ```json
|
| 1385 |
+
* [
|
| 1386 |
+
* { "role": "user", "content": "Hello there." },
|
| 1387 |
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
| 1388 |
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
| 1389 |
+
* ]
|
| 1390 |
+
* ```
|
| 1391 |
+
*
|
| 1392 |
+
* Example with a partially-filled response from Claude:
|
| 1393 |
+
*
|
| 1394 |
+
* ```json
|
| 1395 |
+
* [
|
| 1396 |
+
* {
|
| 1397 |
+
* "role": "user",
|
| 1398 |
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
| 1399 |
+
* },
|
| 1400 |
+
* { "role": "assistant", "content": "The best answer is (" }
|
| 1401 |
+
* ]
|
| 1402 |
+
* ```
|
| 1403 |
+
*
|
| 1404 |
+
* Each input message `content` may be either a single `string` or an array of
|
| 1405 |
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
| 1406 |
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
| 1407 |
+
* following input messages are equivalent:
|
| 1408 |
+
*
|
| 1409 |
+
* ```json
|
| 1410 |
+
* { "role": "user", "content": "Hello, Claude" }
|
| 1411 |
+
* ```
|
| 1412 |
+
*
|
| 1413 |
+
* ```json
|
| 1414 |
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
| 1415 |
+
* ```
|
| 1416 |
+
*
|
| 1417 |
+
* Starting with Claude 3 models, you can also send image content blocks:
|
| 1418 |
+
*
|
| 1419 |
+
* ```json
|
| 1420 |
+
* {
|
| 1421 |
+
* "role": "user",
|
| 1422 |
+
* "content": [
|
| 1423 |
+
* {
|
| 1424 |
+
* "type": "image",
|
| 1425 |
+
* "source": {
|
| 1426 |
+
* "type": "base64",
|
| 1427 |
+
* "media_type": "image/jpeg",
|
| 1428 |
+
* "data": "/9j/4AAQSkZJRg..."
|
| 1429 |
+
* }
|
| 1430 |
+
* },
|
| 1431 |
+
* { "type": "text", "text": "What is in this image?" }
|
| 1432 |
+
* ]
|
| 1433 |
+
* }
|
| 1434 |
+
* ```
|
| 1435 |
+
*
|
| 1436 |
+
* We currently support the `base64` source type for images, and the `image/jpeg`,
|
| 1437 |
+
* `image/png`, `image/gif`, and `image/webp` media types.
|
| 1438 |
+
*
|
| 1439 |
+
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
| 1440 |
+
* more input examples.
|
| 1441 |
+
*
|
| 1442 |
+
* Note that if you want to include a
|
| 1443 |
+
* [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
| 1444 |
+
* the top-level `system` parameter — there is no `"system"` role for input
|
| 1445 |
+
* messages in the Messages API.
|
| 1446 |
+
*
|
| 1447 |
+
* There is a limit of 100000 messages in a single request.
|
| 1448 |
+
*/
|
| 1449 |
+
messages: Array<BetaMessageParam>;
|
| 1450 |
+
/**
|
| 1451 |
+
* Body param: The model that will complete your prompt.\n\nSee
|
| 1452 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 1453 |
+
* details and options.
|
| 1454 |
+
*/
|
| 1455 |
+
model: MessagesAPI.Model;
|
| 1456 |
+
/**
|
| 1457 |
+
* Body param: MCP servers to be utilized in this request
|
| 1458 |
+
*/
|
| 1459 |
+
mcp_servers?: Array<BetaRequestMCPServerURLDefinition>;
|
| 1460 |
+
/**
|
| 1461 |
+
* Body param: System prompt.
|
| 1462 |
+
*
|
| 1463 |
+
* A system prompt is a way of providing context and instructions to Claude, such
|
| 1464 |
+
* as specifying a particular goal or role. See our
|
| 1465 |
+
* [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
| 1466 |
+
*/
|
| 1467 |
+
system?: string | Array<BetaTextBlockParam>;
|
| 1468 |
+
/**
|
| 1469 |
+
* Body param: Configuration for enabling Claude's extended thinking.
|
| 1470 |
+
*
|
| 1471 |
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
| 1472 |
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
| 1473 |
+
* tokens and counts towards your `max_tokens` limit.
|
| 1474 |
+
*
|
| 1475 |
+
* See
|
| 1476 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 1477 |
+
* for details.
|
| 1478 |
+
*/
|
| 1479 |
+
thinking?: BetaThinkingConfigParam;
|
| 1480 |
+
/**
|
| 1481 |
+
* Body param: How the model should use the provided tools. The model can use a
|
| 1482 |
+
* specific tool, any available tool, decide by itself, or not use tools at all.
|
| 1483 |
+
*/
|
| 1484 |
+
tool_choice?: BetaToolChoice;
|
| 1485 |
+
/**
|
| 1486 |
+
* Body param: Definitions of tools that the model may use.
|
| 1487 |
+
*
|
| 1488 |
+
* If you include `tools` in your API request, the model may return `tool_use`
|
| 1489 |
+
* content blocks that represent the model's use of those tools. You can then run
|
| 1490 |
+
* those tools using the tool input generated by the model and then optionally
|
| 1491 |
+
* return results back to the model using `tool_result` content blocks.
|
| 1492 |
+
*
|
| 1493 |
+
* Each tool definition includes:
|
| 1494 |
+
*
|
| 1495 |
+
* - `name`: Name of the tool.
|
| 1496 |
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
| 1497 |
+
* - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
| 1498 |
+
* tool `input` shape that the model will produce in `tool_use` output content
|
| 1499 |
+
* blocks.
|
| 1500 |
+
*
|
| 1501 |
+
* For example, if you defined `tools` as:
|
| 1502 |
+
*
|
| 1503 |
+
* ```json
|
| 1504 |
+
* [
|
| 1505 |
+
* {
|
| 1506 |
+
* "name": "get_stock_price",
|
| 1507 |
+
* "description": "Get the current stock price for a given ticker symbol.",
|
| 1508 |
+
* "input_schema": {
|
| 1509 |
+
* "type": "object",
|
| 1510 |
+
* "properties": {
|
| 1511 |
+
* "ticker": {
|
| 1512 |
+
* "type": "string",
|
| 1513 |
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
| 1514 |
+
* }
|
| 1515 |
+
* },
|
| 1516 |
+
* "required": ["ticker"]
|
| 1517 |
+
* }
|
| 1518 |
+
* }
|
| 1519 |
+
* ]
|
| 1520 |
+
* ```
|
| 1521 |
+
*
|
| 1522 |
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
| 1523 |
+
* `tool_use` content blocks in the response like this:
|
| 1524 |
+
*
|
| 1525 |
+
* ```json
|
| 1526 |
+
* [
|
| 1527 |
+
* {
|
| 1528 |
+
* "type": "tool_use",
|
| 1529 |
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1530 |
+
* "name": "get_stock_price",
|
| 1531 |
+
* "input": { "ticker": "^GSPC" }
|
| 1532 |
+
* }
|
| 1533 |
+
* ]
|
| 1534 |
+
* ```
|
| 1535 |
+
*
|
| 1536 |
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
| 1537 |
+
* input, and return the following back to the model in a subsequent `user`
|
| 1538 |
+
* message:
|
| 1539 |
+
*
|
| 1540 |
+
* ```json
|
| 1541 |
+
* [
|
| 1542 |
+
* {
|
| 1543 |
+
* "type": "tool_result",
|
| 1544 |
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1545 |
+
* "content": "259.75 USD"
|
| 1546 |
+
* }
|
| 1547 |
+
* ]
|
| 1548 |
+
* ```
|
| 1549 |
+
*
|
| 1550 |
+
* Tools can be used for workflows that include running client-side tools and
|
| 1551 |
+
* functions, or more generally whenever you want the model to produce a particular
|
| 1552 |
+
* JSON structure of output.
|
| 1553 |
+
*
|
| 1554 |
+
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
| 1555 |
+
*/
|
| 1556 |
+
tools?: Array<BetaTool | BetaToolComputerUse20241022 | BetaToolBash20241022 | BetaToolTextEditor20241022 | BetaToolComputerUse20250124 | BetaToolBash20250124 | BetaToolTextEditor20250124 | BetaToolTextEditor20250429 | BetaWebSearchTool20250305 | BetaCodeExecutionTool20250522>;
|
| 1557 |
+
/**
|
| 1558 |
+
* Header param: Optional header to specify the beta version(s) you want to use.
|
| 1559 |
+
*/
|
| 1560 |
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
| 1561 |
+
}
|
| 1562 |
+
export declare namespace Messages {
|
| 1563 |
+
export { type BetaBase64ImageSource as BetaBase64ImageSource, type BetaBase64PDFSource as BetaBase64PDFSource, type BetaCacheControlEphemeral as BetaCacheControlEphemeral, type BetaCacheCreation as BetaCacheCreation, type BetaCitationCharLocation as BetaCitationCharLocation, type BetaCitationCharLocationParam as BetaCitationCharLocationParam, type BetaCitationContentBlockLocation as BetaCitationContentBlockLocation, type BetaCitationContentBlockLocationParam as BetaCitationContentBlockLocationParam, type BetaCitationPageLocation as BetaCitationPageLocation, type BetaCitationPageLocationParam as BetaCitationPageLocationParam, type BetaCitationWebSearchResultLocationParam as BetaCitationWebSearchResultLocationParam, type BetaCitationsConfigParam as BetaCitationsConfigParam, type BetaCitationsDelta as BetaCitationsDelta, type BetaCitationsWebSearchResultLocation as BetaCitationsWebSearchResultLocation, type BetaCodeExecutionOutputBlock as BetaCodeExecutionOutputBlock, type BetaCodeExecutionOutputBlockParam as BetaCodeExecutionOutputBlockParam, type BetaCodeExecutionResultBlock as BetaCodeExecutionResultBlock, type BetaCodeExecutionResultBlockParam as BetaCodeExecutionResultBlockParam, type BetaCodeExecutionTool20250522 as BetaCodeExecutionTool20250522, type BetaCodeExecutionToolResultBlock as BetaCodeExecutionToolResultBlock, type BetaCodeExecutionToolResultBlockContent as BetaCodeExecutionToolResultBlockContent, type BetaCodeExecutionToolResultBlockParam as BetaCodeExecutionToolResultBlockParam, type BetaCodeExecutionToolResultBlockParamContent as BetaCodeExecutionToolResultBlockParamContent, type BetaCodeExecutionToolResultError as BetaCodeExecutionToolResultError, type BetaCodeExecutionToolResultErrorCode as BetaCodeExecutionToolResultErrorCode, type BetaCodeExecutionToolResultErrorParam as BetaCodeExecutionToolResultErrorParam, type BetaContainer as BetaContainer, type BetaContainerUploadBlock as BetaContainerUploadBlock, type BetaContainerUploadBlockParam as BetaContainerUploadBlockParam, type BetaContentBlock as BetaContentBlock, type BetaContentBlockParam as BetaContentBlockParam, type BetaContentBlockSource as BetaContentBlockSource, type BetaContentBlockSourceContent as BetaContentBlockSourceContent, type BetaFileDocumentSource as BetaFileDocumentSource, type BetaFileImageSource as BetaFileImageSource, type BetaImageBlockParam as BetaImageBlockParam, type BetaInputJSONDelta as BetaInputJSONDelta, type BetaMCPToolResultBlock as BetaMCPToolResultBlock, type BetaMCPToolUseBlock as BetaMCPToolUseBlock, type BetaMCPToolUseBlockParam as BetaMCPToolUseBlockParam, type BetaMessage as BetaMessage, type BetaMessageDeltaUsage as BetaMessageDeltaUsage, type BetaMessageParam as BetaMessageParam, type BetaMessageTokensCount as BetaMessageTokensCount, type BetaMetadata as BetaMetadata, type BetaPlainTextSource as BetaPlainTextSource, type BetaRawContentBlockDelta as BetaRawContentBlockDelta, type BetaRawContentBlockDeltaEvent as BetaRawContentBlockDeltaEvent, type BetaRawContentBlockStartEvent as BetaRawContentBlockStartEvent, type BetaRawContentBlockStopEvent as BetaRawContentBlockStopEvent, type BetaRawMessageDeltaEvent as BetaRawMessageDeltaEvent, type BetaRawMessageStartEvent as BetaRawMessageStartEvent, type BetaRawMessageStopEvent as BetaRawMessageStopEvent, type BetaRawMessageStreamEvent as BetaRawMessageStreamEvent, type BetaRedactedThinkingBlock as BetaRedactedThinkingBlock, type BetaRedactedThinkingBlockParam as BetaRedactedThinkingBlockParam, type BetaRequestDocumentBlock as BetaRequestDocumentBlock, type BetaRequestMCPServerToolConfiguration as BetaRequestMCPServerToolConfiguration, type BetaRequestMCPServerURLDefinition as BetaRequestMCPServerURLDefinition, type BetaRequestMCPToolResultBlockParam as BetaRequestMCPToolResultBlockParam, type BetaServerToolUsage as BetaServerToolUsage, type BetaServerToolUseBlock as BetaServerToolUseBlock, type BetaServerToolUseBlockParam as BetaServerToolUseBlockParam, type BetaSignatureDelta as BetaSignatureDelta, type BetaStopReason as BetaStopReason, type BetaTextBlock as BetaTextBlock, type BetaTextBlockParam as BetaTextBlockParam, type BetaTextCitation as BetaTextCitation, type BetaTextCitationParam as BetaTextCitationParam, type BetaTextDelta as BetaTextDelta, type BetaThinkingBlock as BetaThinkingBlock, type BetaThinkingBlockParam as BetaThinkingBlockParam, type BetaThinkingConfigDisabled as BetaThinkingConfigDisabled, type BetaThinkingConfigEnabled as BetaThinkingConfigEnabled, type BetaThinkingConfigParam as BetaThinkingConfigParam, type BetaThinkingDelta as BetaThinkingDelta, type BetaTool as BetaTool, type BetaToolBash20241022 as BetaToolBash20241022, type BetaToolBash20250124 as BetaToolBash20250124, type BetaToolChoice as BetaToolChoice, type BetaToolChoiceAny as BetaToolChoiceAny, type BetaToolChoiceAuto as BetaToolChoiceAuto, type BetaToolChoiceNone as BetaToolChoiceNone, type BetaToolChoiceTool as BetaToolChoiceTool, type BetaToolComputerUse20241022 as BetaToolComputerUse20241022, type BetaToolComputerUse20250124 as BetaToolComputerUse20250124, type BetaToolResultBlockParam as BetaToolResultBlockParam, type BetaToolTextEditor20241022 as BetaToolTextEditor20241022, type BetaToolTextEditor20250124 as BetaToolTextEditor20250124, type BetaToolTextEditor20250429 as BetaToolTextEditor20250429, type BetaToolUnion as BetaToolUnion, type BetaToolUseBlock as BetaToolUseBlock, type BetaToolUseBlockParam as BetaToolUseBlockParam, type BetaURLImageSource as BetaURLImageSource, type BetaURLPDFSource as BetaURLPDFSource, type BetaUsage as BetaUsage, type BetaWebSearchResultBlock as BetaWebSearchResultBlock, type BetaWebSearchResultBlockParam as BetaWebSearchResultBlockParam, type BetaWebSearchTool20250305 as BetaWebSearchTool20250305, type BetaWebSearchToolRequestError as BetaWebSearchToolRequestError, type BetaWebSearchToolResultBlock as BetaWebSearchToolResultBlock, type BetaWebSearchToolResultBlockContent as BetaWebSearchToolResultBlockContent, type BetaWebSearchToolResultBlockParam as BetaWebSearchToolResultBlockParam, type BetaWebSearchToolResultBlockParamContent as BetaWebSearchToolResultBlockParamContent, type BetaWebSearchToolResultError as BetaWebSearchToolResultError, type BetaWebSearchToolResultErrorCode as BetaWebSearchToolResultErrorCode, type BetaBase64PDFBlock as BetaBase64PDFBlock, type MessageCreateParams as MessageCreateParams, type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming, type MessageCreateParamsStreaming as MessageCreateParamsStreaming, type MessageCountTokensParams as MessageCountTokensParams, };
|
| 1564 |
+
export { Batches as Batches, type BetaDeletedMessageBatch as BetaDeletedMessageBatch, type BetaMessageBatch as BetaMessageBatch, type BetaMessageBatchCanceledResult as BetaMessageBatchCanceledResult, type BetaMessageBatchErroredResult as BetaMessageBatchErroredResult, type BetaMessageBatchExpiredResult as BetaMessageBatchExpiredResult, type BetaMessageBatchIndividualResponse as BetaMessageBatchIndividualResponse, type BetaMessageBatchRequestCounts as BetaMessageBatchRequestCounts, type BetaMessageBatchResult as BetaMessageBatchResult, type BetaMessageBatchSucceededResult as BetaMessageBatchSucceededResult, type BetaMessageBatchesPage as BetaMessageBatchesPage, type BatchCreateParams as BatchCreateParams, type BatchRetrieveParams as BatchRetrieveParams, type BatchListParams as BatchListParams, type BatchDeleteParams as BatchDeleteParams, type BatchCancelParams as BatchCancelParams, type BatchResultsParams as BatchResultsParams, };
|
| 1565 |
+
}
|
| 1566 |
+
//# sourceMappingURL=messages.d.mts.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 3 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 4 |
+
exports.Messages = void 0;
|
| 5 |
+
const tslib_1 = require("../../../internal/tslib.js");
|
| 6 |
+
const resource_1 = require("../../../core/resource.js");
|
| 7 |
+
const BatchesAPI = tslib_1.__importStar(require("./batches.js"));
|
| 8 |
+
const batches_1 = require("./batches.js");
|
| 9 |
+
const headers_1 = require("../../../internal/headers.js");
|
| 10 |
+
const BetaMessageStream_1 = require("../../../lib/BetaMessageStream.js");
|
| 11 |
+
const DEPRECATED_MODELS = {
|
| 12 |
+
'claude-1.3': 'November 6th, 2024',
|
| 13 |
+
'claude-1.3-100k': 'November 6th, 2024',
|
| 14 |
+
'claude-instant-1.1': 'November 6th, 2024',
|
| 15 |
+
'claude-instant-1.1-100k': 'November 6th, 2024',
|
| 16 |
+
'claude-instant-1.2': 'November 6th, 2024',
|
| 17 |
+
'claude-3-sonnet-20240229': 'July 21st, 2025',
|
| 18 |
+
'claude-2.1': 'July 21st, 2025',
|
| 19 |
+
'claude-2.0': 'July 21st, 2025',
|
| 20 |
+
};
|
| 21 |
+
const constants_1 = require("../../../internal/constants.js");
|
| 22 |
+
class Messages extends resource_1.APIResource {
|
| 23 |
+
constructor() {
|
| 24 |
+
super(...arguments);
|
| 25 |
+
this.batches = new BatchesAPI.Batches(this._client);
|
| 26 |
+
}
|
| 27 |
+
create(params, options) {
|
| 28 |
+
const { betas, ...body } = params;
|
| 29 |
+
if (body.model in DEPRECATED_MODELS) {
|
| 30 |
+
console.warn(`The model '${body.model}' is deprecated and will reach end-of-life on ${DEPRECATED_MODELS[body.model]}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);
|
| 31 |
+
}
|
| 32 |
+
let timeout = this._client._options.timeout;
|
| 33 |
+
if (!body.stream && timeout == null) {
|
| 34 |
+
const maxNonstreamingTokens = constants_1.MODEL_NONSTREAMING_TOKENS[body.model] ?? undefined;
|
| 35 |
+
timeout = this._client.calculateNonstreamingTimeout(body.max_tokens, maxNonstreamingTokens);
|
| 36 |
+
}
|
| 37 |
+
return this._client.post('/v1/messages?beta=true', {
|
| 38 |
+
body,
|
| 39 |
+
timeout: timeout ?? 600000,
|
| 40 |
+
...options,
|
| 41 |
+
headers: (0, headers_1.buildHeaders)([
|
| 42 |
+
{ ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
|
| 43 |
+
options?.headers,
|
| 44 |
+
]),
|
| 45 |
+
stream: params.stream ?? false,
|
| 46 |
+
});
|
| 47 |
+
}
|
| 48 |
+
/**
|
| 49 |
+
* Create a Message stream
|
| 50 |
+
*/
|
| 51 |
+
stream(body, options) {
|
| 52 |
+
return BetaMessageStream_1.BetaMessageStream.createMessage(this, body, options);
|
| 53 |
+
}
|
| 54 |
+
/**
|
| 55 |
+
* Count the number of tokens in a Message.
|
| 56 |
+
*
|
| 57 |
+
* The Token Count API can be used to count the number of tokens in a Message,
|
| 58 |
+
* including tools, images, and documents, without creating it.
|
| 59 |
+
*
|
| 60 |
+
* Learn more about token counting in our
|
| 61 |
+
* [user guide](/en/docs/build-with-claude/token-counting)
|
| 62 |
+
*
|
| 63 |
+
* @example
|
| 64 |
+
* ```ts
|
| 65 |
+
* const betaMessageTokensCount =
|
| 66 |
+
* await client.beta.messages.countTokens({
|
| 67 |
+
* messages: [{ content: 'string', role: 'user' }],
|
| 68 |
+
* model: 'claude-3-7-sonnet-latest',
|
| 69 |
+
* });
|
| 70 |
+
* ```
|
| 71 |
+
*/
|
| 72 |
+
countTokens(params, options) {
|
| 73 |
+
const { betas, ...body } = params;
|
| 74 |
+
return this._client.post('/v1/messages/count_tokens?beta=true', {
|
| 75 |
+
body,
|
| 76 |
+
...options,
|
| 77 |
+
headers: (0, headers_1.buildHeaders)([
|
| 78 |
+
{ 'anthropic-beta': [...(betas ?? []), 'token-counting-2024-11-01'].toString() },
|
| 79 |
+
options?.headers,
|
| 80 |
+
]),
|
| 81 |
+
});
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
exports.Messages = Messages;
|
| 85 |
+
Messages.Batches = batches_1.Batches;
|
| 86 |
+
//# sourceMappingURL=messages.js.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/resources/beta/messages/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AAIrD,iEAAwC;AACxC,0CAkBmB;AAGnB,0DAAyD;AAGzD,yEAAmE;AAEnE,MAAM,iBAAiB,GAEnB;IACF,YAAY,EAAE,oBAAoB;IAClC,iBAAiB,EAAE,oBAAoB;IACvC,oBAAoB,EAAE,oBAAoB;IAC1C,yBAAyB,EAAE,oBAAoB;IAC/C,oBAAoB,EAAE,oBAAoB;IAC1C,0BAA0B,EAAE,iBAAiB;IAC7C,YAAY,EAAE,iBAAiB;IAC/B,YAAY,EAAE,iBAAiB;CAChC,CAAC;AACF,8DAAwE;AAExE,MAAa,QAAS,SAAQ,sBAAW;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OAAwB;QAC5D,OAAO,qCAAiB,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CACT,MAAgC,EAChC,OAAwB;QAExB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE;YAC9D,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,gBAAgB,EAAE,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,2BAA2B,CAAC,CAAC,QAAQ,EAAE,EAAE;gBAChF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AApGD,4BAoGC;AAq7DD,QAAQ,CAAC,OAAO,GAAG,iBAAO,CAAC"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../../../src/resources/beta/messages/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,KAAK,UAAU;OACf,EAOL,OAAO,GAWR;OAGM,EAAE,YAAY,EAAE;OAGhB,EAAE,iBAAiB,EAAE;AAE5B,MAAM,iBAAiB,GAEnB;IACF,YAAY,EAAE,oBAAoB;IAClC,iBAAiB,EAAE,oBAAoB;IACvC,oBAAoB,EAAE,oBAAoB;IAC1C,yBAAyB,EAAE,oBAAoB;IAC/C,oBAAoB,EAAE,oBAAoB;IAC1C,0BAA0B,EAAE,iBAAiB;IAC7C,YAAY,EAAE,iBAAiB;IAC/B,YAAY,EAAE,iBAAiB;CAChC,CA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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { APIResource } from "../core/resource.js";
|
| 2 |
+
import * as CompletionsAPI from "./completions.js";
|
| 3 |
+
import * as BetaAPI from "./beta/beta.js";
|
| 4 |
+
import * as MessagesAPI from "./messages/messages.js";
|
| 5 |
+
import { APIPromise } from "../core/api-promise.js";
|
| 6 |
+
import { Stream } from "../core/streaming.js";
|
| 7 |
+
import { RequestOptions } from "../internal/request-options.js";
|
| 8 |
+
export declare class Completions extends APIResource {
|
| 9 |
+
/**
|
| 10 |
+
* [Legacy] Create a Text Completion.
|
| 11 |
+
*
|
| 12 |
+
* The Text Completions API is a legacy API. We recommend using the
|
| 13 |
+
* [Messages API](https://docs.anthropic.com/en/api/messages) going forward.
|
| 14 |
+
*
|
| 15 |
+
* Future models and features will not be compatible with Text Completions. See our
|
| 16 |
+
* [migration guide](https://docs.anthropic.com/en/api/migrating-from-text-completions-to-messages)
|
| 17 |
+
* for guidance in migrating from Text Completions to Messages.
|
| 18 |
+
*
|
| 19 |
+
* @example
|
| 20 |
+
* ```ts
|
| 21 |
+
* const completion = await client.completions.create({
|
| 22 |
+
* max_tokens_to_sample: 256,
|
| 23 |
+
* model: 'claude-3-7-sonnet-latest',
|
| 24 |
+
* prompt: '\n\nHuman: Hello, world!\n\nAssistant:',
|
| 25 |
+
* });
|
| 26 |
+
* ```
|
| 27 |
+
*/
|
| 28 |
+
create(params: CompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Completion>;
|
| 29 |
+
create(params: CompletionCreateParamsStreaming, options?: RequestOptions): APIPromise<Stream<Completion>>;
|
| 30 |
+
create(params: CompletionCreateParamsBase, options?: RequestOptions): APIPromise<Stream<Completion> | Completion>;
|
| 31 |
+
}
|
| 32 |
+
export interface Completion {
|
| 33 |
+
/**
|
| 34 |
+
* Unique object identifier.
|
| 35 |
+
*
|
| 36 |
+
* The format and length of IDs may change over time.
|
| 37 |
+
*/
|
| 38 |
+
id: string;
|
| 39 |
+
/**
|
| 40 |
+
* The resulting completion up to and excluding the stop sequences.
|
| 41 |
+
*/
|
| 42 |
+
completion: string;
|
| 43 |
+
/**
|
| 44 |
+
* The model that will complete your prompt.\n\nSee
|
| 45 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 46 |
+
* details and options.
|
| 47 |
+
*/
|
| 48 |
+
model: MessagesAPI.Model;
|
| 49 |
+
/**
|
| 50 |
+
* The reason that we stopped.
|
| 51 |
+
*
|
| 52 |
+
* This may be one the following values:
|
| 53 |
+
*
|
| 54 |
+
* - `"stop_sequence"`: we reached a stop sequence — either provided by you via the
|
| 55 |
+
* `stop_sequences` parameter, or a stop sequence built into the model
|
| 56 |
+
* - `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum
|
| 57 |
+
*/
|
| 58 |
+
stop_reason: string | null;
|
| 59 |
+
/**
|
| 60 |
+
* Object type.
|
| 61 |
+
*
|
| 62 |
+
* For Text Completions, this is always `"completion"`.
|
| 63 |
+
*/
|
| 64 |
+
type: 'completion';
|
| 65 |
+
}
|
| 66 |
+
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
|
| 67 |
+
export interface CompletionCreateParamsBase {
|
| 68 |
+
/**
|
| 69 |
+
* Body param: The maximum number of tokens to generate before stopping.
|
| 70 |
+
*
|
| 71 |
+
* Note that our models may stop _before_ reaching this maximum. This parameter
|
| 72 |
+
* only specifies the absolute maximum number of tokens to generate.
|
| 73 |
+
*/
|
| 74 |
+
max_tokens_to_sample: number;
|
| 75 |
+
/**
|
| 76 |
+
* Body param: The model that will complete your prompt.\n\nSee
|
| 77 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 78 |
+
* details and options.
|
| 79 |
+
*/
|
| 80 |
+
model: MessagesAPI.Model;
|
| 81 |
+
/**
|
| 82 |
+
* Body param: The prompt that you want Claude to complete.
|
| 83 |
+
*
|
| 84 |
+
* For proper response generation you will need to format your prompt using
|
| 85 |
+
* alternating `\n\nHuman:` and `\n\nAssistant:` conversational turns. For example:
|
| 86 |
+
*
|
| 87 |
+
* ```
|
| 88 |
+
* "\n\nHuman: {userQuestion}\n\nAssistant:"
|
| 89 |
+
* ```
|
| 90 |
+
*
|
| 91 |
+
* See [prompt validation](https://docs.anthropic.com/en/api/prompt-validation) and
|
| 92 |
+
* our guide to
|
| 93 |
+
* [prompt design](https://docs.anthropic.com/en/docs/intro-to-prompting) for more
|
| 94 |
+
* details.
|
| 95 |
+
*/
|
| 96 |
+
prompt: string;
|
| 97 |
+
/**
|
| 98 |
+
* Body param: An object describing metadata about the request.
|
| 99 |
+
*/
|
| 100 |
+
metadata?: MessagesAPI.Metadata;
|
| 101 |
+
/**
|
| 102 |
+
* Body param: Sequences that will cause the model to stop generating.
|
| 103 |
+
*
|
| 104 |
+
* Our models stop on `"\n\nHuman:"`, and may include additional built-in stop
|
| 105 |
+
* sequences in the future. By providing the stop_sequences parameter, you may
|
| 106 |
+
* include additional strings that will cause the model to stop generating.
|
| 107 |
+
*/
|
| 108 |
+
stop_sequences?: Array<string>;
|
| 109 |
+
/**
|
| 110 |
+
* Body param: Whether to incrementally stream the response using server-sent
|
| 111 |
+
* events.
|
| 112 |
+
*
|
| 113 |
+
* See [streaming](https://docs.anthropic.com/en/api/streaming) for details.
|
| 114 |
+
*/
|
| 115 |
+
stream?: boolean;
|
| 116 |
+
/**
|
| 117 |
+
* Body param: Amount of randomness injected into the response.
|
| 118 |
+
*
|
| 119 |
+
* Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
|
| 120 |
+
* for analytical / multiple choice, and closer to `1.0` for creative and
|
| 121 |
+
* generative tasks.
|
| 122 |
+
*
|
| 123 |
+
* Note that even with `temperature` of `0.0`, the results will not be fully
|
| 124 |
+
* deterministic.
|
| 125 |
+
*/
|
| 126 |
+
temperature?: number;
|
| 127 |
+
/**
|
| 128 |
+
* Body param: Only sample from the top K options for each subsequent token.
|
| 129 |
+
*
|
| 130 |
+
* Used to remove "long tail" low probability responses.
|
| 131 |
+
* [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
|
| 132 |
+
*
|
| 133 |
+
* Recommended for advanced use cases only. You usually only need to use
|
| 134 |
+
* `temperature`.
|
| 135 |
+
*/
|
| 136 |
+
top_k?: number;
|
| 137 |
+
/**
|
| 138 |
+
* Body param: Use nucleus sampling.
|
| 139 |
+
*
|
| 140 |
+
* In nucleus sampling, we compute the cumulative distribution over all the options
|
| 141 |
+
* for each subsequent token in decreasing probability order and cut it off once it
|
| 142 |
+
* reaches a particular probability specified by `top_p`. You should either alter
|
| 143 |
+
* `temperature` or `top_p`, but not both.
|
| 144 |
+
*
|
| 145 |
+
* Recommended for advanced use cases only. You usually only need to use
|
| 146 |
+
* `temperature`.
|
| 147 |
+
*/
|
| 148 |
+
top_p?: number;
|
| 149 |
+
/**
|
| 150 |
+
* Header param: Optional header to specify the beta version(s) you want to use.
|
| 151 |
+
*/
|
| 152 |
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
| 153 |
+
}
|
| 154 |
+
export declare namespace CompletionCreateParams {
|
| 155 |
+
/**
|
| 156 |
+
* @deprecated use `Anthropic.Messages.Metadata` instead
|
| 157 |
+
*/
|
| 158 |
+
type Metadata = MessagesAPI.Metadata;
|
| 159 |
+
type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
|
| 160 |
+
type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
|
| 161 |
+
}
|
| 162 |
+
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
|
| 163 |
+
/**
|
| 164 |
+
* Body param: Whether to incrementally stream the response using server-sent
|
| 165 |
+
* events.
|
| 166 |
+
*
|
| 167 |
+
* See [streaming](https://docs.anthropic.com/en/api/streaming) for details.
|
| 168 |
+
*/
|
| 169 |
+
stream?: false;
|
| 170 |
+
}
|
| 171 |
+
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
|
| 172 |
+
/**
|
| 173 |
+
* Body param: Whether to incrementally stream the response using server-sent
|
| 174 |
+
* events.
|
| 175 |
+
*
|
| 176 |
+
* See [streaming](https://docs.anthropic.com/en/api/streaming) for details.
|
| 177 |
+
*/
|
| 178 |
+
stream: true;
|
| 179 |
+
}
|
| 180 |
+
export declare namespace Completions {
|
| 181 |
+
export { type Completion as Completion, type CompletionCreateParams as CompletionCreateParams, type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, };
|
| 182 |
+
}
|
| 183 |
+
//# sourceMappingURL=completions.d.ts.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/completions.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../src/resources/completions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,cAAc;OACnB,KAAK,OAAO;OACZ,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OAEV,EAAE,cAAc,EAAE;AAEzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,MAAM,EAAE,kCAAkC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,UAAU,CAAC;IACpG,MAAM,CAAC,MAAM,EAAE,+BAA+B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACzG,MAAM,CACJ,MAAM,EAAE,0BAA0B,EAClC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;CAiB/C;AAED,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC;IAEzB;;;;;;;;OAQG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B;;;;OAIG;IACH,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,MAAM,MAAM,sBAAsB,GAAG,kCAAkC,GAAG,+BAA+B,CAAC;AAE1G,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC;IAEzB;;;;;;;;;;;;;;OAcG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC;IAEhC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE/B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;CACtC;AAED,yBAAiB,sBAAsB,CAAC;IACtC;;OAEG;IACH,KAAY,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;IAE5C,KAAY,kCAAkC,GAAG,cAAc,CAAC,kCAAkC,CAAC;IACnG,KAAY,+BAA+B,GAAG,cAAc,CAAC,+BAA+B,CAAC;CAC9F;AAED,MAAM,WAAW,kCAAmC,SAAQ,0BAA0B;IACpF;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,WAAW,+BAAgC,SAAQ,0BAA0B;IACjF;;;;;OAKG;IACH,MAAM,EAAE,IAAI,CAAC;CACd;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,kCAAkC,IAAI,kCAAkC,EAC7E,KAAK,+BAA+B,IAAI,+BAA+B,GACxE,CAAC;CACH"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts.map
ADDED
|
@@ -0,0 +1 @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,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC1B,2BAA2B,GAC3B,yBAAyB,GACzB,0BAA0B,GAC1B,yBAAyB,CAAC;AAE9B,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC;IAE7B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;CAC5C;AAED,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,OAAO;QACtB;;;;;WAKG;QACH,SAAS,EAAE,MAAM,CAAC;QAElB;;;;;WAKG;QACH,MAAM,EAAE,WAAW,CAAC,+BAA+B,CAAC;KACrD;CACF;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;CAAG;AAEtD,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,eAAe,IAAI,eAAe,GACxC,CAAC;CACH"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/batches.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 3 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 4 |
+
exports.Batches = void 0;
|
| 5 |
+
const resource_1 = require("../../core/resource.js");
|
| 6 |
+
const pagination_1 = require("../../core/pagination.js");
|
| 7 |
+
const headers_1 = require("../../internal/headers.js");
|
| 8 |
+
const jsonl_1 = require("../../internal/decoders/jsonl.js");
|
| 9 |
+
const error_1 = require("../../error.js");
|
| 10 |
+
const path_1 = require("../../internal/utils/path.js");
|
| 11 |
+
class Batches extends resource_1.APIResource {
|
| 12 |
+
/**
|
| 13 |
+
* Send a batch of Message creation requests.
|
| 14 |
+
*
|
| 15 |
+
* The Message Batches API can be used to process multiple Messages API requests at
|
| 16 |
+
* once. Once a Message Batch is created, it begins processing immediately. Batches
|
| 17 |
+
* can take up to 24 hours to complete.
|
| 18 |
+
*
|
| 19 |
+
* Learn more about the Message Batches API in our
|
| 20 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 21 |
+
*
|
| 22 |
+
* @example
|
| 23 |
+
* ```ts
|
| 24 |
+
* const messageBatch = await client.messages.batches.create({
|
| 25 |
+
* requests: [
|
| 26 |
+
* {
|
| 27 |
+
* custom_id: 'my-custom-id-1',
|
| 28 |
+
* params: {
|
| 29 |
+
* max_tokens: 1024,
|
| 30 |
+
* messages: [
|
| 31 |
+
* { content: 'Hello, world', role: 'user' },
|
| 32 |
+
* ],
|
| 33 |
+
* model: 'claude-3-7-sonnet-20250219',
|
| 34 |
+
* },
|
| 35 |
+
* },
|
| 36 |
+
* ],
|
| 37 |
+
* });
|
| 38 |
+
* ```
|
| 39 |
+
*/
|
| 40 |
+
create(body, options) {
|
| 41 |
+
return this._client.post('/v1/messages/batches', { body, ...options });
|
| 42 |
+
}
|
| 43 |
+
/**
|
| 44 |
+
* This endpoint is idempotent and can be used to poll for Message Batch
|
| 45 |
+
* completion. To access the results of a Message Batch, make a request to the
|
| 46 |
+
* `results_url` field in the response.
|
| 47 |
+
*
|
| 48 |
+
* Learn more about the Message Batches API in our
|
| 49 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 50 |
+
*
|
| 51 |
+
* @example
|
| 52 |
+
* ```ts
|
| 53 |
+
* const messageBatch = await client.messages.batches.retrieve(
|
| 54 |
+
* 'message_batch_id',
|
| 55 |
+
* );
|
| 56 |
+
* ```
|
| 57 |
+
*/
|
| 58 |
+
retrieve(messageBatchID, options) {
|
| 59 |
+
return this._client.get((0, path_1.path) `/v1/messages/batches/${messageBatchID}`, options);
|
| 60 |
+
}
|
| 61 |
+
/**
|
| 62 |
+
* List all Message Batches within a Workspace. Most recently created batches are
|
| 63 |
+
* returned first.
|
| 64 |
+
*
|
| 65 |
+
* Learn more about the Message Batches API in our
|
| 66 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 67 |
+
*
|
| 68 |
+
* @example
|
| 69 |
+
* ```ts
|
| 70 |
+
* // Automatically fetches more pages as needed.
|
| 71 |
+
* for await (const messageBatch of client.messages.batches.list()) {
|
| 72 |
+
* // ...
|
| 73 |
+
* }
|
| 74 |
+
* ```
|
| 75 |
+
*/
|
| 76 |
+
list(query = {}, options) {
|
| 77 |
+
return this._client.getAPIList('/v1/messages/batches', (pagination_1.Page), { query, ...options });
|
| 78 |
+
}
|
| 79 |
+
/**
|
| 80 |
+
* Delete a Message Batch.
|
| 81 |
+
*
|
| 82 |
+
* Message Batches can only be deleted once they've finished processing. If you'd
|
| 83 |
+
* like to delete an in-progress batch, you must first cancel it.
|
| 84 |
+
*
|
| 85 |
+
* Learn more about the Message Batches API in our
|
| 86 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 87 |
+
*
|
| 88 |
+
* @example
|
| 89 |
+
* ```ts
|
| 90 |
+
* const deletedMessageBatch =
|
| 91 |
+
* await client.messages.batches.delete('message_batch_id');
|
| 92 |
+
* ```
|
| 93 |
+
*/
|
| 94 |
+
delete(messageBatchID, options) {
|
| 95 |
+
return this._client.delete((0, path_1.path) `/v1/messages/batches/${messageBatchID}`, options);
|
| 96 |
+
}
|
| 97 |
+
/**
|
| 98 |
+
* Batches may be canceled any time before processing ends. Once cancellation is
|
| 99 |
+
* initiated, the batch enters a `canceling` state, at which time the system may
|
| 100 |
+
* complete any in-progress, non-interruptible requests before finalizing
|
| 101 |
+
* cancellation.
|
| 102 |
+
*
|
| 103 |
+
* The number of canceled requests is specified in `request_counts`. To determine
|
| 104 |
+
* which requests were canceled, check the individual results within the batch.
|
| 105 |
+
* Note that cancellation may not result in any canceled requests if they were
|
| 106 |
+
* non-interruptible.
|
| 107 |
+
*
|
| 108 |
+
* Learn more about the Message Batches API in our
|
| 109 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 110 |
+
*
|
| 111 |
+
* @example
|
| 112 |
+
* ```ts
|
| 113 |
+
* const messageBatch = await client.messages.batches.cancel(
|
| 114 |
+
* 'message_batch_id',
|
| 115 |
+
* );
|
| 116 |
+
* ```
|
| 117 |
+
*/
|
| 118 |
+
cancel(messageBatchID, options) {
|
| 119 |
+
return this._client.post((0, path_1.path) `/v1/messages/batches/${messageBatchID}/cancel`, options);
|
| 120 |
+
}
|
| 121 |
+
/**
|
| 122 |
+
* Streams the results of a Message Batch as a `.jsonl` file.
|
| 123 |
+
*
|
| 124 |
+
* Each line in the file is a JSON object containing the result of a single request
|
| 125 |
+
* in the Message Batch. Results are not guaranteed to be in the same order as
|
| 126 |
+
* requests. Use the `custom_id` field to match results to requests.
|
| 127 |
+
*
|
| 128 |
+
* Learn more about the Message Batches API in our
|
| 129 |
+
* [user guide](/en/docs/build-with-claude/batch-processing)
|
| 130 |
+
*
|
| 131 |
+
* @example
|
| 132 |
+
* ```ts
|
| 133 |
+
* const messageBatchIndividualResponse =
|
| 134 |
+
* await client.messages.batches.results('message_batch_id');
|
| 135 |
+
* ```
|
| 136 |
+
*/
|
| 137 |
+
async results(messageBatchID, options) {
|
| 138 |
+
const batch = await this.retrieve(messageBatchID);
|
| 139 |
+
if (!batch.results_url) {
|
| 140 |
+
throw new error_1.AnthropicError(`No batch \`results_url\`; Has it finished processing? ${batch.processing_status} - ${batch.id}`);
|
| 141 |
+
}
|
| 142 |
+
return this._client
|
| 143 |
+
.get(batch.results_url, {
|
| 144 |
+
...options,
|
| 145 |
+
headers: (0, headers_1.buildHeaders)([{ Accept: 'application/binary' }, options?.headers]),
|
| 146 |
+
stream: true,
|
| 147 |
+
__binaryResponse: true,
|
| 148 |
+
})
|
| 149 |
+
._thenUnwrap((_, props) => jsonl_1.JSONLDecoder.fromResponse(props.response, props.controller));
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
exports.Batches = Batches;
|
| 153 |
+
//# sourceMappingURL=batches.js.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export { Batches, type DeletedMessageBatch, type MessageBatch, type MessageBatchCanceledResult, type MessageBatchErroredResult, type MessageBatchExpiredResult, type MessageBatchIndividualResponse, type MessageBatchRequestCounts, type MessageBatchResult, type MessageBatchSucceededResult, type BatchCreateParams, type BatchListParams, type MessageBatchesPage, } from "./batches.js";
|
| 2 |
+
export { Messages, type Base64ImageSource, type Base64PDFSource, type CacheControlEphemeral, type CitationCharLocation, type CitationCharLocationParam, type CitationContentBlockLocation, type CitationContentBlockLocationParam, type CitationPageLocation, type CitationPageLocationParam, type CitationWebSearchResultLocationParam, type CitationsConfigParam, type CitationsDelta, type CitationsWebSearchResultLocation, type ContentBlock, type ContentBlockParam, type ContentBlockStartEvent, type ContentBlockStopEvent, type ContentBlockSource, type ContentBlockSourceContent, type DocumentBlockParam, type ImageBlockParam, type InputJSONDelta, type Message, type MessageCountTokensTool, type MessageDeltaEvent, type MessageDeltaUsage, type MessageParam, type MessageTokensCount, type Metadata, type Model, type PlainTextSource, type RawContentBlockDelta, type RawContentBlockDeltaEvent, type RawContentBlockStartEvent, type RawContentBlockStopEvent, type RawMessageDeltaEvent, type RawMessageStartEvent, type RawMessageStopEvent, type RawMessageStreamEvent, type RedactedThinkingBlock, type RedactedThinkingBlockParam, type ServerToolUsage, type ServerToolUseBlock, type ServerToolUseBlockParam, type SignatureDelta, type StopReason, type TextBlock, type TextBlockParam, type TextCitation, type TextCitationParam, type TextDelta, type ThinkingBlock, type ThinkingBlockParam, type ThinkingConfigDisabled, type ThinkingConfigEnabled, type ThinkingConfigParam, type ThinkingDelta, type Tool, type ToolBash20250124, type ToolChoice, type ToolChoiceAny, type ToolChoiceAuto, type ToolChoiceNone, type ToolChoiceTool, type ToolResultBlockParam, type ToolTextEditor20250124, type ToolUnion, type ToolUseBlock, type ToolUseBlockParam, type URLImageSource, type URLPDFSource, type Usage, type WebSearchResultBlock, type WebSearchResultBlockParam, type WebSearchTool20250305, type WebSearchToolRequestError, type WebSearchToolResultBlock, type WebSearchToolResultBlockContent, type WebSearchToolResultBlockParam, type WebSearchToolResultBlockParamContent, type WebSearchToolResultError, type MessageStreamEvent, type MessageStartEvent, type MessageStopEvent, type ContentBlockDeltaEvent, type MessageCreateParams, type MessageCreateParamsBase, type MessageCreateParamsNonStreaming, type MessageCreateParamsStreaming, type MessageCountTokensParams, } from "./messages.js";
|
| 3 |
+
//# sourceMappingURL=index.d.ts.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/messages/index.ts"],"names":[],"mappings":"OAEO,EACL,OAAO,EACP,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACxB;OACM,EAC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,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,KAAK,EACV,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,EAClC,KAAK,oCAAoC,EACzC,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,GAC9B"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts
ADDED
|
@@ -0,0 +1,1295 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { APIPromise } from "../../core/api-promise.mjs";
|
| 2 |
+
import { APIResource } from "../../core/resource.mjs";
|
| 3 |
+
import { Stream } from "../../core/streaming.mjs";
|
| 4 |
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
| 5 |
+
import { MessageStream } from "../../lib/MessageStream.mjs";
|
| 6 |
+
import * as BatchesAPI from "./batches.mjs";
|
| 7 |
+
import { BatchCreateParams, BatchListParams, Batches, DeletedMessageBatch, MessageBatch, MessageBatchCanceledResult, MessageBatchErroredResult, MessageBatchExpiredResult, MessageBatchIndividualResponse, MessageBatchRequestCounts, MessageBatchResult, MessageBatchSucceededResult, MessageBatchesPage } from "./batches.mjs";
|
| 8 |
+
import * as MessagesAPI from "./messages.mjs";
|
| 9 |
+
export declare class Messages extends APIResource {
|
| 10 |
+
batches: BatchesAPI.Batches;
|
| 11 |
+
/**
|
| 12 |
+
* Send a structured list of input messages with text and/or image content, and the
|
| 13 |
+
* model will generate the next message in the conversation.
|
| 14 |
+
*
|
| 15 |
+
* The Messages API can be used for either single queries or stateless multi-turn
|
| 16 |
+
* conversations.
|
| 17 |
+
*
|
| 18 |
+
* Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
| 19 |
+
*
|
| 20 |
+
* @example
|
| 21 |
+
* ```ts
|
| 22 |
+
* const message = await client.messages.create({
|
| 23 |
+
* max_tokens: 1024,
|
| 24 |
+
* messages: [{ content: 'Hello, world', role: 'user' }],
|
| 25 |
+
* model: 'claude-3-7-sonnet-20250219',
|
| 26 |
+
* });
|
| 27 |
+
* ```
|
| 28 |
+
*/
|
| 29 |
+
create(body: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
|
| 30 |
+
create(body: MessageCreateParamsStreaming, options?: RequestOptions): APIPromise<Stream<RawMessageStreamEvent>>;
|
| 31 |
+
create(body: MessageCreateParamsBase, options?: RequestOptions): APIPromise<Stream<RawMessageStreamEvent> | Message>;
|
| 32 |
+
/**
|
| 33 |
+
* Create a Message stream
|
| 34 |
+
*/
|
| 35 |
+
stream(body: MessageStreamParams, options?: RequestOptions): MessageStream;
|
| 36 |
+
/**
|
| 37 |
+
* Count the number of tokens in a Message.
|
| 38 |
+
*
|
| 39 |
+
* The Token Count API can be used to count the number of tokens in a Message,
|
| 40 |
+
* including tools, images, and documents, without creating it.
|
| 41 |
+
*
|
| 42 |
+
* Learn more about token counting in our
|
| 43 |
+
* [user guide](/en/docs/build-with-claude/token-counting)
|
| 44 |
+
*
|
| 45 |
+
* @example
|
| 46 |
+
* ```ts
|
| 47 |
+
* const messageTokensCount =
|
| 48 |
+
* await client.messages.countTokens({
|
| 49 |
+
* messages: [{ content: 'string', role: 'user' }],
|
| 50 |
+
* model: 'claude-3-7-sonnet-latest',
|
| 51 |
+
* });
|
| 52 |
+
* ```
|
| 53 |
+
*/
|
| 54 |
+
countTokens(body: MessageCountTokensParams, options?: RequestOptions): APIPromise<MessageTokensCount>;
|
| 55 |
+
}
|
| 56 |
+
export interface Base64ImageSource {
|
| 57 |
+
data: string;
|
| 58 |
+
media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
|
| 59 |
+
type: 'base64';
|
| 60 |
+
}
|
| 61 |
+
export interface Base64PDFSource {
|
| 62 |
+
data: string;
|
| 63 |
+
media_type: 'application/pdf';
|
| 64 |
+
type: 'base64';
|
| 65 |
+
}
|
| 66 |
+
export interface CacheControlEphemeral {
|
| 67 |
+
type: 'ephemeral';
|
| 68 |
+
}
|
| 69 |
+
export interface CitationCharLocation {
|
| 70 |
+
cited_text: string;
|
| 71 |
+
document_index: number;
|
| 72 |
+
document_title: string | null;
|
| 73 |
+
end_char_index: number;
|
| 74 |
+
start_char_index: number;
|
| 75 |
+
type: 'char_location';
|
| 76 |
+
}
|
| 77 |
+
export interface CitationCharLocationParam {
|
| 78 |
+
cited_text: string;
|
| 79 |
+
document_index: number;
|
| 80 |
+
document_title: string | null;
|
| 81 |
+
end_char_index: number;
|
| 82 |
+
start_char_index: number;
|
| 83 |
+
type: 'char_location';
|
| 84 |
+
}
|
| 85 |
+
export interface CitationContentBlockLocation {
|
| 86 |
+
cited_text: string;
|
| 87 |
+
document_index: number;
|
| 88 |
+
document_title: string | null;
|
| 89 |
+
end_block_index: number;
|
| 90 |
+
start_block_index: number;
|
| 91 |
+
type: 'content_block_location';
|
| 92 |
+
}
|
| 93 |
+
export interface CitationContentBlockLocationParam {
|
| 94 |
+
cited_text: string;
|
| 95 |
+
document_index: number;
|
| 96 |
+
document_title: string | null;
|
| 97 |
+
end_block_index: number;
|
| 98 |
+
start_block_index: number;
|
| 99 |
+
type: 'content_block_location';
|
| 100 |
+
}
|
| 101 |
+
export interface CitationPageLocation {
|
| 102 |
+
cited_text: string;
|
| 103 |
+
document_index: number;
|
| 104 |
+
document_title: string | null;
|
| 105 |
+
end_page_number: number;
|
| 106 |
+
start_page_number: number;
|
| 107 |
+
type: 'page_location';
|
| 108 |
+
}
|
| 109 |
+
export interface CitationPageLocationParam {
|
| 110 |
+
cited_text: string;
|
| 111 |
+
document_index: number;
|
| 112 |
+
document_title: string | null;
|
| 113 |
+
end_page_number: number;
|
| 114 |
+
start_page_number: number;
|
| 115 |
+
type: 'page_location';
|
| 116 |
+
}
|
| 117 |
+
export interface CitationWebSearchResultLocationParam {
|
| 118 |
+
cited_text: string;
|
| 119 |
+
encrypted_index: string;
|
| 120 |
+
title: string | null;
|
| 121 |
+
type: 'web_search_result_location';
|
| 122 |
+
url: string;
|
| 123 |
+
}
|
| 124 |
+
export interface CitationsConfigParam {
|
| 125 |
+
enabled?: boolean;
|
| 126 |
+
}
|
| 127 |
+
export interface CitationsDelta {
|
| 128 |
+
citation: CitationCharLocation | CitationPageLocation | CitationContentBlockLocation | CitationsWebSearchResultLocation;
|
| 129 |
+
type: 'citations_delta';
|
| 130 |
+
}
|
| 131 |
+
export interface CitationsWebSearchResultLocation {
|
| 132 |
+
cited_text: string;
|
| 133 |
+
encrypted_index: string;
|
| 134 |
+
title: string | null;
|
| 135 |
+
type: 'web_search_result_location';
|
| 136 |
+
url: string;
|
| 137 |
+
}
|
| 138 |
+
export type ContentBlock = TextBlock | ToolUseBlock | ServerToolUseBlock | WebSearchToolResultBlock | ThinkingBlock | RedactedThinkingBlock;
|
| 139 |
+
/**
|
| 140 |
+
* Regular text content.
|
| 141 |
+
*/
|
| 142 |
+
export type ContentBlockParam = ServerToolUseBlockParam | WebSearchToolResultBlockParam | TextBlockParam | ImageBlockParam | ToolUseBlockParam | ToolResultBlockParam | DocumentBlockParam | ThinkingBlockParam | RedactedThinkingBlockParam;
|
| 143 |
+
export interface ContentBlockSource {
|
| 144 |
+
content: string | Array<ContentBlockSourceContent>;
|
| 145 |
+
type: 'content';
|
| 146 |
+
}
|
| 147 |
+
export type ContentBlockSourceContent = TextBlockParam | ImageBlockParam;
|
| 148 |
+
export interface DocumentBlockParam {
|
| 149 |
+
source: Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource;
|
| 150 |
+
type: 'document';
|
| 151 |
+
/**
|
| 152 |
+
* Create a cache control breakpoint at this content block.
|
| 153 |
+
*/
|
| 154 |
+
cache_control?: CacheControlEphemeral | null;
|
| 155 |
+
citations?: CitationsConfigParam;
|
| 156 |
+
context?: string | null;
|
| 157 |
+
title?: string | null;
|
| 158 |
+
}
|
| 159 |
+
export interface ImageBlockParam {
|
| 160 |
+
source: Base64ImageSource | URLImageSource;
|
| 161 |
+
type: 'image';
|
| 162 |
+
/**
|
| 163 |
+
* Create a cache control breakpoint at this content block.
|
| 164 |
+
*/
|
| 165 |
+
cache_control?: CacheControlEphemeral | null;
|
| 166 |
+
}
|
| 167 |
+
export interface InputJSONDelta {
|
| 168 |
+
partial_json: string;
|
| 169 |
+
type: 'input_json_delta';
|
| 170 |
+
}
|
| 171 |
+
export interface Message {
|
| 172 |
+
/**
|
| 173 |
+
* Unique object identifier.
|
| 174 |
+
*
|
| 175 |
+
* The format and length of IDs may change over time.
|
| 176 |
+
*/
|
| 177 |
+
id: string;
|
| 178 |
+
/**
|
| 179 |
+
* Content generated by the model.
|
| 180 |
+
*
|
| 181 |
+
* This is an array of content blocks, each of which has a `type` that determines
|
| 182 |
+
* its shape.
|
| 183 |
+
*
|
| 184 |
+
* Example:
|
| 185 |
+
*
|
| 186 |
+
* ```json
|
| 187 |
+
* [{ "type": "text", "text": "Hi, I'm Claude." }]
|
| 188 |
+
* ```
|
| 189 |
+
*
|
| 190 |
+
* If the request input `messages` ended with an `assistant` turn, then the
|
| 191 |
+
* response `content` will continue directly from that last turn. You can use this
|
| 192 |
+
* to constrain the model's output.
|
| 193 |
+
*
|
| 194 |
+
* For example, if the input `messages` were:
|
| 195 |
+
*
|
| 196 |
+
* ```json
|
| 197 |
+
* [
|
| 198 |
+
* {
|
| 199 |
+
* "role": "user",
|
| 200 |
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
| 201 |
+
* },
|
| 202 |
+
* { "role": "assistant", "content": "The best answer is (" }
|
| 203 |
+
* ]
|
| 204 |
+
* ```
|
| 205 |
+
*
|
| 206 |
+
* Then the response `content` might be:
|
| 207 |
+
*
|
| 208 |
+
* ```json
|
| 209 |
+
* [{ "type": "text", "text": "B)" }]
|
| 210 |
+
* ```
|
| 211 |
+
*/
|
| 212 |
+
content: Array<ContentBlock>;
|
| 213 |
+
/**
|
| 214 |
+
* The model that will complete your prompt.\n\nSee
|
| 215 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 216 |
+
* details and options.
|
| 217 |
+
*/
|
| 218 |
+
model: Model;
|
| 219 |
+
/**
|
| 220 |
+
* Conversational role of the generated message.
|
| 221 |
+
*
|
| 222 |
+
* This will always be `"assistant"`.
|
| 223 |
+
*/
|
| 224 |
+
role: 'assistant';
|
| 225 |
+
/**
|
| 226 |
+
* The reason that we stopped.
|
| 227 |
+
*
|
| 228 |
+
* This may be one the following values:
|
| 229 |
+
*
|
| 230 |
+
* - `"end_turn"`: the model reached a natural stopping point
|
| 231 |
+
* - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
| 232 |
+
* - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
| 233 |
+
* - `"tool_use"`: the model invoked one or more tools
|
| 234 |
+
*
|
| 235 |
+
* In non-streaming mode this value is always non-null. In streaming mode, it is
|
| 236 |
+
* null in the `message_start` event and non-null otherwise.
|
| 237 |
+
*/
|
| 238 |
+
stop_reason: StopReason | null;
|
| 239 |
+
/**
|
| 240 |
+
* Which custom stop sequence was generated, if any.
|
| 241 |
+
*
|
| 242 |
+
* This value will be a non-null string if one of your custom stop sequences was
|
| 243 |
+
* generated.
|
| 244 |
+
*/
|
| 245 |
+
stop_sequence: string | null;
|
| 246 |
+
/**
|
| 247 |
+
* Object type.
|
| 248 |
+
*
|
| 249 |
+
* For Messages, this is always `"message"`.
|
| 250 |
+
*/
|
| 251 |
+
type: 'message';
|
| 252 |
+
/**
|
| 253 |
+
* Billing and rate-limit usage.
|
| 254 |
+
*
|
| 255 |
+
* Anthropic's API bills and rate-limits by token counts, as tokens represent the
|
| 256 |
+
* underlying cost to our systems.
|
| 257 |
+
*
|
| 258 |
+
* Under the hood, the API transforms requests into a format suitable for the
|
| 259 |
+
* model. The model's output then goes through a parsing stage before becoming an
|
| 260 |
+
* API response. As a result, the token counts in `usage` will not match one-to-one
|
| 261 |
+
* with the exact visible content of an API request or response.
|
| 262 |
+
*
|
| 263 |
+
* For example, `output_tokens` will be non-zero, even for an empty string response
|
| 264 |
+
* from Claude.
|
| 265 |
+
*
|
| 266 |
+
* Total input tokens in a request is the summation of `input_tokens`,
|
| 267 |
+
* `cache_creation_input_tokens`, and `cache_read_input_tokens`.
|
| 268 |
+
*/
|
| 269 |
+
usage: Usage;
|
| 270 |
+
}
|
| 271 |
+
export type MessageCountTokensTool = Tool | ToolBash20250124 | ToolTextEditor20250124 | MessageCountTokensTool.TextEditor20250429 | WebSearchTool20250305;
|
| 272 |
+
export declare namespace MessageCountTokensTool {
|
| 273 |
+
interface TextEditor20250429 {
|
| 274 |
+
/**
|
| 275 |
+
* Name of the tool.
|
| 276 |
+
*
|
| 277 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 278 |
+
*/
|
| 279 |
+
name: 'str_replace_based_edit_tool';
|
| 280 |
+
type: 'text_editor_20250429';
|
| 281 |
+
/**
|
| 282 |
+
* Create a cache control breakpoint at this content block.
|
| 283 |
+
*/
|
| 284 |
+
cache_control?: MessagesAPI.CacheControlEphemeral | null;
|
| 285 |
+
}
|
| 286 |
+
}
|
| 287 |
+
export interface MessageDeltaUsage {
|
| 288 |
+
/**
|
| 289 |
+
* The cumulative number of input tokens used to create the cache entry.
|
| 290 |
+
*/
|
| 291 |
+
cache_creation_input_tokens: number | null;
|
| 292 |
+
/**
|
| 293 |
+
* The cumulative number of input tokens read from the cache.
|
| 294 |
+
*/
|
| 295 |
+
cache_read_input_tokens: number | null;
|
| 296 |
+
/**
|
| 297 |
+
* The cumulative number of input tokens which were used.
|
| 298 |
+
*/
|
| 299 |
+
input_tokens: number | null;
|
| 300 |
+
/**
|
| 301 |
+
* The cumulative number of output tokens which were used.
|
| 302 |
+
*/
|
| 303 |
+
output_tokens: number;
|
| 304 |
+
/**
|
| 305 |
+
* The number of server tool requests.
|
| 306 |
+
*/
|
| 307 |
+
server_tool_use: ServerToolUsage | null;
|
| 308 |
+
}
|
| 309 |
+
export interface MessageParam {
|
| 310 |
+
content: string | Array<ContentBlockParam>;
|
| 311 |
+
role: 'user' | 'assistant';
|
| 312 |
+
}
|
| 313 |
+
export interface MessageTokensCount {
|
| 314 |
+
/**
|
| 315 |
+
* The total number of tokens across the provided list of messages, system prompt,
|
| 316 |
+
* and tools.
|
| 317 |
+
*/
|
| 318 |
+
input_tokens: number;
|
| 319 |
+
}
|
| 320 |
+
export interface Metadata {
|
| 321 |
+
/**
|
| 322 |
+
* An external identifier for the user who is associated with the request.
|
| 323 |
+
*
|
| 324 |
+
* This should be a uuid, hash value, or other opaque identifier. Anthropic may use
|
| 325 |
+
* this id to help detect abuse. Do not include any identifying information such as
|
| 326 |
+
* name, email address, or phone number.
|
| 327 |
+
*/
|
| 328 |
+
user_id?: string | null;
|
| 329 |
+
}
|
| 330 |
+
/**
|
| 331 |
+
* The model that will complete your prompt.\n\nSee
|
| 332 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 333 |
+
* details and options.
|
| 334 |
+
*/
|
| 335 |
+
export type Model = 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-0' | 'claude-4-sonnet-20250514' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-4-opus-20250514' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | 'claude-2.1' | 'claude-2.0' | (string & {});
|
| 336 |
+
export interface PlainTextSource {
|
| 337 |
+
data: string;
|
| 338 |
+
media_type: 'text/plain';
|
| 339 |
+
type: 'text';
|
| 340 |
+
}
|
| 341 |
+
export type RawContentBlockDelta = TextDelta | InputJSONDelta | CitationsDelta | ThinkingDelta | SignatureDelta;
|
| 342 |
+
export interface RawContentBlockDeltaEvent {
|
| 343 |
+
delta: RawContentBlockDelta;
|
| 344 |
+
index: number;
|
| 345 |
+
type: 'content_block_delta';
|
| 346 |
+
}
|
| 347 |
+
export interface RawContentBlockStartEvent {
|
| 348 |
+
content_block: TextBlock | ToolUseBlock | ServerToolUseBlock | WebSearchToolResultBlock | ThinkingBlock | RedactedThinkingBlock;
|
| 349 |
+
index: number;
|
| 350 |
+
type: 'content_block_start';
|
| 351 |
+
}
|
| 352 |
+
export interface RawContentBlockStopEvent {
|
| 353 |
+
index: number;
|
| 354 |
+
type: 'content_block_stop';
|
| 355 |
+
}
|
| 356 |
+
export interface RawMessageDeltaEvent {
|
| 357 |
+
delta: RawMessageDeltaEvent.Delta;
|
| 358 |
+
type: 'message_delta';
|
| 359 |
+
/**
|
| 360 |
+
* Billing and rate-limit usage.
|
| 361 |
+
*
|
| 362 |
+
* Anthropic's API bills and rate-limits by token counts, as tokens represent the
|
| 363 |
+
* underlying cost to our systems.
|
| 364 |
+
*
|
| 365 |
+
* Under the hood, the API transforms requests into a format suitable for the
|
| 366 |
+
* model. The model's output then goes through a parsing stage before becoming an
|
| 367 |
+
* API response. As a result, the token counts in `usage` will not match one-to-one
|
| 368 |
+
* with the exact visible content of an API request or response.
|
| 369 |
+
*
|
| 370 |
+
* For example, `output_tokens` will be non-zero, even for an empty string response
|
| 371 |
+
* from Claude.
|
| 372 |
+
*
|
| 373 |
+
* Total input tokens in a request is the summation of `input_tokens`,
|
| 374 |
+
* `cache_creation_input_tokens`, and `cache_read_input_tokens`.
|
| 375 |
+
*/
|
| 376 |
+
usage: MessageDeltaUsage;
|
| 377 |
+
}
|
| 378 |
+
export declare namespace RawMessageDeltaEvent {
|
| 379 |
+
interface Delta {
|
| 380 |
+
stop_reason: MessagesAPI.StopReason | null;
|
| 381 |
+
stop_sequence: string | null;
|
| 382 |
+
}
|
| 383 |
+
}
|
| 384 |
+
export interface RawMessageStartEvent {
|
| 385 |
+
message: Message;
|
| 386 |
+
type: 'message_start';
|
| 387 |
+
}
|
| 388 |
+
export interface RawMessageStopEvent {
|
| 389 |
+
type: 'message_stop';
|
| 390 |
+
}
|
| 391 |
+
export type RawMessageStreamEvent = RawMessageStartEvent | RawMessageDeltaEvent | RawMessageStopEvent | RawContentBlockStartEvent | RawContentBlockDeltaEvent | RawContentBlockStopEvent;
|
| 392 |
+
export interface RedactedThinkingBlock {
|
| 393 |
+
data: string;
|
| 394 |
+
type: 'redacted_thinking';
|
| 395 |
+
}
|
| 396 |
+
export interface RedactedThinkingBlockParam {
|
| 397 |
+
data: string;
|
| 398 |
+
type: 'redacted_thinking';
|
| 399 |
+
}
|
| 400 |
+
export interface ServerToolUsage {
|
| 401 |
+
/**
|
| 402 |
+
* The number of web search tool requests.
|
| 403 |
+
*/
|
| 404 |
+
web_search_requests: number;
|
| 405 |
+
}
|
| 406 |
+
export interface ServerToolUseBlock {
|
| 407 |
+
id: string;
|
| 408 |
+
input: unknown;
|
| 409 |
+
name: 'web_search';
|
| 410 |
+
type: 'server_tool_use';
|
| 411 |
+
}
|
| 412 |
+
export interface ServerToolUseBlockParam {
|
| 413 |
+
id: string;
|
| 414 |
+
input: unknown;
|
| 415 |
+
name: 'web_search';
|
| 416 |
+
type: 'server_tool_use';
|
| 417 |
+
/**
|
| 418 |
+
* Create a cache control breakpoint at this content block.
|
| 419 |
+
*/
|
| 420 |
+
cache_control?: CacheControlEphemeral | null;
|
| 421 |
+
}
|
| 422 |
+
export interface SignatureDelta {
|
| 423 |
+
signature: string;
|
| 424 |
+
type: 'signature_delta';
|
| 425 |
+
}
|
| 426 |
+
export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'refusal';
|
| 427 |
+
export interface TextBlock {
|
| 428 |
+
/**
|
| 429 |
+
* Citations supporting the text block.
|
| 430 |
+
*
|
| 431 |
+
* The type of citation returned will depend on the type of document being cited.
|
| 432 |
+
* Citing a PDF results in `page_location`, plain text results in `char_location`,
|
| 433 |
+
* and content document results in `content_block_location`.
|
| 434 |
+
*/
|
| 435 |
+
citations: Array<TextCitation> | null;
|
| 436 |
+
text: string;
|
| 437 |
+
type: 'text';
|
| 438 |
+
}
|
| 439 |
+
export interface TextBlockParam {
|
| 440 |
+
text: string;
|
| 441 |
+
type: 'text';
|
| 442 |
+
/**
|
| 443 |
+
* Create a cache control breakpoint at this content block.
|
| 444 |
+
*/
|
| 445 |
+
cache_control?: CacheControlEphemeral | null;
|
| 446 |
+
citations?: Array<TextCitationParam> | null;
|
| 447 |
+
}
|
| 448 |
+
export type TextCitation = CitationCharLocation | CitationPageLocation | CitationContentBlockLocation | CitationsWebSearchResultLocation;
|
| 449 |
+
export type TextCitationParam = CitationCharLocationParam | CitationPageLocationParam | CitationContentBlockLocationParam | CitationWebSearchResultLocationParam;
|
| 450 |
+
export interface TextDelta {
|
| 451 |
+
text: string;
|
| 452 |
+
type: 'text_delta';
|
| 453 |
+
}
|
| 454 |
+
export interface ThinkingBlock {
|
| 455 |
+
signature: string;
|
| 456 |
+
thinking: string;
|
| 457 |
+
type: 'thinking';
|
| 458 |
+
}
|
| 459 |
+
export interface ThinkingBlockParam {
|
| 460 |
+
signature: string;
|
| 461 |
+
thinking: string;
|
| 462 |
+
type: 'thinking';
|
| 463 |
+
}
|
| 464 |
+
export interface ThinkingConfigDisabled {
|
| 465 |
+
type: 'disabled';
|
| 466 |
+
}
|
| 467 |
+
export interface ThinkingConfigEnabled {
|
| 468 |
+
/**
|
| 469 |
+
* Determines how many tokens Claude can use for its internal reasoning process.
|
| 470 |
+
* Larger budgets can enable more thorough analysis for complex problems, improving
|
| 471 |
+
* response quality.
|
| 472 |
+
*
|
| 473 |
+
* Must be ≥1024 and less than `max_tokens`.
|
| 474 |
+
*
|
| 475 |
+
* See
|
| 476 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 477 |
+
* for details.
|
| 478 |
+
*/
|
| 479 |
+
budget_tokens: number;
|
| 480 |
+
type: 'enabled';
|
| 481 |
+
}
|
| 482 |
+
/**
|
| 483 |
+
* Configuration for enabling Claude's extended thinking.
|
| 484 |
+
*
|
| 485 |
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
| 486 |
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
| 487 |
+
* tokens and counts towards your `max_tokens` limit.
|
| 488 |
+
*
|
| 489 |
+
* See
|
| 490 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 491 |
+
* for details.
|
| 492 |
+
*/
|
| 493 |
+
export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled;
|
| 494 |
+
export interface ThinkingDelta {
|
| 495 |
+
thinking: string;
|
| 496 |
+
type: 'thinking_delta';
|
| 497 |
+
}
|
| 498 |
+
export interface Tool {
|
| 499 |
+
/**
|
| 500 |
+
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
| 501 |
+
*
|
| 502 |
+
* This defines the shape of the `input` that your tool accepts and that the model
|
| 503 |
+
* will produce.
|
| 504 |
+
*/
|
| 505 |
+
input_schema: Tool.InputSchema;
|
| 506 |
+
/**
|
| 507 |
+
* Name of the tool.
|
| 508 |
+
*
|
| 509 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 510 |
+
*/
|
| 511 |
+
name: string;
|
| 512 |
+
/**
|
| 513 |
+
* Create a cache control breakpoint at this content block.
|
| 514 |
+
*/
|
| 515 |
+
cache_control?: CacheControlEphemeral | null;
|
| 516 |
+
/**
|
| 517 |
+
* Description of what this tool does.
|
| 518 |
+
*
|
| 519 |
+
* Tool descriptions should be as detailed as possible. The more information that
|
| 520 |
+
* the model has about what the tool is and how to use it, the better it will
|
| 521 |
+
* perform. You can use natural language descriptions to reinforce important
|
| 522 |
+
* aspects of the tool input JSON schema.
|
| 523 |
+
*/
|
| 524 |
+
description?: string;
|
| 525 |
+
type?: 'custom' | null;
|
| 526 |
+
}
|
| 527 |
+
export declare namespace Tool {
|
| 528 |
+
/**
|
| 529 |
+
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
| 530 |
+
*
|
| 531 |
+
* This defines the shape of the `input` that your tool accepts and that the model
|
| 532 |
+
* will produce.
|
| 533 |
+
*/
|
| 534 |
+
interface InputSchema {
|
| 535 |
+
type: 'object';
|
| 536 |
+
properties?: unknown | null;
|
| 537 |
+
required?: Array<string> | null;
|
| 538 |
+
[k: string]: unknown;
|
| 539 |
+
}
|
| 540 |
+
}
|
| 541 |
+
export interface ToolBash20250124 {
|
| 542 |
+
/**
|
| 543 |
+
* Name of the tool.
|
| 544 |
+
*
|
| 545 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 546 |
+
*/
|
| 547 |
+
name: 'bash';
|
| 548 |
+
type: 'bash_20250124';
|
| 549 |
+
/**
|
| 550 |
+
* Create a cache control breakpoint at this content block.
|
| 551 |
+
*/
|
| 552 |
+
cache_control?: CacheControlEphemeral | null;
|
| 553 |
+
}
|
| 554 |
+
/**
|
| 555 |
+
* How the model should use the provided tools. The model can use a specific tool,
|
| 556 |
+
* any available tool, decide by itself, or not use tools at all.
|
| 557 |
+
*/
|
| 558 |
+
export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone;
|
| 559 |
+
/**
|
| 560 |
+
* The model will use any available tools.
|
| 561 |
+
*/
|
| 562 |
+
export interface ToolChoiceAny {
|
| 563 |
+
type: 'any';
|
| 564 |
+
/**
|
| 565 |
+
* Whether to disable parallel tool use.
|
| 566 |
+
*
|
| 567 |
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
|
| 568 |
+
* use.
|
| 569 |
+
*/
|
| 570 |
+
disable_parallel_tool_use?: boolean;
|
| 571 |
+
}
|
| 572 |
+
/**
|
| 573 |
+
* The model will automatically decide whether to use tools.
|
| 574 |
+
*/
|
| 575 |
+
export interface ToolChoiceAuto {
|
| 576 |
+
type: 'auto';
|
| 577 |
+
/**
|
| 578 |
+
* Whether to disable parallel tool use.
|
| 579 |
+
*
|
| 580 |
+
* Defaults to `false`. If set to `true`, the model will output at most one tool
|
| 581 |
+
* use.
|
| 582 |
+
*/
|
| 583 |
+
disable_parallel_tool_use?: boolean;
|
| 584 |
+
}
|
| 585 |
+
/**
|
| 586 |
+
* The model will not be allowed to use tools.
|
| 587 |
+
*/
|
| 588 |
+
export interface ToolChoiceNone {
|
| 589 |
+
type: 'none';
|
| 590 |
+
}
|
| 591 |
+
/**
|
| 592 |
+
* The model will use the specified tool with `tool_choice.name`.
|
| 593 |
+
*/
|
| 594 |
+
export interface ToolChoiceTool {
|
| 595 |
+
/**
|
| 596 |
+
* The name of the tool to use.
|
| 597 |
+
*/
|
| 598 |
+
name: string;
|
| 599 |
+
type: 'tool';
|
| 600 |
+
/**
|
| 601 |
+
* Whether to disable parallel tool use.
|
| 602 |
+
*
|
| 603 |
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
|
| 604 |
+
* use.
|
| 605 |
+
*/
|
| 606 |
+
disable_parallel_tool_use?: boolean;
|
| 607 |
+
}
|
| 608 |
+
export interface ToolResultBlockParam {
|
| 609 |
+
tool_use_id: string;
|
| 610 |
+
type: 'tool_result';
|
| 611 |
+
/**
|
| 612 |
+
* Create a cache control breakpoint at this content block.
|
| 613 |
+
*/
|
| 614 |
+
cache_control?: CacheControlEphemeral | null;
|
| 615 |
+
content?: string | Array<TextBlockParam | ImageBlockParam>;
|
| 616 |
+
is_error?: boolean;
|
| 617 |
+
}
|
| 618 |
+
export interface ToolTextEditor20250124 {
|
| 619 |
+
/**
|
| 620 |
+
* Name of the tool.
|
| 621 |
+
*
|
| 622 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 623 |
+
*/
|
| 624 |
+
name: 'str_replace_editor';
|
| 625 |
+
type: 'text_editor_20250124';
|
| 626 |
+
/**
|
| 627 |
+
* Create a cache control breakpoint at this content block.
|
| 628 |
+
*/
|
| 629 |
+
cache_control?: CacheControlEphemeral | null;
|
| 630 |
+
}
|
| 631 |
+
export type ToolUnion = Tool | ToolBash20250124 | ToolTextEditor20250124 | ToolUnion.TextEditor20250429 | WebSearchTool20250305;
|
| 632 |
+
export declare namespace ToolUnion {
|
| 633 |
+
interface TextEditor20250429 {
|
| 634 |
+
/**
|
| 635 |
+
* Name of the tool.
|
| 636 |
+
*
|
| 637 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 638 |
+
*/
|
| 639 |
+
name: 'str_replace_based_edit_tool';
|
| 640 |
+
type: 'text_editor_20250429';
|
| 641 |
+
/**
|
| 642 |
+
* Create a cache control breakpoint at this content block.
|
| 643 |
+
*/
|
| 644 |
+
cache_control?: MessagesAPI.CacheControlEphemeral | null;
|
| 645 |
+
}
|
| 646 |
+
}
|
| 647 |
+
export interface ToolUseBlock {
|
| 648 |
+
id: string;
|
| 649 |
+
input: unknown;
|
| 650 |
+
name: string;
|
| 651 |
+
type: 'tool_use';
|
| 652 |
+
}
|
| 653 |
+
export interface ToolUseBlockParam {
|
| 654 |
+
id: string;
|
| 655 |
+
input: unknown;
|
| 656 |
+
name: string;
|
| 657 |
+
type: 'tool_use';
|
| 658 |
+
/**
|
| 659 |
+
* Create a cache control breakpoint at this content block.
|
| 660 |
+
*/
|
| 661 |
+
cache_control?: CacheControlEphemeral | null;
|
| 662 |
+
}
|
| 663 |
+
export interface URLImageSource {
|
| 664 |
+
type: 'url';
|
| 665 |
+
url: string;
|
| 666 |
+
}
|
| 667 |
+
export interface URLPDFSource {
|
| 668 |
+
type: 'url';
|
| 669 |
+
url: string;
|
| 670 |
+
}
|
| 671 |
+
export interface Usage {
|
| 672 |
+
/**
|
| 673 |
+
* The number of input tokens used to create the cache entry.
|
| 674 |
+
*/
|
| 675 |
+
cache_creation_input_tokens: number | null;
|
| 676 |
+
/**
|
| 677 |
+
* The number of input tokens read from the cache.
|
| 678 |
+
*/
|
| 679 |
+
cache_read_input_tokens: number | null;
|
| 680 |
+
/**
|
| 681 |
+
* The number of input tokens which were used.
|
| 682 |
+
*/
|
| 683 |
+
input_tokens: number;
|
| 684 |
+
/**
|
| 685 |
+
* The number of output tokens which were used.
|
| 686 |
+
*/
|
| 687 |
+
output_tokens: number;
|
| 688 |
+
/**
|
| 689 |
+
* The number of server tool requests.
|
| 690 |
+
*/
|
| 691 |
+
server_tool_use: ServerToolUsage | null;
|
| 692 |
+
/**
|
| 693 |
+
* If the request used the priority, standard, or batch tier.
|
| 694 |
+
*/
|
| 695 |
+
service_tier: 'standard' | 'priority' | 'batch' | null;
|
| 696 |
+
}
|
| 697 |
+
export interface WebSearchResultBlock {
|
| 698 |
+
encrypted_content: string;
|
| 699 |
+
page_age: string | null;
|
| 700 |
+
title: string;
|
| 701 |
+
type: 'web_search_result';
|
| 702 |
+
url: string;
|
| 703 |
+
}
|
| 704 |
+
export interface WebSearchResultBlockParam {
|
| 705 |
+
encrypted_content: string;
|
| 706 |
+
title: string;
|
| 707 |
+
type: 'web_search_result';
|
| 708 |
+
url: string;
|
| 709 |
+
page_age?: string | null;
|
| 710 |
+
}
|
| 711 |
+
export interface WebSearchTool20250305 {
|
| 712 |
+
/**
|
| 713 |
+
* Name of the tool.
|
| 714 |
+
*
|
| 715 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 716 |
+
*/
|
| 717 |
+
name: 'web_search';
|
| 718 |
+
type: 'web_search_20250305';
|
| 719 |
+
/**
|
| 720 |
+
* If provided, only these domains will be included in results. Cannot be used
|
| 721 |
+
* alongside `blocked_domains`.
|
| 722 |
+
*/
|
| 723 |
+
allowed_domains?: Array<string> | null;
|
| 724 |
+
/**
|
| 725 |
+
* If provided, these domains will never appear in results. Cannot be used
|
| 726 |
+
* alongside `allowed_domains`.
|
| 727 |
+
*/
|
| 728 |
+
blocked_domains?: Array<string> | null;
|
| 729 |
+
/**
|
| 730 |
+
* Create a cache control breakpoint at this content block.
|
| 731 |
+
*/
|
| 732 |
+
cache_control?: CacheControlEphemeral | null;
|
| 733 |
+
/**
|
| 734 |
+
* Maximum number of times the tool can be used in the API request.
|
| 735 |
+
*/
|
| 736 |
+
max_uses?: number | null;
|
| 737 |
+
/**
|
| 738 |
+
* Parameters for the user's location. Used to provide more relevant search
|
| 739 |
+
* results.
|
| 740 |
+
*/
|
| 741 |
+
user_location?: WebSearchTool20250305.UserLocation | null;
|
| 742 |
+
}
|
| 743 |
+
export declare namespace WebSearchTool20250305 {
|
| 744 |
+
/**
|
| 745 |
+
* Parameters for the user's location. Used to provide more relevant search
|
| 746 |
+
* results.
|
| 747 |
+
*/
|
| 748 |
+
interface UserLocation {
|
| 749 |
+
type: 'approximate';
|
| 750 |
+
/**
|
| 751 |
+
* The city of the user.
|
| 752 |
+
*/
|
| 753 |
+
city?: string | null;
|
| 754 |
+
/**
|
| 755 |
+
* The two letter
|
| 756 |
+
* [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
|
| 757 |
+
* user.
|
| 758 |
+
*/
|
| 759 |
+
country?: string | null;
|
| 760 |
+
/**
|
| 761 |
+
* The region of the user.
|
| 762 |
+
*/
|
| 763 |
+
region?: string | null;
|
| 764 |
+
/**
|
| 765 |
+
* The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
| 766 |
+
*/
|
| 767 |
+
timezone?: string | null;
|
| 768 |
+
}
|
| 769 |
+
}
|
| 770 |
+
export interface WebSearchToolRequestError {
|
| 771 |
+
error_code: 'invalid_tool_input' | 'unavailable' | 'max_uses_exceeded' | 'too_many_requests' | 'query_too_long';
|
| 772 |
+
type: 'web_search_tool_result_error';
|
| 773 |
+
}
|
| 774 |
+
export interface WebSearchToolResultBlock {
|
| 775 |
+
content: WebSearchToolResultBlockContent;
|
| 776 |
+
tool_use_id: string;
|
| 777 |
+
type: 'web_search_tool_result';
|
| 778 |
+
}
|
| 779 |
+
export type WebSearchToolResultBlockContent = WebSearchToolResultError | Array<WebSearchResultBlock>;
|
| 780 |
+
export interface WebSearchToolResultBlockParam {
|
| 781 |
+
content: WebSearchToolResultBlockParamContent;
|
| 782 |
+
tool_use_id: string;
|
| 783 |
+
type: 'web_search_tool_result';
|
| 784 |
+
/**
|
| 785 |
+
* Create a cache control breakpoint at this content block.
|
| 786 |
+
*/
|
| 787 |
+
cache_control?: CacheControlEphemeral | null;
|
| 788 |
+
}
|
| 789 |
+
export type WebSearchToolResultBlockParamContent = Array<WebSearchResultBlockParam> | WebSearchToolRequestError;
|
| 790 |
+
export interface WebSearchToolResultError {
|
| 791 |
+
error_code: 'invalid_tool_input' | 'unavailable' | 'max_uses_exceeded' | 'too_many_requests' | 'query_too_long';
|
| 792 |
+
type: 'web_search_tool_result_error';
|
| 793 |
+
}
|
| 794 |
+
export type MessageStreamEvent = RawMessageStreamEvent;
|
| 795 |
+
export type MessageStartEvent = RawMessageStartEvent;
|
| 796 |
+
export type MessageDeltaEvent = RawMessageDeltaEvent;
|
| 797 |
+
export type MessageStopEvent = RawMessageStopEvent;
|
| 798 |
+
export type ContentBlockStartEvent = RawContentBlockStartEvent;
|
| 799 |
+
export type ContentBlockDeltaEvent = RawContentBlockDeltaEvent;
|
| 800 |
+
export type ContentBlockStopEvent = RawContentBlockStopEvent;
|
| 801 |
+
export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming;
|
| 802 |
+
export interface MessageCreateParamsBase {
|
| 803 |
+
/**
|
| 804 |
+
* The maximum number of tokens to generate before stopping.
|
| 805 |
+
*
|
| 806 |
+
* Note that our models may stop _before_ reaching this maximum. This parameter
|
| 807 |
+
* only specifies the absolute maximum number of tokens to generate.
|
| 808 |
+
*
|
| 809 |
+
* Different models have different maximum values for this parameter. See
|
| 810 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for details.
|
| 811 |
+
*/
|
| 812 |
+
max_tokens: number;
|
| 813 |
+
/**
|
| 814 |
+
* Input messages.
|
| 815 |
+
*
|
| 816 |
+
* Our models are trained to operate on alternating `user` and `assistant`
|
| 817 |
+
* conversational turns. When creating a new `Message`, you specify the prior
|
| 818 |
+
* conversational turns with the `messages` parameter, and the model then generates
|
| 819 |
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
| 820 |
+
* in your request will be combined into a single turn.
|
| 821 |
+
*
|
| 822 |
+
* Each input message must be an object with a `role` and `content`. You can
|
| 823 |
+
* specify a single `user`-role message, or you can include multiple `user` and
|
| 824 |
+
* `assistant` messages.
|
| 825 |
+
*
|
| 826 |
+
* If the final message uses the `assistant` role, the response content will
|
| 827 |
+
* continue immediately from the content in that message. This can be used to
|
| 828 |
+
* constrain part of the model's response.
|
| 829 |
+
*
|
| 830 |
+
* Example with a single `user` message:
|
| 831 |
+
*
|
| 832 |
+
* ```json
|
| 833 |
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
| 834 |
+
* ```
|
| 835 |
+
*
|
| 836 |
+
* Example with multiple conversational turns:
|
| 837 |
+
*
|
| 838 |
+
* ```json
|
| 839 |
+
* [
|
| 840 |
+
* { "role": "user", "content": "Hello there." },
|
| 841 |
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
| 842 |
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
| 843 |
+
* ]
|
| 844 |
+
* ```
|
| 845 |
+
*
|
| 846 |
+
* Example with a partially-filled response from Claude:
|
| 847 |
+
*
|
| 848 |
+
* ```json
|
| 849 |
+
* [
|
| 850 |
+
* {
|
| 851 |
+
* "role": "user",
|
| 852 |
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
| 853 |
+
* },
|
| 854 |
+
* { "role": "assistant", "content": "The best answer is (" }
|
| 855 |
+
* ]
|
| 856 |
+
* ```
|
| 857 |
+
*
|
| 858 |
+
* Each input message `content` may be either a single `string` or an array of
|
| 859 |
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
| 860 |
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
| 861 |
+
* following input messages are equivalent:
|
| 862 |
+
*
|
| 863 |
+
* ```json
|
| 864 |
+
* { "role": "user", "content": "Hello, Claude" }
|
| 865 |
+
* ```
|
| 866 |
+
*
|
| 867 |
+
* ```json
|
| 868 |
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
| 869 |
+
* ```
|
| 870 |
+
*
|
| 871 |
+
* Starting with Claude 3 models, you can also send image content blocks:
|
| 872 |
+
*
|
| 873 |
+
* ```json
|
| 874 |
+
* {
|
| 875 |
+
* "role": "user",
|
| 876 |
+
* "content": [
|
| 877 |
+
* {
|
| 878 |
+
* "type": "image",
|
| 879 |
+
* "source": {
|
| 880 |
+
* "type": "base64",
|
| 881 |
+
* "media_type": "image/jpeg",
|
| 882 |
+
* "data": "/9j/4AAQSkZJRg..."
|
| 883 |
+
* }
|
| 884 |
+
* },
|
| 885 |
+
* { "type": "text", "text": "What is in this image?" }
|
| 886 |
+
* ]
|
| 887 |
+
* }
|
| 888 |
+
* ```
|
| 889 |
+
*
|
| 890 |
+
* We currently support the `base64` source type for images, and the `image/jpeg`,
|
| 891 |
+
* `image/png`, `image/gif`, and `image/webp` media types.
|
| 892 |
+
*
|
| 893 |
+
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
| 894 |
+
* more input examples.
|
| 895 |
+
*
|
| 896 |
+
* Note that if you want to include a
|
| 897 |
+
* [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
| 898 |
+
* the top-level `system` parameter — there is no `"system"` role for input
|
| 899 |
+
* messages in the Messages API.
|
| 900 |
+
*
|
| 901 |
+
* There is a limit of 100000 messages in a single request.
|
| 902 |
+
*/
|
| 903 |
+
messages: Array<MessageParam>;
|
| 904 |
+
/**
|
| 905 |
+
* The model that will complete your prompt.\n\nSee
|
| 906 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 907 |
+
* details and options.
|
| 908 |
+
*/
|
| 909 |
+
model: Model;
|
| 910 |
+
/**
|
| 911 |
+
* An object describing metadata about the request.
|
| 912 |
+
*/
|
| 913 |
+
metadata?: Metadata;
|
| 914 |
+
/**
|
| 915 |
+
* Determines whether to use priority capacity (if available) or standard capacity
|
| 916 |
+
* for this request.
|
| 917 |
+
*
|
| 918 |
+
* Anthropic offers different levels of service for your API requests. See
|
| 919 |
+
* [service-tiers](https://docs.anthropic.com/en/api/service-tiers) for details.
|
| 920 |
+
*/
|
| 921 |
+
service_tier?: 'auto' | 'standard_only';
|
| 922 |
+
/**
|
| 923 |
+
* Custom text sequences that will cause the model to stop generating.
|
| 924 |
+
*
|
| 925 |
+
* Our models will normally stop when they have naturally completed their turn,
|
| 926 |
+
* which will result in a response `stop_reason` of `"end_turn"`.
|
| 927 |
+
*
|
| 928 |
+
* If you want the model to stop generating when it encounters custom strings of
|
| 929 |
+
* text, you can use the `stop_sequences` parameter. If the model encounters one of
|
| 930 |
+
* the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
|
| 931 |
+
* and the response `stop_sequence` value will contain the matched stop sequence.
|
| 932 |
+
*/
|
| 933 |
+
stop_sequences?: Array<string>;
|
| 934 |
+
/**
|
| 935 |
+
* Whether to incrementally stream the response using server-sent events.
|
| 936 |
+
*
|
| 937 |
+
* See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
|
| 938 |
+
* details.
|
| 939 |
+
*/
|
| 940 |
+
stream?: boolean;
|
| 941 |
+
/**
|
| 942 |
+
* System prompt.
|
| 943 |
+
*
|
| 944 |
+
* A system prompt is a way of providing context and instructions to Claude, such
|
| 945 |
+
* as specifying a particular goal or role. See our
|
| 946 |
+
* [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
| 947 |
+
*/
|
| 948 |
+
system?: string | Array<TextBlockParam>;
|
| 949 |
+
/**
|
| 950 |
+
* Amount of randomness injected into the response.
|
| 951 |
+
*
|
| 952 |
+
* Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
|
| 953 |
+
* for analytical / multiple choice, and closer to `1.0` for creative and
|
| 954 |
+
* generative tasks.
|
| 955 |
+
*
|
| 956 |
+
* Note that even with `temperature` of `0.0`, the results will not be fully
|
| 957 |
+
* deterministic.
|
| 958 |
+
*/
|
| 959 |
+
temperature?: number;
|
| 960 |
+
/**
|
| 961 |
+
* Configuration for enabling Claude's extended thinking.
|
| 962 |
+
*
|
| 963 |
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
| 964 |
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
| 965 |
+
* tokens and counts towards your `max_tokens` limit.
|
| 966 |
+
*
|
| 967 |
+
* See
|
| 968 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 969 |
+
* for details.
|
| 970 |
+
*/
|
| 971 |
+
thinking?: ThinkingConfigParam;
|
| 972 |
+
/**
|
| 973 |
+
* How the model should use the provided tools. The model can use a specific tool,
|
| 974 |
+
* any available tool, decide by itself, or not use tools at all.
|
| 975 |
+
*/
|
| 976 |
+
tool_choice?: ToolChoice;
|
| 977 |
+
/**
|
| 978 |
+
* Definitions of tools that the model may use.
|
| 979 |
+
*
|
| 980 |
+
* If you include `tools` in your API request, the model may return `tool_use`
|
| 981 |
+
* content blocks that represent the model's use of those tools. You can then run
|
| 982 |
+
* those tools using the tool input generated by the model and then optionally
|
| 983 |
+
* return results back to the model using `tool_result` content blocks.
|
| 984 |
+
*
|
| 985 |
+
* Each tool definition includes:
|
| 986 |
+
*
|
| 987 |
+
* - `name`: Name of the tool.
|
| 988 |
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
| 989 |
+
* - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
| 990 |
+
* tool `input` shape that the model will produce in `tool_use` output content
|
| 991 |
+
* blocks.
|
| 992 |
+
*
|
| 993 |
+
* For example, if you defined `tools` as:
|
| 994 |
+
*
|
| 995 |
+
* ```json
|
| 996 |
+
* [
|
| 997 |
+
* {
|
| 998 |
+
* "name": "get_stock_price",
|
| 999 |
+
* "description": "Get the current stock price for a given ticker symbol.",
|
| 1000 |
+
* "input_schema": {
|
| 1001 |
+
* "type": "object",
|
| 1002 |
+
* "properties": {
|
| 1003 |
+
* "ticker": {
|
| 1004 |
+
* "type": "string",
|
| 1005 |
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
| 1006 |
+
* }
|
| 1007 |
+
* },
|
| 1008 |
+
* "required": ["ticker"]
|
| 1009 |
+
* }
|
| 1010 |
+
* }
|
| 1011 |
+
* ]
|
| 1012 |
+
* ```
|
| 1013 |
+
*
|
| 1014 |
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
| 1015 |
+
* `tool_use` content blocks in the response like this:
|
| 1016 |
+
*
|
| 1017 |
+
* ```json
|
| 1018 |
+
* [
|
| 1019 |
+
* {
|
| 1020 |
+
* "type": "tool_use",
|
| 1021 |
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1022 |
+
* "name": "get_stock_price",
|
| 1023 |
+
* "input": { "ticker": "^GSPC" }
|
| 1024 |
+
* }
|
| 1025 |
+
* ]
|
| 1026 |
+
* ```
|
| 1027 |
+
*
|
| 1028 |
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
| 1029 |
+
* input, and return the following back to the model in a subsequent `user`
|
| 1030 |
+
* message:
|
| 1031 |
+
*
|
| 1032 |
+
* ```json
|
| 1033 |
+
* [
|
| 1034 |
+
* {
|
| 1035 |
+
* "type": "tool_result",
|
| 1036 |
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1037 |
+
* "content": "259.75 USD"
|
| 1038 |
+
* }
|
| 1039 |
+
* ]
|
| 1040 |
+
* ```
|
| 1041 |
+
*
|
| 1042 |
+
* Tools can be used for workflows that include running client-side tools and
|
| 1043 |
+
* functions, or more generally whenever you want the model to produce a particular
|
| 1044 |
+
* JSON structure of output.
|
| 1045 |
+
*
|
| 1046 |
+
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
| 1047 |
+
*/
|
| 1048 |
+
tools?: Array<ToolUnion>;
|
| 1049 |
+
/**
|
| 1050 |
+
* Only sample from the top K options for each subsequent token.
|
| 1051 |
+
*
|
| 1052 |
+
* Used to remove "long tail" low probability responses.
|
| 1053 |
+
* [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
|
| 1054 |
+
*
|
| 1055 |
+
* Recommended for advanced use cases only. You usually only need to use
|
| 1056 |
+
* `temperature`.
|
| 1057 |
+
*/
|
| 1058 |
+
top_k?: number;
|
| 1059 |
+
/**
|
| 1060 |
+
* Use nucleus sampling.
|
| 1061 |
+
*
|
| 1062 |
+
* In nucleus sampling, we compute the cumulative distribution over all the options
|
| 1063 |
+
* for each subsequent token in decreasing probability order and cut it off once it
|
| 1064 |
+
* reaches a particular probability specified by `top_p`. You should either alter
|
| 1065 |
+
* `temperature` or `top_p`, but not both.
|
| 1066 |
+
*
|
| 1067 |
+
* Recommended for advanced use cases only. You usually only need to use
|
| 1068 |
+
* `temperature`.
|
| 1069 |
+
*/
|
| 1070 |
+
top_p?: number;
|
| 1071 |
+
}
|
| 1072 |
+
export declare namespace MessageCreateParams {
|
| 1073 |
+
type MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming;
|
| 1074 |
+
type MessageCreateParamsStreaming = MessagesAPI.MessageCreateParamsStreaming;
|
| 1075 |
+
}
|
| 1076 |
+
export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase {
|
| 1077 |
+
/**
|
| 1078 |
+
* Whether to incrementally stream the response using server-sent events.
|
| 1079 |
+
*
|
| 1080 |
+
* See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
|
| 1081 |
+
* details.
|
| 1082 |
+
*/
|
| 1083 |
+
stream?: false;
|
| 1084 |
+
}
|
| 1085 |
+
export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
|
| 1086 |
+
/**
|
| 1087 |
+
* Whether to incrementally stream the response using server-sent events.
|
| 1088 |
+
*
|
| 1089 |
+
* See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
|
| 1090 |
+
* details.
|
| 1091 |
+
*/
|
| 1092 |
+
stream: true;
|
| 1093 |
+
}
|
| 1094 |
+
export type MessageStreamParams = MessageCreateParamsBase;
|
| 1095 |
+
export interface MessageCountTokensParams {
|
| 1096 |
+
/**
|
| 1097 |
+
* Input messages.
|
| 1098 |
+
*
|
| 1099 |
+
* Our models are trained to operate on alternating `user` and `assistant`
|
| 1100 |
+
* conversational turns. When creating a new `Message`, you specify the prior
|
| 1101 |
+
* conversational turns with the `messages` parameter, and the model then generates
|
| 1102 |
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
| 1103 |
+
* in your request will be combined into a single turn.
|
| 1104 |
+
*
|
| 1105 |
+
* Each input message must be an object with a `role` and `content`. You can
|
| 1106 |
+
* specify a single `user`-role message, or you can include multiple `user` and
|
| 1107 |
+
* `assistant` messages.
|
| 1108 |
+
*
|
| 1109 |
+
* If the final message uses the `assistant` role, the response content will
|
| 1110 |
+
* continue immediately from the content in that message. This can be used to
|
| 1111 |
+
* constrain part of the model's response.
|
| 1112 |
+
*
|
| 1113 |
+
* Example with a single `user` message:
|
| 1114 |
+
*
|
| 1115 |
+
* ```json
|
| 1116 |
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
| 1117 |
+
* ```
|
| 1118 |
+
*
|
| 1119 |
+
* Example with multiple conversational turns:
|
| 1120 |
+
*
|
| 1121 |
+
* ```json
|
| 1122 |
+
* [
|
| 1123 |
+
* { "role": "user", "content": "Hello there." },
|
| 1124 |
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
| 1125 |
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
| 1126 |
+
* ]
|
| 1127 |
+
* ```
|
| 1128 |
+
*
|
| 1129 |
+
* Example with a partially-filled response from Claude:
|
| 1130 |
+
*
|
| 1131 |
+
* ```json
|
| 1132 |
+
* [
|
| 1133 |
+
* {
|
| 1134 |
+
* "role": "user",
|
| 1135 |
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
| 1136 |
+
* },
|
| 1137 |
+
* { "role": "assistant", "content": "The best answer is (" }
|
| 1138 |
+
* ]
|
| 1139 |
+
* ```
|
| 1140 |
+
*
|
| 1141 |
+
* Each input message `content` may be either a single `string` or an array of
|
| 1142 |
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
| 1143 |
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
| 1144 |
+
* following input messages are equivalent:
|
| 1145 |
+
*
|
| 1146 |
+
* ```json
|
| 1147 |
+
* { "role": "user", "content": "Hello, Claude" }
|
| 1148 |
+
* ```
|
| 1149 |
+
*
|
| 1150 |
+
* ```json
|
| 1151 |
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
| 1152 |
+
* ```
|
| 1153 |
+
*
|
| 1154 |
+
* Starting with Claude 3 models, you can also send image content blocks:
|
| 1155 |
+
*
|
| 1156 |
+
* ```json
|
| 1157 |
+
* {
|
| 1158 |
+
* "role": "user",
|
| 1159 |
+
* "content": [
|
| 1160 |
+
* {
|
| 1161 |
+
* "type": "image",
|
| 1162 |
+
* "source": {
|
| 1163 |
+
* "type": "base64",
|
| 1164 |
+
* "media_type": "image/jpeg",
|
| 1165 |
+
* "data": "/9j/4AAQSkZJRg..."
|
| 1166 |
+
* }
|
| 1167 |
+
* },
|
| 1168 |
+
* { "type": "text", "text": "What is in this image?" }
|
| 1169 |
+
* ]
|
| 1170 |
+
* }
|
| 1171 |
+
* ```
|
| 1172 |
+
*
|
| 1173 |
+
* We currently support the `base64` source type for images, and the `image/jpeg`,
|
| 1174 |
+
* `image/png`, `image/gif`, and `image/webp` media types.
|
| 1175 |
+
*
|
| 1176 |
+
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
| 1177 |
+
* more input examples.
|
| 1178 |
+
*
|
| 1179 |
+
* Note that if you want to include a
|
| 1180 |
+
* [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
| 1181 |
+
* the top-level `system` parameter — there is no `"system"` role for input
|
| 1182 |
+
* messages in the Messages API.
|
| 1183 |
+
*
|
| 1184 |
+
* There is a limit of 100000 messages in a single request.
|
| 1185 |
+
*/
|
| 1186 |
+
messages: Array<MessageParam>;
|
| 1187 |
+
/**
|
| 1188 |
+
* The model that will complete your prompt.\n\nSee
|
| 1189 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 1190 |
+
* details and options.
|
| 1191 |
+
*/
|
| 1192 |
+
model: Model;
|
| 1193 |
+
/**
|
| 1194 |
+
* System prompt.
|
| 1195 |
+
*
|
| 1196 |
+
* A system prompt is a way of providing context and instructions to Claude, such
|
| 1197 |
+
* as specifying a particular goal or role. See our
|
| 1198 |
+
* [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
| 1199 |
+
*/
|
| 1200 |
+
system?: string | Array<TextBlockParam>;
|
| 1201 |
+
/**
|
| 1202 |
+
* Configuration for enabling Claude's extended thinking.
|
| 1203 |
+
*
|
| 1204 |
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
| 1205 |
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
| 1206 |
+
* tokens and counts towards your `max_tokens` limit.
|
| 1207 |
+
*
|
| 1208 |
+
* See
|
| 1209 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 1210 |
+
* for details.
|
| 1211 |
+
*/
|
| 1212 |
+
thinking?: ThinkingConfigParam;
|
| 1213 |
+
/**
|
| 1214 |
+
* How the model should use the provided tools. The model can use a specific tool,
|
| 1215 |
+
* any available tool, decide by itself, or not use tools at all.
|
| 1216 |
+
*/
|
| 1217 |
+
tool_choice?: ToolChoice;
|
| 1218 |
+
/**
|
| 1219 |
+
* Definitions of tools that the model may use.
|
| 1220 |
+
*
|
| 1221 |
+
* If you include `tools` in your API request, the model may return `tool_use`
|
| 1222 |
+
* content blocks that represent the model's use of those tools. You can then run
|
| 1223 |
+
* those tools using the tool input generated by the model and then optionally
|
| 1224 |
+
* return results back to the model using `tool_result` content blocks.
|
| 1225 |
+
*
|
| 1226 |
+
* Each tool definition includes:
|
| 1227 |
+
*
|
| 1228 |
+
* - `name`: Name of the tool.
|
| 1229 |
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
| 1230 |
+
* - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
| 1231 |
+
* tool `input` shape that the model will produce in `tool_use` output content
|
| 1232 |
+
* blocks.
|
| 1233 |
+
*
|
| 1234 |
+
* For example, if you defined `tools` as:
|
| 1235 |
+
*
|
| 1236 |
+
* ```json
|
| 1237 |
+
* [
|
| 1238 |
+
* {
|
| 1239 |
+
* "name": "get_stock_price",
|
| 1240 |
+
* "description": "Get the current stock price for a given ticker symbol.",
|
| 1241 |
+
* "input_schema": {
|
| 1242 |
+
* "type": "object",
|
| 1243 |
+
* "properties": {
|
| 1244 |
+
* "ticker": {
|
| 1245 |
+
* "type": "string",
|
| 1246 |
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
| 1247 |
+
* }
|
| 1248 |
+
* },
|
| 1249 |
+
* "required": ["ticker"]
|
| 1250 |
+
* }
|
| 1251 |
+
* }
|
| 1252 |
+
* ]
|
| 1253 |
+
* ```
|
| 1254 |
+
*
|
| 1255 |
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
| 1256 |
+
* `tool_use` content blocks in the response like this:
|
| 1257 |
+
*
|
| 1258 |
+
* ```json
|
| 1259 |
+
* [
|
| 1260 |
+
* {
|
| 1261 |
+
* "type": "tool_use",
|
| 1262 |
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1263 |
+
* "name": "get_stock_price",
|
| 1264 |
+
* "input": { "ticker": "^GSPC" }
|
| 1265 |
+
* }
|
| 1266 |
+
* ]
|
| 1267 |
+
* ```
|
| 1268 |
+
*
|
| 1269 |
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
| 1270 |
+
* input, and return the following back to the model in a subsequent `user`
|
| 1271 |
+
* message:
|
| 1272 |
+
*
|
| 1273 |
+
* ```json
|
| 1274 |
+
* [
|
| 1275 |
+
* {
|
| 1276 |
+
* "type": "tool_result",
|
| 1277 |
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1278 |
+
* "content": "259.75 USD"
|
| 1279 |
+
* }
|
| 1280 |
+
* ]
|
| 1281 |
+
* ```
|
| 1282 |
+
*
|
| 1283 |
+
* Tools can be used for workflows that include running client-side tools and
|
| 1284 |
+
* functions, or more generally whenever you want the model to produce a particular
|
| 1285 |
+
* JSON structure of output.
|
| 1286 |
+
*
|
| 1287 |
+
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
| 1288 |
+
*/
|
| 1289 |
+
tools?: Array<MessageCountTokensTool>;
|
| 1290 |
+
}
|
| 1291 |
+
export declare namespace Messages {
|
| 1292 |
+
export { type Base64ImageSource as Base64ImageSource, type Base64PDFSource as Base64PDFSource, type CacheControlEphemeral as CacheControlEphemeral, type CitationCharLocation as CitationCharLocation, type CitationCharLocationParam as CitationCharLocationParam, type CitationContentBlockLocation as CitationContentBlockLocation, type CitationContentBlockLocationParam as CitationContentBlockLocationParam, type CitationPageLocation as CitationPageLocation, type CitationPageLocationParam as CitationPageLocationParam, type CitationWebSearchResultLocationParam as CitationWebSearchResultLocationParam, type CitationsConfigParam as CitationsConfigParam, type CitationsDelta as CitationsDelta, type CitationsWebSearchResultLocation as CitationsWebSearchResultLocation, type ContentBlock as ContentBlock, type ContentBlockParam as ContentBlockParam, type ContentBlockStartEvent as ContentBlockStartEvent, type ContentBlockStopEvent as ContentBlockStopEvent, type ContentBlockSource as ContentBlockSource, type ContentBlockSourceContent as ContentBlockSourceContent, type DocumentBlockParam as DocumentBlockParam, type ImageBlockParam as ImageBlockParam, type InputJSONDelta as InputJSONDelta, type Message as Message, type MessageCountTokensTool as MessageCountTokensTool, type MessageDeltaEvent as MessageDeltaEvent, type MessageDeltaUsage as MessageDeltaUsage, type MessageParam as MessageParam, type MessageTokensCount as MessageTokensCount, type Metadata as Metadata, type Model as Model, type PlainTextSource as PlainTextSource, type RawContentBlockDelta as RawContentBlockDelta, 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 RedactedThinkingBlock as RedactedThinkingBlock, type RedactedThinkingBlockParam as RedactedThinkingBlockParam, type ServerToolUsage as ServerToolUsage, type ServerToolUseBlock as ServerToolUseBlock, type ServerToolUseBlockParam as ServerToolUseBlockParam, type SignatureDelta as SignatureDelta, type StopReason as StopReason, type TextBlock as TextBlock, type TextBlockParam as TextBlockParam, type TextCitation as TextCitation, type TextCitationParam as TextCitationParam, type TextDelta as TextDelta, type ThinkingBlock as ThinkingBlock, type ThinkingBlockParam as ThinkingBlockParam, type ThinkingConfigDisabled as ThinkingConfigDisabled, type ThinkingConfigEnabled as ThinkingConfigEnabled, type ThinkingConfigParam as ThinkingConfigParam, type ThinkingDelta as ThinkingDelta, type Tool as Tool, type ToolBash20250124 as ToolBash20250124, type ToolChoice as ToolChoice, type ToolChoiceAny as ToolChoiceAny, type ToolChoiceAuto as ToolChoiceAuto, type ToolChoiceNone as ToolChoiceNone, type ToolChoiceTool as ToolChoiceTool, type ToolResultBlockParam as ToolResultBlockParam, type ToolTextEditor20250124 as ToolTextEditor20250124, type ToolUnion as ToolUnion, type ToolUseBlock as ToolUseBlock, type ToolUseBlockParam as ToolUseBlockParam, type URLImageSource as URLImageSource, type URLPDFSource as URLPDFSource, type Usage as Usage, type WebSearchResultBlock as WebSearchResultBlock, type WebSearchResultBlockParam as WebSearchResultBlockParam, type WebSearchTool20250305 as WebSearchTool20250305, type WebSearchToolRequestError as WebSearchToolRequestError, type WebSearchToolResultBlock as WebSearchToolResultBlock, type WebSearchToolResultBlockContent as WebSearchToolResultBlockContent, type WebSearchToolResultBlockParam as WebSearchToolResultBlockParam, type WebSearchToolResultBlockParamContent as WebSearchToolResultBlockParamContent, type WebSearchToolResultError as WebSearchToolResultError, type MessageStreamEvent as MessageStreamEvent, type MessageStartEvent as MessageStartEvent, type MessageStopEvent as MessageStopEvent, type ContentBlockDeltaEvent as ContentBlockDeltaEvent, type MessageCreateParams as MessageCreateParams, type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming, type MessageCreateParamsStreaming as MessageCreateParamsStreaming, type MessageStreamParams as MessageStreamParams, type MessageCountTokensParams as MessageCountTokensParams, };
|
| 1293 |
+
export { Batches as Batches, type DeletedMessageBatch as DeletedMessageBatch, type MessageBatch as MessageBatch, type MessageBatchCanceledResult as MessageBatchCanceledResult, type MessageBatchErroredResult as MessageBatchErroredResult, type MessageBatchExpiredResult as MessageBatchExpiredResult, type MessageBatchIndividualResponse as MessageBatchIndividualResponse, type MessageBatchRequestCounts as MessageBatchRequestCounts, type MessageBatchResult as MessageBatchResult, type MessageBatchSucceededResult as MessageBatchSucceededResult, type MessageBatchesPage as MessageBatchesPage, type BatchCreateParams as BatchCreateParams, type BatchListParams as BatchListParams, };
|
| 1294 |
+
}
|
| 1295 |
+
//# sourceMappingURL=messages.d.mts.map
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../../src/resources/messages/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,WAAW,EAAE;OAGf,EAAE,aAAa,EAAE;OACjB,KAAK,UAAU;OACf,EAGL,OAAO,GAWR;OAGM,EAAE,yBAAyB,EAAE;AAEpC,MAAM,OAAO,QAAS,SAAQ,WAAW;IAAzC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAiFrE,CAAC;IApDC,MAAM,CACJ,IAAyB,EACzB,OAAwB;QAExB,IAAI,IAAI,CAAC,KAAK,IAAI,iBAAiB,EAAE,CAAC;YACpC,OAAO,CAAC,IAAI,CACV,cAAc,IAAI,CAAC,KAAK,iDACtB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2pCF,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC"}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/api-promise.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
import { type BaseAnthropic } from '../client';
|
| 4 |
+
|
| 5 |
+
import { type PromiseOrValue } from '../internal/types';
|
| 6 |
+
import {
|
| 7 |
+
type APIResponseProps,
|
| 8 |
+
type WithRequestID,
|
| 9 |
+
defaultParseResponse,
|
| 10 |
+
addRequestID,
|
| 11 |
+
} from '../internal/parse';
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* A subclass of `Promise` providing additional helper methods
|
| 15 |
+
* for interacting with the SDK.
|
| 16 |
+
*/
|
| 17 |
+
export class APIPromise<T> extends Promise<WithRequestID<T>> {
|
| 18 |
+
private parsedPromise: Promise<WithRequestID<T>> | undefined;
|
| 19 |
+
#client: BaseAnthropic;
|
| 20 |
+
|
| 21 |
+
constructor(
|
| 22 |
+
client: BaseAnthropic,
|
| 23 |
+
private responsePromise: Promise<APIResponseProps>,
|
| 24 |
+
private parseResponse: (
|
| 25 |
+
client: BaseAnthropic,
|
| 26 |
+
props: APIResponseProps,
|
| 27 |
+
) => PromiseOrValue<WithRequestID<T>> = defaultParseResponse,
|
| 28 |
+
) {
|
| 29 |
+
super((resolve) => {
|
| 30 |
+
// this is maybe a bit weird but this has to be a no-op to not implicitly
|
| 31 |
+
// parse the response body; instead .then, .catch, .finally are overridden
|
| 32 |
+
// to parse the response
|
| 33 |
+
resolve(null as any);
|
| 34 |
+
});
|
| 35 |
+
this.#client = client;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
_thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U> {
|
| 39 |
+
return new APIPromise(this.#client, this.responsePromise, async (client, props) =>
|
| 40 |
+
addRequestID(transform(await this.parseResponse(client, props), props), props.response),
|
| 41 |
+
);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Gets the raw `Response` instance instead of parsing the response
|
| 46 |
+
* data.
|
| 47 |
+
*
|
| 48 |
+
* If you want to parse the response body but still get the `Response`
|
| 49 |
+
* instance, you can use {@link withResponse()}.
|
| 50 |
+
*
|
| 51 |
+
* 👋 Getting the wrong TypeScript type for `Response`?
|
| 52 |
+
* Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
|
| 53 |
+
* to your `tsconfig.json`.
|
| 54 |
+
*/
|
| 55 |
+
asResponse(): Promise<Response> {
|
| 56 |
+
return this.responsePromise.then((p) => p.response);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Gets the parsed response data, the raw `Response` instance and the ID of the request,
|
| 61 |
+
* returned via the `request-id` header which is useful for debugging requests and resporting
|
| 62 |
+
* issues to Anthropic.
|
| 63 |
+
*
|
| 64 |
+
* If you just want to get the raw `Response` instance without parsing it,
|
| 65 |
+
* you can use {@link asResponse()}.
|
| 66 |
+
*
|
| 67 |
+
* 👋 Getting the wrong TypeScript type for `Response`?
|
| 68 |
+
* Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]`
|
| 69 |
+
* to your `tsconfig.json`.
|
| 70 |
+
*/
|
| 71 |
+
async withResponse(): Promise<{ data: T; response: Response; request_id: string | null | undefined }> {
|
| 72 |
+
const [data, response] = await Promise.all([this.parse(), this.asResponse()]);
|
| 73 |
+
return { data, response, request_id: response.headers.get('request-id') };
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
private parse(): Promise<WithRequestID<T>> {
|
| 77 |
+
if (!this.parsedPromise) {
|
| 78 |
+
this.parsedPromise = this.responsePromise.then(
|
| 79 |
+
(data) => this.parseResponse(this.#client, data) as any as Promise<WithRequestID<T>>,
|
| 80 |
+
);
|
| 81 |
+
}
|
| 82 |
+
return this.parsedPromise;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
override then<TResult1 = WithRequestID<T>, TResult2 = never>(
|
| 86 |
+
onfulfilled?: ((value: WithRequestID<T>) => TResult1 | PromiseLike<TResult1>) | undefined | null,
|
| 87 |
+
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
|
| 88 |
+
): Promise<TResult1 | TResult2> {
|
| 89 |
+
return this.parse().then(onfulfilled, onrejected);
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
override catch<TResult = never>(
|
| 93 |
+
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
|
| 94 |
+
): Promise<WithRequestID<T> | TResult> {
|
| 95 |
+
return this.parse().catch(onrejected);
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
override finally(onfinally?: (() => void) | undefined | null): Promise<WithRequestID<T>> {
|
| 99 |
+
return this.parse().finally(onfinally);
|
| 100 |
+
}
|
| 101 |
+
}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/error.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
import { castToError } from '../internal/errors';
|
| 4 |
+
|
| 5 |
+
export class AnthropicError extends Error {}
|
| 6 |
+
|
| 7 |
+
export class APIError<
|
| 8 |
+
TStatus extends number | undefined = number | undefined,
|
| 9 |
+
THeaders extends Headers | undefined = Headers | undefined,
|
| 10 |
+
TError extends Object | undefined = Object | undefined,
|
| 11 |
+
> extends AnthropicError {
|
| 12 |
+
/** HTTP status for the response that caused the error */
|
| 13 |
+
readonly status: TStatus;
|
| 14 |
+
/** HTTP headers for the response that caused the error */
|
| 15 |
+
readonly headers: THeaders;
|
| 16 |
+
/** JSON body of the response that caused the error */
|
| 17 |
+
readonly error: TError;
|
| 18 |
+
|
| 19 |
+
readonly requestID: string | null | undefined;
|
| 20 |
+
|
| 21 |
+
constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) {
|
| 22 |
+
super(`${APIError.makeMessage(status, error, message)}`);
|
| 23 |
+
this.status = status;
|
| 24 |
+
this.headers = headers;
|
| 25 |
+
this.requestID = headers?.get('request-id');
|
| 26 |
+
this.error = error;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
|
| 30 |
+
const msg =
|
| 31 |
+
error?.message ?
|
| 32 |
+
typeof error.message === 'string' ?
|
| 33 |
+
error.message
|
| 34 |
+
: JSON.stringify(error.message)
|
| 35 |
+
: error ? JSON.stringify(error)
|
| 36 |
+
: message;
|
| 37 |
+
|
| 38 |
+
if (status && msg) {
|
| 39 |
+
return `${status} ${msg}`;
|
| 40 |
+
}
|
| 41 |
+
if (status) {
|
| 42 |
+
return `${status} status code (no body)`;
|
| 43 |
+
}
|
| 44 |
+
if (msg) {
|
| 45 |
+
return msg;
|
| 46 |
+
}
|
| 47 |
+
return '(no status code or body)';
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
static generate(
|
| 51 |
+
status: number | undefined,
|
| 52 |
+
errorResponse: Object | undefined,
|
| 53 |
+
message: string | undefined,
|
| 54 |
+
headers: Headers | undefined,
|
| 55 |
+
): APIError {
|
| 56 |
+
if (!status || !headers) {
|
| 57 |
+
return new APIConnectionError({ message, cause: castToError(errorResponse) });
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
const error = errorResponse as Record<string, any>;
|
| 61 |
+
|
| 62 |
+
if (status === 400) {
|
| 63 |
+
return new BadRequestError(status, error, message, headers);
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
if (status === 401) {
|
| 67 |
+
return new AuthenticationError(status, error, message, headers);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
if (status === 403) {
|
| 71 |
+
return new PermissionDeniedError(status, error, message, headers);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
if (status === 404) {
|
| 75 |
+
return new NotFoundError(status, error, message, headers);
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
if (status === 409) {
|
| 79 |
+
return new ConflictError(status, error, message, headers);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
if (status === 422) {
|
| 83 |
+
return new UnprocessableEntityError(status, error, message, headers);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
if (status === 429) {
|
| 87 |
+
return new RateLimitError(status, error, message, headers);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
if (status >= 500) {
|
| 91 |
+
return new InternalServerError(status, error, message, headers);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
return new APIError(status, error, message, headers);
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
export class APIUserAbortError extends APIError<undefined, undefined, undefined> {
|
| 99 |
+
constructor({ message }: { message?: string } = {}) {
|
| 100 |
+
super(undefined, undefined, message || 'Request was aborted.', undefined);
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
export class APIConnectionError extends APIError<undefined, undefined, undefined> {
|
| 105 |
+
constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) {
|
| 106 |
+
super(undefined, undefined, message || 'Connection error.', undefined);
|
| 107 |
+
// in some environments the 'cause' property is already declared
|
| 108 |
+
// @ts-ignore
|
| 109 |
+
if (cause) this.cause = cause;
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
export class APIConnectionTimeoutError extends APIConnectionError {
|
| 114 |
+
constructor({ message }: { message?: string } = {}) {
|
| 115 |
+
super({ message: message ?? 'Request timed out.' });
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
export class BadRequestError extends APIError<400, Headers> {}
|
| 120 |
+
|
| 121 |
+
export class AuthenticationError extends APIError<401, Headers> {}
|
| 122 |
+
|
| 123 |
+
export class PermissionDeniedError extends APIError<403, Headers> {}
|
| 124 |
+
|
| 125 |
+
export class NotFoundError extends APIError<404, Headers> {}
|
| 126 |
+
|
| 127 |
+
export class ConflictError extends APIError<409, Headers> {}
|
| 128 |
+
|
| 129 |
+
export class UnprocessableEntityError extends APIError<422, Headers> {}
|
| 130 |
+
|
| 131 |
+
export class RateLimitError extends APIError<429, Headers> {}
|
| 132 |
+
|
| 133 |
+
export class InternalServerError extends APIError<number, Headers> {}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/pagination.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
import { AnthropicError } from './error';
|
| 4 |
+
import { FinalRequestOptions } from '../internal/request-options';
|
| 5 |
+
import { defaultParseResponse, WithRequestID } from '../internal/parse';
|
| 6 |
+
import { type BaseAnthropic } from '../client';
|
| 7 |
+
import { APIPromise } from './api-promise';
|
| 8 |
+
import { type APIResponseProps } from '../internal/parse';
|
| 9 |
+
import { maybeObj } from '../internal/utils/values';
|
| 10 |
+
|
| 11 |
+
export type PageRequestOptions = Pick<FinalRequestOptions, 'query' | 'headers' | 'body' | 'path' | 'method'>;
|
| 12 |
+
|
| 13 |
+
export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
| 14 |
+
#client: BaseAnthropic;
|
| 15 |
+
protected options: FinalRequestOptions;
|
| 16 |
+
|
| 17 |
+
protected response: Response;
|
| 18 |
+
protected body: unknown;
|
| 19 |
+
|
| 20 |
+
constructor(client: BaseAnthropic, response: Response, body: unknown, options: FinalRequestOptions) {
|
| 21 |
+
this.#client = client;
|
| 22 |
+
this.options = options;
|
| 23 |
+
this.response = response;
|
| 24 |
+
this.body = body;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
abstract nextPageRequestOptions(): PageRequestOptions | null;
|
| 28 |
+
|
| 29 |
+
abstract getPaginatedItems(): Item[];
|
| 30 |
+
|
| 31 |
+
hasNextPage(): boolean {
|
| 32 |
+
const items = this.getPaginatedItems();
|
| 33 |
+
if (!items.length) return false;
|
| 34 |
+
return this.nextPageRequestOptions() != null;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
async getNextPage(): Promise<this> {
|
| 38 |
+
const nextOptions = this.nextPageRequestOptions();
|
| 39 |
+
if (!nextOptions) {
|
| 40 |
+
throw new AnthropicError(
|
| 41 |
+
'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.',
|
| 42 |
+
);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
return await this.#client.requestAPIList(this.constructor as any, nextOptions);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
async *iterPages(): AsyncGenerator<this> {
|
| 49 |
+
let page: this = this;
|
| 50 |
+
yield page;
|
| 51 |
+
while (page.hasNextPage()) {
|
| 52 |
+
page = await page.getNextPage();
|
| 53 |
+
yield page;
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
| 58 |
+
for await (const page of this.iterPages()) {
|
| 59 |
+
for (const item of page.getPaginatedItems()) {
|
| 60 |
+
yield item;
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/**
|
| 67 |
+
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
| 68 |
+
*
|
| 69 |
+
* It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
|
| 70 |
+
*
|
| 71 |
+
* for await (const item of client.items.list()) {
|
| 72 |
+
* console.log(item)
|
| 73 |
+
* }
|
| 74 |
+
*/
|
| 75 |
+
export class PagePromise<
|
| 76 |
+
PageClass extends AbstractPage<Item>,
|
| 77 |
+
Item = ReturnType<PageClass['getPaginatedItems']>[number],
|
| 78 |
+
>
|
| 79 |
+
extends APIPromise<PageClass>
|
| 80 |
+
implements AsyncIterable<Item>
|
| 81 |
+
{
|
| 82 |
+
constructor(
|
| 83 |
+
client: BaseAnthropic,
|
| 84 |
+
request: Promise<APIResponseProps>,
|
| 85 |
+
Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass,
|
| 86 |
+
) {
|
| 87 |
+
super(
|
| 88 |
+
client,
|
| 89 |
+
request,
|
| 90 |
+
async (client, props) =>
|
| 91 |
+
new Page(
|
| 92 |
+
client,
|
| 93 |
+
props.response,
|
| 94 |
+
await defaultParseResponse(client, props),
|
| 95 |
+
props.options,
|
| 96 |
+
) as WithRequestID<PageClass>,
|
| 97 |
+
);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/**
|
| 101 |
+
* Allow auto-paginating iteration on an unawaited list call, eg:
|
| 102 |
+
*
|
| 103 |
+
* for await (const item of client.items.list()) {
|
| 104 |
+
* console.log(item)
|
| 105 |
+
* }
|
| 106 |
+
*/
|
| 107 |
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
| 108 |
+
const page = await this;
|
| 109 |
+
for await (const item of page) {
|
| 110 |
+
yield item;
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
export interface PageResponse<Item> {
|
| 116 |
+
data: Array<Item>;
|
| 117 |
+
|
| 118 |
+
has_more: boolean;
|
| 119 |
+
|
| 120 |
+
first_id: string | null;
|
| 121 |
+
|
| 122 |
+
last_id: string | null;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
export interface PageParams {
|
| 126 |
+
/**
|
| 127 |
+
* Number of items per page.
|
| 128 |
+
*/
|
| 129 |
+
limit?: number;
|
| 130 |
+
|
| 131 |
+
before_id?: string;
|
| 132 |
+
|
| 133 |
+
after_id?: string;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
export class Page<Item> extends AbstractPage<Item> implements PageResponse<Item> {
|
| 137 |
+
data: Array<Item>;
|
| 138 |
+
|
| 139 |
+
has_more: boolean;
|
| 140 |
+
|
| 141 |
+
first_id: string | null;
|
| 142 |
+
|
| 143 |
+
last_id: string | null;
|
| 144 |
+
|
| 145 |
+
constructor(
|
| 146 |
+
client: BaseAnthropic,
|
| 147 |
+
response: Response,
|
| 148 |
+
body: PageResponse<Item>,
|
| 149 |
+
options: FinalRequestOptions,
|
| 150 |
+
) {
|
| 151 |
+
super(client, response, body, options);
|
| 152 |
+
|
| 153 |
+
this.data = body.data || [];
|
| 154 |
+
this.has_more = body.has_more || false;
|
| 155 |
+
this.first_id = body.first_id || null;
|
| 156 |
+
this.last_id = body.last_id || null;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
getPaginatedItems(): Item[] {
|
| 160 |
+
return this.data ?? [];
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
override hasNextPage(): boolean {
|
| 164 |
+
if (this.has_more === false) {
|
| 165 |
+
return false;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
return super.hasNextPage();
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
nextPageRequestOptions(): PageRequestOptions | null {
|
| 172 |
+
if ((this.options.query as Record<string, unknown>)?.['before_id']) {
|
| 173 |
+
// in reverse
|
| 174 |
+
const first_id = this.first_id;
|
| 175 |
+
if (!first_id) {
|
| 176 |
+
return null;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
return {
|
| 180 |
+
...this.options,
|
| 181 |
+
query: {
|
| 182 |
+
...maybeObj(this.options.query),
|
| 183 |
+
before_id: first_id,
|
| 184 |
+
},
|
| 185 |
+
};
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
const cursor = this.last_id;
|
| 189 |
+
if (!cursor) {
|
| 190 |
+
return null;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
return {
|
| 194 |
+
...this.options,
|
| 195 |
+
query: {
|
| 196 |
+
...maybeObj(this.options.query),
|
| 197 |
+
after_id: cursor,
|
| 198 |
+
},
|
| 199 |
+
};
|
| 200 |
+
}
|
| 201 |
+
}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/resource.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
import { BaseAnthropic } from '../client';
|
| 4 |
+
|
| 5 |
+
export class APIResource {
|
| 6 |
+
protected _client: BaseAnthropic;
|
| 7 |
+
|
| 8 |
+
constructor(client: BaseAnthropic) {
|
| 9 |
+
this._client = client;
|
| 10 |
+
}
|
| 11 |
+
}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/stre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 2 |
+
import { type ReadableStream } from '../internal/shim-types';
|
| 3 |
+
import { makeReadableStream } from '../internal/shims';
|
| 4 |
+
import { findDoubleNewlineIndex, LineDecoder } from '../internal/decoders/line';
|
| 5 |
+
import { ReadableStreamToAsyncIterable } from '../internal/shims';
|
| 6 |
+
import { isAbortError } from '../internal/errors';
|
| 7 |
+
import { safeJSON } from '../internal/utils/values';
|
| 8 |
+
import { encodeUTF8 } from '../internal/utils/bytes';
|
| 9 |
+
|
| 10 |
+
import { APIError } from './error';
|
| 11 |
+
|
| 12 |
+
type Bytes = string | ArrayBuffer | Uint8Array | null | undefined;
|
| 13 |
+
|
| 14 |
+
export type ServerSentEvent = {
|
| 15 |
+
event: string | null;
|
| 16 |
+
data: string;
|
| 17 |
+
raw: string[];
|
| 18 |
+
};
|
| 19 |
+
|
| 20 |
+
export class Stream<Item> implements AsyncIterable<Item> {
|
| 21 |
+
controller: AbortController;
|
| 22 |
+
|
| 23 |
+
constructor(
|
| 24 |
+
private iterator: () => AsyncIterator<Item>,
|
| 25 |
+
controller: AbortController,
|
| 26 |
+
) {
|
| 27 |
+
this.controller = controller;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
static fromSSEResponse<Item>(response: Response, controller: AbortController): Stream<Item> {
|
| 31 |
+
let consumed = false;
|
| 32 |
+
|
| 33 |
+
async function* iterator(): AsyncIterator<Item, any, undefined> {
|
| 34 |
+
if (consumed) {
|
| 35 |
+
throw new AnthropicError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
|
| 36 |
+
}
|
| 37 |
+
consumed = true;
|
| 38 |
+
let done = false;
|
| 39 |
+
try {
|
| 40 |
+
for await (const sse of _iterSSEMessages(response, controller)) {
|
| 41 |
+
if (sse.event === 'completion') {
|
| 42 |
+
try {
|
| 43 |
+
yield JSON.parse(sse.data);
|
| 44 |
+
} catch (e) {
|
| 45 |
+
console.error(`Could not parse message into JSON:`, sse.data);
|
| 46 |
+
console.error(`From chunk:`, sse.raw);
|
| 47 |
+
throw e;
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
if (
|
| 52 |
+
sse.event === 'message_start' ||
|
| 53 |
+
sse.event === 'message_delta' ||
|
| 54 |
+
sse.event === 'message_stop' ||
|
| 55 |
+
sse.event === 'content_block_start' ||
|
| 56 |
+
sse.event === 'content_block_delta' ||
|
| 57 |
+
sse.event === 'content_block_stop'
|
| 58 |
+
) {
|
| 59 |
+
try {
|
| 60 |
+
yield JSON.parse(sse.data);
|
| 61 |
+
} catch (e) {
|
| 62 |
+
console.error(`Could not parse message into JSON:`, sse.data);
|
| 63 |
+
console.error(`From chunk:`, sse.raw);
|
| 64 |
+
throw e;
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
if (sse.event === 'ping') {
|
| 69 |
+
continue;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
if (sse.event === 'error') {
|
| 73 |
+
throw new APIError(undefined, safeJSON(sse.data) ?? sse.data, undefined, response.headers);
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
done = true;
|
| 77 |
+
} catch (e) {
|
| 78 |
+
// If the user calls `stream.controller.abort()`, we should exit without throwing.
|
| 79 |
+
if (isAbortError(e)) return;
|
| 80 |
+
throw e;
|
| 81 |
+
} finally {
|
| 82 |
+
// If the user `break`s, abort the ongoing request.
|
| 83 |
+
if (!done) controller.abort();
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
return new Stream(iterator, controller);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Generates a Stream from a newline-separated ReadableStream
|
| 92 |
+
* where each item is a JSON value.
|
| 93 |
+
*/
|
| 94 |
+
static fromReadableStream<Item>(readableStream: ReadableStream, controller: AbortController): Stream<Item> {
|
| 95 |
+
let consumed = false;
|
| 96 |
+
|
| 97 |
+
async function* iterLines(): AsyncGenerator<string, void, unknown> {
|
| 98 |
+
const lineDecoder = new LineDecoder();
|
| 99 |
+
|
| 100 |
+
const iter = ReadableStreamToAsyncIterable<Bytes>(readableStream);
|
| 101 |
+
for await (const chunk of iter) {
|
| 102 |
+
for (const line of lineDecoder.decode(chunk)) {
|
| 103 |
+
yield line;
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
for (const line of lineDecoder.flush()) {
|
| 108 |
+
yield line;
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
async function* iterator(): AsyncIterator<Item, any, undefined> {
|
| 113 |
+
if (consumed) {
|
| 114 |
+
throw new AnthropicError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
|
| 115 |
+
}
|
| 116 |
+
consumed = true;
|
| 117 |
+
let done = false;
|
| 118 |
+
try {
|
| 119 |
+
for await (const line of iterLines()) {
|
| 120 |
+
if (done) continue;
|
| 121 |
+
if (line) yield JSON.parse(line);
|
| 122 |
+
}
|
| 123 |
+
done = true;
|
| 124 |
+
} catch (e) {
|
| 125 |
+
// If the user calls `stream.controller.abort()`, we should exit without throwing.
|
| 126 |
+
if (isAbortError(e)) return;
|
| 127 |
+
throw e;
|
| 128 |
+
} finally {
|
| 129 |
+
// If the user `break`s, abort the ongoing request.
|
| 130 |
+
if (!done) controller.abort();
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
return new Stream(iterator, controller);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
[Symbol.asyncIterator](): AsyncIterator<Item> {
|
| 138 |
+
return this.iterator();
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
/**
|
| 142 |
+
* Splits the stream into two streams which can be
|
| 143 |
+
* independently read from at different speeds.
|
| 144 |
+
*/
|
| 145 |
+
tee(): [Stream<Item>, Stream<Item>] {
|
| 146 |
+
const left: Array<Promise<IteratorResult<Item>>> = [];
|
| 147 |
+
const right: Array<Promise<IteratorResult<Item>>> = [];
|
| 148 |
+
const iterator = this.iterator();
|
| 149 |
+
|
| 150 |
+
const teeIterator = (queue: Array<Promise<IteratorResult<Item>>>): AsyncIterator<Item> => {
|
| 151 |
+
return {
|
| 152 |
+
next: () => {
|
| 153 |
+
if (queue.length === 0) {
|
| 154 |
+
const result = iterator.next();
|
| 155 |
+
left.push(result);
|
| 156 |
+
right.push(result);
|
| 157 |
+
}
|
| 158 |
+
return queue.shift()!;
|
| 159 |
+
},
|
| 160 |
+
};
|
| 161 |
+
};
|
| 162 |
+
|
| 163 |
+
return [
|
| 164 |
+
new Stream(() => teeIterator(left), this.controller),
|
| 165 |
+
new Stream(() => teeIterator(right), this.controller),
|
| 166 |
+
];
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* Converts this stream to a newline-separated ReadableStream of
|
| 171 |
+
* JSON stringified values in the stream
|
| 172 |
+
* which can be turned back into a Stream with `Stream.fromReadableStream()`.
|
| 173 |
+
*/
|
| 174 |
+
toReadableStream(): ReadableStream {
|
| 175 |
+
const self = this;
|
| 176 |
+
let iter: AsyncIterator<Item>;
|
| 177 |
+
|
| 178 |
+
return makeReadableStream({
|
| 179 |
+
async start() {
|
| 180 |
+
iter = self[Symbol.asyncIterator]();
|
| 181 |
+
},
|
| 182 |
+
async pull(ctrl: any) {
|
| 183 |
+
try {
|
| 184 |
+
const { value, done } = await iter.next();
|
| 185 |
+
if (done) return ctrl.close();
|
| 186 |
+
|
| 187 |
+
const bytes = encodeUTF8(JSON.stringify(value) + '\n');
|
| 188 |
+
|
| 189 |
+
ctrl.enqueue(bytes);
|
| 190 |
+
} catch (err) {
|
| 191 |
+
ctrl.error(err);
|
| 192 |
+
}
|
| 193 |
+
},
|
| 194 |
+
async cancel() {
|
| 195 |
+
await iter.return?.();
|
| 196 |
+
},
|
| 197 |
+
});
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
export async function* _iterSSEMessages(
|
| 202 |
+
response: Response,
|
| 203 |
+
controller: AbortController,
|
| 204 |
+
): AsyncGenerator<ServerSentEvent, void, unknown> {
|
| 205 |
+
if (!response.body) {
|
| 206 |
+
controller.abort();
|
| 207 |
+
if (
|
| 208 |
+
typeof (globalThis as any).navigator !== 'undefined' &&
|
| 209 |
+
(globalThis as any).navigator.product === 'ReactNative'
|
| 210 |
+
) {
|
| 211 |
+
throw new AnthropicError(
|
| 212 |
+
`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`,
|
| 213 |
+
);
|
| 214 |
+
}
|
| 215 |
+
throw new AnthropicError(`Attempted to iterate over a response with no body`);
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
const sseDecoder = new SSEDecoder();
|
| 219 |
+
const lineDecoder = new LineDecoder();
|
| 220 |
+
|
| 221 |
+
const iter = ReadableStreamToAsyncIterable<Bytes>(response.body);
|
| 222 |
+
for await (const sseChunk of iterSSEChunks(iter)) {
|
| 223 |
+
for (const line of lineDecoder.decode(sseChunk)) {
|
| 224 |
+
const sse = sseDecoder.decode(line);
|
| 225 |
+
if (sse) yield sse;
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
for (const line of lineDecoder.flush()) {
|
| 230 |
+
const sse = sseDecoder.decode(line);
|
| 231 |
+
if (sse) yield sse;
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
/**
|
| 236 |
+
* Given an async iterable iterator, iterates over it and yields full
|
| 237 |
+
* SSE chunks, i.e. yields when a double new-line is encountered.
|
| 238 |
+
*/
|
| 239 |
+
async function* iterSSEChunks(iterator: AsyncIterableIterator<Bytes>): AsyncGenerator<Uint8Array> {
|
| 240 |
+
let data = new Uint8Array();
|
| 241 |
+
|
| 242 |
+
for await (const chunk of iterator) {
|
| 243 |
+
if (chunk == null) {
|
| 244 |
+
continue;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
const binaryChunk =
|
| 248 |
+
chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
|
| 249 |
+
: typeof chunk === 'string' ? encodeUTF8(chunk)
|
| 250 |
+
: chunk;
|
| 251 |
+
|
| 252 |
+
let newData = new Uint8Array(data.length + binaryChunk.length);
|
| 253 |
+
newData.set(data);
|
| 254 |
+
newData.set(binaryChunk, data.length);
|
| 255 |
+
data = newData;
|
| 256 |
+
|
| 257 |
+
let patternIndex;
|
| 258 |
+
while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) {
|
| 259 |
+
yield data.slice(0, patternIndex);
|
| 260 |
+
data = data.slice(patternIndex);
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
if (data.length > 0) {
|
| 265 |
+
yield data;
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
class SSEDecoder {
|
| 270 |
+
private data: string[];
|
| 271 |
+
private event: string | null;
|
| 272 |
+
private chunks: string[];
|
| 273 |
+
|
| 274 |
+
constructor() {
|
| 275 |
+
this.event = null;
|
| 276 |
+
this.data = [];
|
| 277 |
+
this.chunks = [];
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
decode(line: string) {
|
| 281 |
+
if (line.endsWith('\r')) {
|
| 282 |
+
line = line.substring(0, line.length - 1);
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
if (!line) {
|
| 286 |
+
// empty line and we didn't previously encounter any messages
|
| 287 |
+
if (!this.event && !this.data.length) return null;
|
| 288 |
+
|
| 289 |
+
const sse: ServerSentEvent = {
|
| 290 |
+
event: this.event,
|
| 291 |
+
data: this.data.join('\n'),
|
| 292 |
+
raw: this.chunks,
|
| 293 |
+
};
|
| 294 |
+
|
| 295 |
+
this.event = null;
|
| 296 |
+
this.data = [];
|
| 297 |
+
this.chunks = [];
|
| 298 |
+
|
| 299 |
+
return sse;
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
this.chunks.push(line);
|
| 303 |
+
|
| 304 |
+
if (line.startsWith(':')) {
|
| 305 |
+
return null;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
let [fieldname, _, value] = partition(line, ':');
|
| 309 |
+
|
| 310 |
+
if (value.startsWith(' ')) {
|
| 311 |
+
value = value.substring(1);
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
if (fieldname === 'event') {
|
| 315 |
+
this.event = value;
|
| 316 |
+
} else if (fieldname === 'data') {
|
| 317 |
+
this.data.push(value);
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
return null;
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
function partition(str: string, delimiter: string): [string, string, string] {
|
| 325 |
+
const index = str.indexOf(delimiter);
|
| 326 |
+
if (index !== -1) {
|
| 327 |
+
return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)];
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
return [str, '', ''];
|
| 331 |
+
}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/core/uploads.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export { type Uploadable } from '../internal/uploads';
|
| 2 |
+
export { toFile, type ToFileInput } from '../internal/to-file';
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/constants.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File containing shared constants
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Model-specific timeout constraints for non-streaming requests
|
| 5 |
+
*/
|
| 6 |
+
export const MODEL_NONSTREAMING_TOKENS: Record<string, number> = {
|
| 7 |
+
'claude-opus-4-20250514': 8192,
|
| 8 |
+
'claude-opus-4-0': 8192,
|
| 9 |
+
'claude-4-opus-20250514': 8192,
|
| 10 |
+
'anthropic.claude-opus-4-20250514-v1:0': 8192,
|
| 11 |
+
'claude-opus-4@20250514': 8192,
|
| 12 |
+
};
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/detect-platform.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
import { VERSION } from '../version';
|
| 4 |
+
|
| 5 |
+
export const isRunningInBrowser = () => {
|
| 6 |
+
return (
|
| 7 |
+
// @ts-ignore
|
| 8 |
+
typeof window !== 'undefined' &&
|
| 9 |
+
// @ts-ignore
|
| 10 |
+
typeof window.document !== 'undefined' &&
|
| 11 |
+
// @ts-ignore
|
| 12 |
+
typeof navigator !== 'undefined'
|
| 13 |
+
);
|
| 14 |
+
};
|
| 15 |
+
|
| 16 |
+
type DetectedPlatform = 'deno' | 'node' | 'edge' | 'unknown';
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Note this does not detect 'browser'; for that, use getBrowserInfo().
|
| 20 |
+
*/
|
| 21 |
+
function getDetectedPlatform(): DetectedPlatform {
|
| 22 |
+
if (typeof Deno !== 'undefined' && Deno.build != null) {
|
| 23 |
+
return 'deno';
|
| 24 |
+
}
|
| 25 |
+
if (typeof EdgeRuntime !== 'undefined') {
|
| 26 |
+
return 'edge';
|
| 27 |
+
}
|
| 28 |
+
if (
|
| 29 |
+
Object.prototype.toString.call(
|
| 30 |
+
typeof (globalThis as any).process !== 'undefined' ? (globalThis as any).process : 0,
|
| 31 |
+
) === '[object process]'
|
| 32 |
+
) {
|
| 33 |
+
return 'node';
|
| 34 |
+
}
|
| 35 |
+
return 'unknown';
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
declare const Deno: any;
|
| 39 |
+
declare const EdgeRuntime: any;
|
| 40 |
+
type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | `other:${string}` | 'unknown';
|
| 41 |
+
type PlatformName =
|
| 42 |
+
| 'MacOS'
|
| 43 |
+
| 'Linux'
|
| 44 |
+
| 'Windows'
|
| 45 |
+
| 'FreeBSD'
|
| 46 |
+
| 'OpenBSD'
|
| 47 |
+
| 'iOS'
|
| 48 |
+
| 'Android'
|
| 49 |
+
| `Other:${string}`
|
| 50 |
+
| 'Unknown';
|
| 51 |
+
type Browser = 'ie' | 'edge' | 'chrome' | 'firefox' | 'safari';
|
| 52 |
+
type PlatformProperties = {
|
| 53 |
+
'X-Stainless-Lang': 'js';
|
| 54 |
+
'X-Stainless-Package-Version': string;
|
| 55 |
+
'X-Stainless-OS': PlatformName;
|
| 56 |
+
'X-Stainless-Arch': Arch;
|
| 57 |
+
'X-Stainless-Runtime': 'node' | 'deno' | 'edge' | `browser:${Browser}` | 'unknown';
|
| 58 |
+
'X-Stainless-Runtime-Version': string;
|
| 59 |
+
};
|
| 60 |
+
const getPlatformProperties = (): PlatformProperties => {
|
| 61 |
+
const detectedPlatform = getDetectedPlatform();
|
| 62 |
+
if (detectedPlatform === 'deno') {
|
| 63 |
+
return {
|
| 64 |
+
'X-Stainless-Lang': 'js',
|
| 65 |
+
'X-Stainless-Package-Version': VERSION,
|
| 66 |
+
'X-Stainless-OS': normalizePlatform(Deno.build.os),
|
| 67 |
+
'X-Stainless-Arch': normalizeArch(Deno.build.arch),
|
| 68 |
+
'X-Stainless-Runtime': 'deno',
|
| 69 |
+
'X-Stainless-Runtime-Version':
|
| 70 |
+
typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
|
| 71 |
+
};
|
| 72 |
+
}
|
| 73 |
+
if (typeof EdgeRuntime !== 'undefined') {
|
| 74 |
+
return {
|
| 75 |
+
'X-Stainless-Lang': 'js',
|
| 76 |
+
'X-Stainless-Package-Version': VERSION,
|
| 77 |
+
'X-Stainless-OS': 'Unknown',
|
| 78 |
+
'X-Stainless-Arch': `other:${EdgeRuntime}`,
|
| 79 |
+
'X-Stainless-Runtime': 'edge',
|
| 80 |
+
'X-Stainless-Runtime-Version': (globalThis as any).process.version,
|
| 81 |
+
};
|
| 82 |
+
}
|
| 83 |
+
// Check if Node.js
|
| 84 |
+
if (detectedPlatform === 'node') {
|
| 85 |
+
return {
|
| 86 |
+
'X-Stainless-Lang': 'js',
|
| 87 |
+
'X-Stainless-Package-Version': VERSION,
|
| 88 |
+
'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform ?? 'unknown'),
|
| 89 |
+
'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch ?? 'unknown'),
|
| 90 |
+
'X-Stainless-Runtime': 'node',
|
| 91 |
+
'X-Stainless-Runtime-Version': (globalThis as any).process.version ?? 'unknown',
|
| 92 |
+
};
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
const browserInfo = getBrowserInfo();
|
| 96 |
+
if (browserInfo) {
|
| 97 |
+
return {
|
| 98 |
+
'X-Stainless-Lang': 'js',
|
| 99 |
+
'X-Stainless-Package-Version': VERSION,
|
| 100 |
+
'X-Stainless-OS': 'Unknown',
|
| 101 |
+
'X-Stainless-Arch': 'unknown',
|
| 102 |
+
'X-Stainless-Runtime': `browser:${browserInfo.browser}`,
|
| 103 |
+
'X-Stainless-Runtime-Version': browserInfo.version,
|
| 104 |
+
};
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
// TODO add support for Cloudflare workers, etc.
|
| 108 |
+
return {
|
| 109 |
+
'X-Stainless-Lang': 'js',
|
| 110 |
+
'X-Stainless-Package-Version': VERSION,
|
| 111 |
+
'X-Stainless-OS': 'Unknown',
|
| 112 |
+
'X-Stainless-Arch': 'unknown',
|
| 113 |
+
'X-Stainless-Runtime': 'unknown',
|
| 114 |
+
'X-Stainless-Runtime-Version': 'unknown',
|
| 115 |
+
};
|
| 116 |
+
};
|
| 117 |
+
|
| 118 |
+
type BrowserInfo = {
|
| 119 |
+
browser: Browser;
|
| 120 |
+
version: string;
|
| 121 |
+
};
|
| 122 |
+
|
| 123 |
+
declare const navigator: { userAgent: string } | undefined;
|
| 124 |
+
|
| 125 |
+
// Note: modified from https://github.com/JS-DevTools/host-environment/blob/b1ab79ecde37db5d6e163c050e54fe7d287d7c92/src/isomorphic.browser.ts
|
| 126 |
+
function getBrowserInfo(): BrowserInfo | null {
|
| 127 |
+
if (typeof navigator === 'undefined' || !navigator) {
|
| 128 |
+
return null;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
// NOTE: The order matters here!
|
| 132 |
+
const browserPatterns = [
|
| 133 |
+
{ key: 'edge' as const, pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
| 134 |
+
{ key: 'ie' as const, pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
| 135 |
+
{ key: 'ie' as const, pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
| 136 |
+
{ key: 'chrome' as const, pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
| 137 |
+
{ key: 'firefox' as const, pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
|
| 138 |
+
{ key: 'safari' as const, pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ },
|
| 139 |
+
];
|
| 140 |
+
|
| 141 |
+
// Find the FIRST matching browser
|
| 142 |
+
for (const { key, pattern } of browserPatterns) {
|
| 143 |
+
const match = pattern.exec(navigator.userAgent);
|
| 144 |
+
if (match) {
|
| 145 |
+
const major = match[1] || 0;
|
| 146 |
+
const minor = match[2] || 0;
|
| 147 |
+
const patch = match[3] || 0;
|
| 148 |
+
|
| 149 |
+
return { browser: key, version: `${major}.${minor}.${patch}` };
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
return null;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
const normalizeArch = (arch: string): Arch => {
|
| 157 |
+
// Node docs:
|
| 158 |
+
// - https://nodejs.org/api/process.html#processarch
|
| 159 |
+
// Deno docs:
|
| 160 |
+
// - https://doc.deno.land/deno/stable/~/Deno.build
|
| 161 |
+
if (arch === 'x32') return 'x32';
|
| 162 |
+
if (arch === 'x86_64' || arch === 'x64') return 'x64';
|
| 163 |
+
if (arch === 'arm') return 'arm';
|
| 164 |
+
if (arch === 'aarch64' || arch === 'arm64') return 'arm64';
|
| 165 |
+
if (arch) return `other:${arch}`;
|
| 166 |
+
return 'unknown';
|
| 167 |
+
};
|
| 168 |
+
|
| 169 |
+
const normalizePlatform = (platform: string): PlatformName => {
|
| 170 |
+
// Node platforms:
|
| 171 |
+
// - https://nodejs.org/api/process.html#processplatform
|
| 172 |
+
// Deno platforms:
|
| 173 |
+
// - https://doc.deno.land/deno/stable/~/Deno.build
|
| 174 |
+
// - https://github.com/denoland/deno/issues/14799
|
| 175 |
+
|
| 176 |
+
platform = platform.toLowerCase();
|
| 177 |
+
|
| 178 |
+
// NOTE: this iOS check is untested and may not work
|
| 179 |
+
// Node does not work natively on IOS, there is a fork at
|
| 180 |
+
// https://github.com/nodejs-mobile/nodejs-mobile
|
| 181 |
+
// however it is unknown at the time of writing how to detect if it is running
|
| 182 |
+
if (platform.includes('ios')) return 'iOS';
|
| 183 |
+
if (platform === 'android') return 'Android';
|
| 184 |
+
if (platform === 'darwin') return 'MacOS';
|
| 185 |
+
if (platform === 'win32') return 'Windows';
|
| 186 |
+
if (platform === 'freebsd') return 'FreeBSD';
|
| 187 |
+
if (platform === 'openbsd') return 'OpenBSD';
|
| 188 |
+
if (platform === 'linux') return 'Linux';
|
| 189 |
+
if (platform) return `Other:${platform}`;
|
| 190 |
+
return 'Unknown';
|
| 191 |
+
};
|
| 192 |
+
|
| 193 |
+
let _platformHeaders: PlatformProperties;
|
| 194 |
+
export const getPlatformHeaders = () => {
|
| 195 |
+
return (_platformHeaders ??= getPlatformProperties());
|
| 196 |
+
};
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/request-options.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
import { NullableHeaders } from './headers';
|
| 4 |
+
|
| 5 |
+
import type { BodyInit } from './builtin-types';
|
| 6 |
+
import { Stream } from '../core/streaming';
|
| 7 |
+
import type { HTTPMethod, MergedRequestInit } from './types';
|
| 8 |
+
import { type HeadersLike } from './headers';
|
| 9 |
+
|
| 10 |
+
export type FinalRequestOptions = RequestOptions & { method: HTTPMethod; path: string };
|
| 11 |
+
|
| 12 |
+
export type RequestOptions = {
|
| 13 |
+
method?: HTTPMethod;
|
| 14 |
+
path?: string;
|
| 15 |
+
query?: object | undefined | null;
|
| 16 |
+
body?: unknown;
|
| 17 |
+
headers?: HeadersLike;
|
| 18 |
+
maxRetries?: number;
|
| 19 |
+
stream?: boolean | undefined;
|
| 20 |
+
timeout?: number;
|
| 21 |
+
fetchOptions?: MergedRequestInit;
|
| 22 |
+
signal?: AbortSignal | undefined | null;
|
| 23 |
+
idempotencyKey?: string;
|
| 24 |
+
|
| 25 |
+
__binaryResponse?: boolean | undefined;
|
| 26 |
+
__streamClass?: typeof Stream;
|
| 27 |
+
};
|
| 28 |
+
|
| 29 |
+
export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit };
|
| 30 |
+
export type RequestEncoder = (request: { headers: NullableHeaders; body: unknown }) => EncodedContent;
|
| 31 |
+
|
| 32 |
+
export const FallbackEncoder: RequestEncoder = ({ headers, body }) => {
|
| 33 |
+
return {
|
| 34 |
+
bodyHeaders: {
|
| 35 |
+
'content-type': 'application/json',
|
| 36 |
+
},
|
| 37 |
+
body: JSON.stringify(body),
|
| 38 |
+
};
|
| 39 |
+
};
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/shim-types.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Shims for types that we can't always rely on being available globally.
|
| 5 |
+
*
|
| 6 |
+
* Note: these only exist at the type-level, there is no corresponding runtime
|
| 7 |
+
* version for any of these symbols.
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
type NeverToAny<T> = T extends never ? any : T;
|
| 11 |
+
|
| 12 |
+
/** @ts-ignore */
|
| 13 |
+
type _DOMReadableStream<R = any> = globalThis.ReadableStream<R>;
|
| 14 |
+
|
| 15 |
+
/** @ts-ignore */
|
| 16 |
+
type _NodeReadableStream<R = any> = import('stream/web').ReadableStream<R>;
|
| 17 |
+
|
| 18 |
+
type _ConditionalNodeReadableStream<R = any> =
|
| 19 |
+
typeof globalThis extends { ReadableStream: any } ? never : _NodeReadableStream<R>;
|
| 20 |
+
|
| 21 |
+
type _ReadableStream<R = any> = NeverToAny<
|
| 22 |
+
| ([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>)
|
| 23 |
+
| ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)
|
| 24 |
+
>;
|
| 25 |
+
|
| 26 |
+
export type { _ReadableStream as ReadableStream };
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/internal/stream-utils.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Most browsers don't yet have async iterable support for ReadableStream,
|
| 3 |
+
* and Node has a very different way of reading bytes from its "ReadableStream".
|
| 4 |
+
*
|
| 5 |
+
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
| 6 |
+
*/
|
| 7 |
+
export function ReadableStreamToAsyncIterable<T>(stream: any): AsyncIterableIterator<T> {
|
| 8 |
+
if (stream[Symbol.asyncIterator]) return stream;
|
| 9 |
+
|
| 10 |
+
const reader = stream.getReader();
|
| 11 |
+
return {
|
| 12 |
+
async next() {
|
| 13 |
+
try {
|
| 14 |
+
const result = await reader.read();
|
| 15 |
+
if (result?.done) reader.releaseLock(); // release lock when stream becomes closed
|
| 16 |
+
return result;
|
| 17 |
+
} catch (e) {
|
| 18 |
+
reader.releaseLock(); // release lock when stream becomes errored
|
| 19 |
+
throw e;
|
| 20 |
+
}
|
| 21 |
+
},
|
| 22 |
+
async return() {
|
| 23 |
+
const cancelPromise = reader.cancel();
|
| 24 |
+
reader.releaseLock();
|
| 25 |
+
await cancelPromise;
|
| 26 |
+
return { done: true, value: undefined };
|
| 27 |
+
},
|
| 28 |
+
[Symbol.asyncIterator]() {
|
| 29 |
+
return this;
|
| 30 |
+
},
|
| 31 |
+
};
|
| 32 |
+
}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts
ADDED
|
@@ -0,0 +1,698 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { isAbortError } from '../internal/errors';
|
| 2 |
+
import { AnthropicError, APIUserAbortError } from '../error';
|
| 3 |
+
import {
|
| 4 |
+
type BetaContentBlock,
|
| 5 |
+
Messages as BetaMessages,
|
| 6 |
+
type BetaMessage,
|
| 7 |
+
type BetaRawMessageStreamEvent as BetaMessageStreamEvent,
|
| 8 |
+
type BetaMessageParam,
|
| 9 |
+
type MessageCreateParams as BetaMessageCreateParams,
|
| 10 |
+
type MessageCreateParamsBase as BetaMessageCreateParamsBase,
|
| 11 |
+
type BetaTextBlock,
|
| 12 |
+
type BetaTextCitation,
|
| 13 |
+
type BetaToolUseBlock,
|
| 14 |
+
type BetaServerToolUseBlock,
|
| 15 |
+
type BetaMCPToolUseBlock,
|
| 16 |
+
} from '../resources/beta/messages/messages';
|
| 17 |
+
import { Stream } from '../streaming';
|
| 18 |
+
import { partialParse } from '../_vendor/partial-json-parser/parser';
|
| 19 |
+
import { type RequestOptions } from '../internal/request-options';
|
| 20 |
+
|
| 21 |
+
export interface MessageStreamEvents {
|
| 22 |
+
connect: () => void;
|
| 23 |
+
streamEvent: (event: BetaMessageStreamEvent, snapshot: BetaMessage) => void;
|
| 24 |
+
text: (textDelta: string, textSnapshot: string) => void;
|
| 25 |
+
citation: (citation: BetaTextCitation, citationsSnapshot: BetaTextCitation[]) => void;
|
| 26 |
+
inputJson: (partialJson: string, jsonSnapshot: unknown) => void;
|
| 27 |
+
thinking: (thinkingDelta: string, thinkingSnapshot: string) => void;
|
| 28 |
+
signature: (signature: string) => void;
|
| 29 |
+
message: (message: BetaMessage) => void;
|
| 30 |
+
contentBlock: (content: BetaContentBlock) => void;
|
| 31 |
+
finalMessage: (message: BetaMessage) => void;
|
| 32 |
+
error: (error: AnthropicError) => void;
|
| 33 |
+
abort: (error: APIUserAbortError) => void;
|
| 34 |
+
end: () => void;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
type MessageStreamEventListeners<Event extends keyof MessageStreamEvents> = {
|
| 38 |
+
listener: MessageStreamEvents[Event];
|
| 39 |
+
once?: boolean;
|
| 40 |
+
}[];
|
| 41 |
+
|
| 42 |
+
const JSON_BUF_PROPERTY = '__json_buf';
|
| 43 |
+
|
| 44 |
+
export type TracksToolInput = BetaToolUseBlock | BetaServerToolUseBlock | BetaMCPToolUseBlock;
|
| 45 |
+
|
| 46 |
+
function tracksToolInput(content: BetaContentBlock): content is TracksToolInput {
|
| 47 |
+
return content.type === 'tool_use' || content.type === 'server_tool_use' || content.type === 'mcp_tool_use';
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
export class BetaMessageStream implements AsyncIterable<BetaMessageStreamEvent> {
|
| 51 |
+
messages: BetaMessageParam[] = [];
|
| 52 |
+
receivedMessages: BetaMessage[] = [];
|
| 53 |
+
#currentMessageSnapshot: BetaMessage | undefined;
|
| 54 |
+
|
| 55 |
+
controller: AbortController = new AbortController();
|
| 56 |
+
|
| 57 |
+
#connectedPromise: Promise<Response | null>;
|
| 58 |
+
#resolveConnectedPromise: (response: Response | null) => void = () => {};
|
| 59 |
+
#rejectConnectedPromise: (error: AnthropicError) => void = () => {};
|
| 60 |
+
|
| 61 |
+
#endPromise: Promise<void>;
|
| 62 |
+
#resolveEndPromise: () => void = () => {};
|
| 63 |
+
#rejectEndPromise: (error: AnthropicError) => void = () => {};
|
| 64 |
+
|
| 65 |
+
#listeners: { [Event in keyof MessageStreamEvents]?: MessageStreamEventListeners<Event> } = {};
|
| 66 |
+
|
| 67 |
+
#ended = false;
|
| 68 |
+
#errored = false;
|
| 69 |
+
#aborted = false;
|
| 70 |
+
#catchingPromiseCreated = false;
|
| 71 |
+
#response: Response | null | undefined;
|
| 72 |
+
#request_id: string | null | undefined;
|
| 73 |
+
|
| 74 |
+
constructor() {
|
| 75 |
+
this.#connectedPromise = new Promise<Response | null>((resolve, reject) => {
|
| 76 |
+
this.#resolveConnectedPromise = resolve;
|
| 77 |
+
this.#rejectConnectedPromise = reject;
|
| 78 |
+
});
|
| 79 |
+
|
| 80 |
+
this.#endPromise = new Promise<void>((resolve, reject) => {
|
| 81 |
+
this.#resolveEndPromise = resolve;
|
| 82 |
+
this.#rejectEndPromise = reject;
|
| 83 |
+
});
|
| 84 |
+
|
| 85 |
+
// Don't let these promises cause unhandled rejection errors.
|
| 86 |
+
// we will manually cause an unhandled rejection error later
|
| 87 |
+
// if the user hasn't registered any error listener or called
|
| 88 |
+
// any promise-returning method.
|
| 89 |
+
this.#connectedPromise.catch(() => {});
|
| 90 |
+
this.#endPromise.catch(() => {});
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
get response(): Response | null | undefined {
|
| 94 |
+
return this.#response;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
get request_id(): string | null | undefined {
|
| 98 |
+
return this.#request_id;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
/**
|
| 102 |
+
* Returns the `MessageStream` data, the raw `Response` instance and the ID of the request,
|
| 103 |
+
* returned vie the `request-id` header which is useful for debugging requests and resporting
|
| 104 |
+
* issues to Anthropic.
|
| 105 |
+
*
|
| 106 |
+
* This is the same as the `APIPromise.withResponse()` method.
|
| 107 |
+
*
|
| 108 |
+
* This method will raise an error if you created the stream using `MessageStream.fromReadableStream`
|
| 109 |
+
* as no `Response` is available.
|
| 110 |
+
*/
|
| 111 |
+
async withResponse(): Promise<{
|
| 112 |
+
data: BetaMessageStream;
|
| 113 |
+
response: Response;
|
| 114 |
+
request_id: string | null | undefined;
|
| 115 |
+
}> {
|
| 116 |
+
const response = await this.#connectedPromise;
|
| 117 |
+
if (!response) {
|
| 118 |
+
throw new Error('Could not resolve a `Response` object');
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
return {
|
| 122 |
+
data: this,
|
| 123 |
+
response,
|
| 124 |
+
request_id: response.headers.get('request-id'),
|
| 125 |
+
};
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
/**
|
| 129 |
+
* Intended for use on the frontend, consuming a stream produced with
|
| 130 |
+
* `.toReadableStream()` on the backend.
|
| 131 |
+
*
|
| 132 |
+
* Note that messages sent to the model do not appear in `.on('message')`
|
| 133 |
+
* in this context.
|
| 134 |
+
*/
|
| 135 |
+
static fromReadableStream(stream: ReadableStream): BetaMessageStream {
|
| 136 |
+
const runner = new BetaMessageStream();
|
| 137 |
+
runner._run(() => runner._fromReadableStream(stream));
|
| 138 |
+
return runner;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
static createMessage(
|
| 142 |
+
messages: BetaMessages,
|
| 143 |
+
params: BetaMessageCreateParamsBase,
|
| 144 |
+
options?: RequestOptions,
|
| 145 |
+
): BetaMessageStream {
|
| 146 |
+
const runner = new BetaMessageStream();
|
| 147 |
+
for (const message of params.messages) {
|
| 148 |
+
runner._addMessageParam(message);
|
| 149 |
+
}
|
| 150 |
+
runner._run(() =>
|
| 151 |
+
runner._createMessage(
|
| 152 |
+
messages,
|
| 153 |
+
{ ...params, stream: true },
|
| 154 |
+
{ ...options, headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'stream' } },
|
| 155 |
+
),
|
| 156 |
+
);
|
| 157 |
+
return runner;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
protected _run(executor: () => Promise<any>) {
|
| 161 |
+
executor().then(() => {
|
| 162 |
+
this._emitFinal();
|
| 163 |
+
this._emit('end');
|
| 164 |
+
}, this.#handleError);
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
protected _addMessageParam(message: BetaMessageParam) {
|
| 168 |
+
this.messages.push(message);
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
protected _addMessage(message: BetaMessage, emit = true) {
|
| 172 |
+
this.receivedMessages.push(message);
|
| 173 |
+
if (emit) {
|
| 174 |
+
this._emit('message', message);
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
protected async _createMessage(
|
| 179 |
+
messages: BetaMessages,
|
| 180 |
+
params: BetaMessageCreateParams,
|
| 181 |
+
options?: RequestOptions,
|
| 182 |
+
): Promise<void> {
|
| 183 |
+
const signal = options?.signal;
|
| 184 |
+
if (signal) {
|
| 185 |
+
if (signal.aborted) this.controller.abort();
|
| 186 |
+
signal.addEventListener('abort', () => this.controller.abort());
|
| 187 |
+
}
|
| 188 |
+
this.#beginRequest();
|
| 189 |
+
const { response, data: stream } = await messages
|
| 190 |
+
.create({ ...params, stream: true }, { ...options, signal: this.controller.signal })
|
| 191 |
+
.withResponse();
|
| 192 |
+
this._connected(response);
|
| 193 |
+
for await (const event of stream) {
|
| 194 |
+
this.#addStreamEvent(event);
|
| 195 |
+
}
|
| 196 |
+
if (stream.controller.signal?.aborted) {
|
| 197 |
+
throw new APIUserAbortError();
|
| 198 |
+
}
|
| 199 |
+
this.#endRequest();
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
protected _connected(response: Response | null) {
|
| 203 |
+
if (this.ended) return;
|
| 204 |
+
this.#response = response;
|
| 205 |
+
this.#request_id = response?.headers.get('request-id');
|
| 206 |
+
this.#resolveConnectedPromise(response);
|
| 207 |
+
this._emit('connect');
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
get ended(): boolean {
|
| 211 |
+
return this.#ended;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
get errored(): boolean {
|
| 215 |
+
return this.#errored;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
get aborted(): boolean {
|
| 219 |
+
return this.#aborted;
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
abort() {
|
| 223 |
+
this.controller.abort();
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
/**
|
| 227 |
+
* Adds the listener function to the end of the listeners array for the event.
|
| 228 |
+
* No checks are made to see if the listener has already been added. Multiple calls passing
|
| 229 |
+
* the same combination of event and listener will result in the listener being added, and
|
| 230 |
+
* called, multiple times.
|
| 231 |
+
* @returns this MessageStream, so that calls can be chained
|
| 232 |
+
*/
|
| 233 |
+
on<Event extends keyof MessageStreamEvents>(event: Event, listener: MessageStreamEvents[Event]): this {
|
| 234 |
+
const listeners: MessageStreamEventListeners<Event> =
|
| 235 |
+
this.#listeners[event] || (this.#listeners[event] = []);
|
| 236 |
+
listeners.push({ listener });
|
| 237 |
+
return this;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
/**
|
| 241 |
+
* Removes the specified listener from the listener array for the event.
|
| 242 |
+
* off() will remove, at most, one instance of a listener from the listener array. If any single
|
| 243 |
+
* listener has been added multiple times to the listener array for the specified event, then
|
| 244 |
+
* off() must be called multiple times to remove each instance.
|
| 245 |
+
* @returns this MessageStream, so that calls can be chained
|
| 246 |
+
*/
|
| 247 |
+
off<Event extends keyof MessageStreamEvents>(event: Event, listener: MessageStreamEvents[Event]): this {
|
| 248 |
+
const listeners = this.#listeners[event];
|
| 249 |
+
if (!listeners) return this;
|
| 250 |
+
const index = listeners.findIndex((l) => l.listener === listener);
|
| 251 |
+
if (index >= 0) listeners.splice(index, 1);
|
| 252 |
+
return this;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
/**
|
| 256 |
+
* Adds a one-time listener function for the event. The next time the event is triggered,
|
| 257 |
+
* this listener is removed and then invoked.
|
| 258 |
+
* @returns this MessageStream, so that calls can be chained
|
| 259 |
+
*/
|
| 260 |
+
once<Event extends keyof MessageStreamEvents>(event: Event, listener: MessageStreamEvents[Event]): this {
|
| 261 |
+
const listeners: MessageStreamEventListeners<Event> =
|
| 262 |
+
this.#listeners[event] || (this.#listeners[event] = []);
|
| 263 |
+
listeners.push({ listener, once: true });
|
| 264 |
+
return this;
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
/**
|
| 268 |
+
* This is similar to `.once()`, but returns a Promise that resolves the next time
|
| 269 |
+
* the event is triggered, instead of calling a listener callback.
|
| 270 |
+
* @returns a Promise that resolves the next time given event is triggered,
|
| 271 |
+
* or rejects if an error is emitted. (If you request the 'error' event,
|
| 272 |
+
* returns a promise that resolves with the error).
|
| 273 |
+
*
|
| 274 |
+
* Example:
|
| 275 |
+
*
|
| 276 |
+
* const message = await stream.emitted('message') // rejects if the stream errors
|
| 277 |
+
*/
|
| 278 |
+
emitted<Event extends keyof MessageStreamEvents>(
|
| 279 |
+
event: Event,
|
| 280 |
+
): Promise<
|
| 281 |
+
Parameters<MessageStreamEvents[Event]> extends [infer Param] ? Param
|
| 282 |
+
: Parameters<MessageStreamEvents[Event]> extends [] ? void
|
| 283 |
+
: Parameters<MessageStreamEvents[Event]>
|
| 284 |
+
> {
|
| 285 |
+
return new Promise((resolve, reject) => {
|
| 286 |
+
this.#catchingPromiseCreated = true;
|
| 287 |
+
if (event !== 'error') this.once('error', reject);
|
| 288 |
+
this.once(event, resolve as any);
|
| 289 |
+
});
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
async done(): Promise<void> {
|
| 293 |
+
this.#catchingPromiseCreated = true;
|
| 294 |
+
await this.#endPromise;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
get currentMessage(): BetaMessage | undefined {
|
| 298 |
+
return this.#currentMessageSnapshot;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
#getFinalMessage(): BetaMessage {
|
| 302 |
+
if (this.receivedMessages.length === 0) {
|
| 303 |
+
throw new AnthropicError('stream ended without producing a Message with role=assistant');
|
| 304 |
+
}
|
| 305 |
+
return this.receivedMessages.at(-1)!;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
/**
|
| 309 |
+
* @returns a promise that resolves with the the final assistant Message response,
|
| 310 |
+
* or rejects if an error occurred or the stream ended prematurely without producing a Message.
|
| 311 |
+
*/
|
| 312 |
+
async finalMessage(): Promise<BetaMessage> {
|
| 313 |
+
await this.done();
|
| 314 |
+
return this.#getFinalMessage();
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
#getFinalText(): string {
|
| 318 |
+
if (this.receivedMessages.length === 0) {
|
| 319 |
+
throw new AnthropicError('stream ended without producing a Message with role=assistant');
|
| 320 |
+
}
|
| 321 |
+
const textBlocks = this.receivedMessages
|
| 322 |
+
.at(-1)!
|
| 323 |
+
.content.filter((block): block is BetaTextBlock => block.type === 'text')
|
| 324 |
+
.map((block) => block.text);
|
| 325 |
+
if (textBlocks.length === 0) {
|
| 326 |
+
throw new AnthropicError('stream ended without producing a content block with type=text');
|
| 327 |
+
}
|
| 328 |
+
return textBlocks.join(' ');
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
/**
|
| 332 |
+
* @returns a promise that resolves with the the final assistant Message's text response, concatenated
|
| 333 |
+
* together if there are more than one text blocks.
|
| 334 |
+
* Rejects if an error occurred or the stream ended prematurely without producing a Message.
|
| 335 |
+
*/
|
| 336 |
+
async finalText(): Promise<string> {
|
| 337 |
+
await this.done();
|
| 338 |
+
return this.#getFinalText();
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
#handleError = (error: unknown) => {
|
| 342 |
+
this.#errored = true;
|
| 343 |
+
if (isAbortError(error)) {
|
| 344 |
+
error = new APIUserAbortError();
|
| 345 |
+
}
|
| 346 |
+
if (error instanceof APIUserAbortError) {
|
| 347 |
+
this.#aborted = true;
|
| 348 |
+
return this._emit('abort', error);
|
| 349 |
+
}
|
| 350 |
+
if (error instanceof AnthropicError) {
|
| 351 |
+
return this._emit('error', error);
|
| 352 |
+
}
|
| 353 |
+
if (error instanceof Error) {
|
| 354 |
+
const anthropicError: AnthropicError = new AnthropicError(error.message);
|
| 355 |
+
// @ts-ignore
|
| 356 |
+
anthropicError.cause = error;
|
| 357 |
+
return this._emit('error', anthropicError);
|
| 358 |
+
}
|
| 359 |
+
return this._emit('error', new AnthropicError(String(error)));
|
| 360 |
+
};
|
| 361 |
+
|
| 362 |
+
protected _emit<Event extends keyof MessageStreamEvents>(
|
| 363 |
+
event: Event,
|
| 364 |
+
...args: Parameters<MessageStreamEvents[Event]>
|
| 365 |
+
) {
|
| 366 |
+
// make sure we don't emit any MessageStreamEvents after end
|
| 367 |
+
if (this.#ended) return;
|
| 368 |
+
|
| 369 |
+
if (event === 'end') {
|
| 370 |
+
this.#ended = true;
|
| 371 |
+
this.#resolveEndPromise();
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
const listeners: MessageStreamEventListeners<Event> | undefined = this.#listeners[event];
|
| 375 |
+
if (listeners) {
|
| 376 |
+
this.#listeners[event] = listeners.filter((l) => !l.once) as any;
|
| 377 |
+
listeners.forEach(({ listener }: any) => listener(...args));
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
if (event === 'abort') {
|
| 381 |
+
const error = args[0] as APIUserAbortError;
|
| 382 |
+
if (!this.#catchingPromiseCreated && !listeners?.length) {
|
| 383 |
+
Promise.reject(error);
|
| 384 |
+
}
|
| 385 |
+
this.#rejectConnectedPromise(error);
|
| 386 |
+
this.#rejectEndPromise(error);
|
| 387 |
+
this._emit('end');
|
| 388 |
+
return;
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
if (event === 'error') {
|
| 392 |
+
// NOTE: _emit('error', error) should only be called from #handleError().
|
| 393 |
+
|
| 394 |
+
const error = args[0] as AnthropicError;
|
| 395 |
+
if (!this.#catchingPromiseCreated && !listeners?.length) {
|
| 396 |
+
// Trigger an unhandled rejection if the user hasn't registered any error handlers.
|
| 397 |
+
// If you are seeing stack traces here, make sure to handle errors via either:
|
| 398 |
+
// - runner.on('error', () => ...)
|
| 399 |
+
// - await runner.done()
|
| 400 |
+
// - await runner.final...()
|
| 401 |
+
// - etc.
|
| 402 |
+
Promise.reject(error);
|
| 403 |
+
}
|
| 404 |
+
this.#rejectConnectedPromise(error);
|
| 405 |
+
this.#rejectEndPromise(error);
|
| 406 |
+
this._emit('end');
|
| 407 |
+
}
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
protected _emitFinal() {
|
| 411 |
+
const finalMessage = this.receivedMessages.at(-1);
|
| 412 |
+
if (finalMessage) {
|
| 413 |
+
this._emit('finalMessage', this.#getFinalMessage());
|
| 414 |
+
}
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
#beginRequest() {
|
| 418 |
+
if (this.ended) return;
|
| 419 |
+
this.#currentMessageSnapshot = undefined;
|
| 420 |
+
}
|
| 421 |
+
#addStreamEvent(event: BetaMessageStreamEvent) {
|
| 422 |
+
if (this.ended) return;
|
| 423 |
+
const messageSnapshot = this.#accumulateMessage(event);
|
| 424 |
+
this._emit('streamEvent', event, messageSnapshot);
|
| 425 |
+
|
| 426 |
+
switch (event.type) {
|
| 427 |
+
case 'content_block_delta': {
|
| 428 |
+
const content = messageSnapshot.content.at(-1)!;
|
| 429 |
+
switch (event.delta.type) {
|
| 430 |
+
case 'text_delta': {
|
| 431 |
+
if (content.type === 'text') {
|
| 432 |
+
this._emit('text', event.delta.text, content.text || '');
|
| 433 |
+
}
|
| 434 |
+
break;
|
| 435 |
+
}
|
| 436 |
+
case 'citations_delta': {
|
| 437 |
+
if (content.type === 'text') {
|
| 438 |
+
this._emit('citation', event.delta.citation, content.citations ?? []);
|
| 439 |
+
}
|
| 440 |
+
break;
|
| 441 |
+
}
|
| 442 |
+
case 'input_json_delta': {
|
| 443 |
+
if (tracksToolInput(content) && content.input) {
|
| 444 |
+
this._emit('inputJson', event.delta.partial_json, content.input);
|
| 445 |
+
}
|
| 446 |
+
break;
|
| 447 |
+
}
|
| 448 |
+
case 'thinking_delta': {
|
| 449 |
+
if (content.type === 'thinking') {
|
| 450 |
+
this._emit('thinking', event.delta.thinking, content.thinking);
|
| 451 |
+
}
|
| 452 |
+
break;
|
| 453 |
+
}
|
| 454 |
+
case 'signature_delta': {
|
| 455 |
+
if (content.type === 'thinking') {
|
| 456 |
+
this._emit('signature', content.signature);
|
| 457 |
+
}
|
| 458 |
+
break;
|
| 459 |
+
}
|
| 460 |
+
default:
|
| 461 |
+
checkNever(event.delta);
|
| 462 |
+
}
|
| 463 |
+
break;
|
| 464 |
+
}
|
| 465 |
+
case 'message_stop': {
|
| 466 |
+
this._addMessageParam(messageSnapshot);
|
| 467 |
+
this._addMessage(messageSnapshot, true);
|
| 468 |
+
break;
|
| 469 |
+
}
|
| 470 |
+
case 'content_block_stop': {
|
| 471 |
+
this._emit('contentBlock', messageSnapshot.content.at(-1)!);
|
| 472 |
+
break;
|
| 473 |
+
}
|
| 474 |
+
case 'message_start': {
|
| 475 |
+
this.#currentMessageSnapshot = messageSnapshot;
|
| 476 |
+
break;
|
| 477 |
+
}
|
| 478 |
+
case 'content_block_start':
|
| 479 |
+
case 'message_delta':
|
| 480 |
+
break;
|
| 481 |
+
}
|
| 482 |
+
}
|
| 483 |
+
#endRequest(): BetaMessage {
|
| 484 |
+
if (this.ended) {
|
| 485 |
+
throw new AnthropicError(`stream has ended, this shouldn't happen`);
|
| 486 |
+
}
|
| 487 |
+
const snapshot = this.#currentMessageSnapshot;
|
| 488 |
+
if (!snapshot) {
|
| 489 |
+
throw new AnthropicError(`request ended without sending any chunks`);
|
| 490 |
+
}
|
| 491 |
+
this.#currentMessageSnapshot = undefined;
|
| 492 |
+
return snapshot;
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
protected async _fromReadableStream(
|
| 496 |
+
readableStream: ReadableStream,
|
| 497 |
+
options?: RequestOptions,
|
| 498 |
+
): Promise<void> {
|
| 499 |
+
const signal = options?.signal;
|
| 500 |
+
if (signal) {
|
| 501 |
+
if (signal.aborted) this.controller.abort();
|
| 502 |
+
signal.addEventListener('abort', () => this.controller.abort());
|
| 503 |
+
}
|
| 504 |
+
this.#beginRequest();
|
| 505 |
+
this._connected(null);
|
| 506 |
+
const stream = Stream.fromReadableStream<BetaMessageStreamEvent>(readableStream, this.controller);
|
| 507 |
+
for await (const event of stream) {
|
| 508 |
+
this.#addStreamEvent(event);
|
| 509 |
+
}
|
| 510 |
+
if (stream.controller.signal?.aborted) {
|
| 511 |
+
throw new APIUserAbortError();
|
| 512 |
+
}
|
| 513 |
+
this.#endRequest();
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
/**
|
| 517 |
+
* Mutates this.#currentMessage with the current event. Handling the accumulation of multiple messages
|
| 518 |
+
* will be needed to be handled by the caller, this method will throw if you try to accumulate for multiple
|
| 519 |
+
* messages.
|
| 520 |
+
*/
|
| 521 |
+
#accumulateMessage(event: BetaMessageStreamEvent): BetaMessage {
|
| 522 |
+
let snapshot = this.#currentMessageSnapshot;
|
| 523 |
+
|
| 524 |
+
if (event.type === 'message_start') {
|
| 525 |
+
if (snapshot) {
|
| 526 |
+
throw new AnthropicError(`Unexpected event order, got ${event.type} before receiving "message_stop"`);
|
| 527 |
+
}
|
| 528 |
+
return event.message;
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
if (!snapshot) {
|
| 532 |
+
throw new AnthropicError(`Unexpected event order, got ${event.type} before "message_start"`);
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
switch (event.type) {
|
| 536 |
+
case 'message_stop':
|
| 537 |
+
return snapshot;
|
| 538 |
+
case 'message_delta':
|
| 539 |
+
snapshot.container = event.delta.container;
|
| 540 |
+
snapshot.stop_reason = event.delta.stop_reason;
|
| 541 |
+
snapshot.stop_sequence = event.delta.stop_sequence;
|
| 542 |
+
snapshot.usage.output_tokens = event.usage.output_tokens;
|
| 543 |
+
|
| 544 |
+
if (event.usage.input_tokens != null) {
|
| 545 |
+
snapshot.usage.input_tokens = event.usage.input_tokens;
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
if (event.usage.cache_creation_input_tokens != null) {
|
| 549 |
+
snapshot.usage.cache_creation_input_tokens = event.usage.cache_creation_input_tokens;
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
if (event.usage.cache_read_input_tokens != null) {
|
| 553 |
+
snapshot.usage.cache_read_input_tokens = event.usage.cache_read_input_tokens;
|
| 554 |
+
}
|
| 555 |
+
|
| 556 |
+
if (event.usage.server_tool_use != null) {
|
| 557 |
+
snapshot.usage.server_tool_use = event.usage.server_tool_use;
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
return snapshot;
|
| 561 |
+
case 'content_block_start':
|
| 562 |
+
snapshot.content.push(event.content_block);
|
| 563 |
+
return snapshot;
|
| 564 |
+
case 'content_block_delta': {
|
| 565 |
+
const snapshotContent = snapshot.content.at(event.index);
|
| 566 |
+
|
| 567 |
+
switch (event.delta.type) {
|
| 568 |
+
case 'text_delta': {
|
| 569 |
+
if (snapshotContent?.type === 'text') {
|
| 570 |
+
snapshotContent.text += event.delta.text;
|
| 571 |
+
}
|
| 572 |
+
break;
|
| 573 |
+
}
|
| 574 |
+
case 'citations_delta': {
|
| 575 |
+
if (snapshotContent?.type === 'text') {
|
| 576 |
+
snapshotContent.citations ??= [];
|
| 577 |
+
snapshotContent.citations.push(event.delta.citation);
|
| 578 |
+
}
|
| 579 |
+
break;
|
| 580 |
+
}
|
| 581 |
+
case 'input_json_delta': {
|
| 582 |
+
if (snapshotContent && tracksToolInput(snapshotContent)) {
|
| 583 |
+
// we need to keep track of the raw JSON string as well so that we can
|
| 584 |
+
// re-parse it for each delta, for now we just store it as an untyped
|
| 585 |
+
// non-enumerable property on the snapshot
|
| 586 |
+
let jsonBuf = (snapshotContent as any)[JSON_BUF_PROPERTY] || '';
|
| 587 |
+
jsonBuf += event.delta.partial_json;
|
| 588 |
+
|
| 589 |
+
Object.defineProperty(snapshotContent, JSON_BUF_PROPERTY, {
|
| 590 |
+
value: jsonBuf,
|
| 591 |
+
enumerable: false,
|
| 592 |
+
writable: true,
|
| 593 |
+
});
|
| 594 |
+
|
| 595 |
+
if (jsonBuf) {
|
| 596 |
+
try {
|
| 597 |
+
snapshotContent.input = partialParse(jsonBuf);
|
| 598 |
+
} catch (err) {
|
| 599 |
+
const error = new AnthropicError(
|
| 600 |
+
`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${err}. JSON: ${jsonBuf}`,
|
| 601 |
+
);
|
| 602 |
+
this.#handleError(error);
|
| 603 |
+
}
|
| 604 |
+
}
|
| 605 |
+
}
|
| 606 |
+
break;
|
| 607 |
+
}
|
| 608 |
+
case 'thinking_delta': {
|
| 609 |
+
if (snapshotContent?.type === 'thinking') {
|
| 610 |
+
snapshotContent.thinking += event.delta.thinking;
|
| 611 |
+
}
|
| 612 |
+
break;
|
| 613 |
+
}
|
| 614 |
+
case 'signature_delta': {
|
| 615 |
+
if (snapshotContent?.type === 'thinking') {
|
| 616 |
+
snapshotContent.signature = event.delta.signature;
|
| 617 |
+
}
|
| 618 |
+
break;
|
| 619 |
+
}
|
| 620 |
+
default:
|
| 621 |
+
checkNever(event.delta);
|
| 622 |
+
}
|
| 623 |
+
return snapshot;
|
| 624 |
+
}
|
| 625 |
+
case 'content_block_stop':
|
| 626 |
+
return snapshot;
|
| 627 |
+
}
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
[Symbol.asyncIterator](): AsyncIterator<BetaMessageStreamEvent> {
|
| 631 |
+
const pushQueue: BetaMessageStreamEvent[] = [];
|
| 632 |
+
const readQueue: {
|
| 633 |
+
resolve: (chunk: BetaMessageStreamEvent | undefined) => void;
|
| 634 |
+
reject: (error: unknown) => void;
|
| 635 |
+
}[] = [];
|
| 636 |
+
let done = false;
|
| 637 |
+
|
| 638 |
+
this.on('streamEvent', (event) => {
|
| 639 |
+
const reader = readQueue.shift();
|
| 640 |
+
if (reader) {
|
| 641 |
+
reader.resolve(event);
|
| 642 |
+
} else {
|
| 643 |
+
pushQueue.push(event);
|
| 644 |
+
}
|
| 645 |
+
});
|
| 646 |
+
|
| 647 |
+
this.on('end', () => {
|
| 648 |
+
done = true;
|
| 649 |
+
for (const reader of readQueue) {
|
| 650 |
+
reader.resolve(undefined);
|
| 651 |
+
}
|
| 652 |
+
readQueue.length = 0;
|
| 653 |
+
});
|
| 654 |
+
|
| 655 |
+
this.on('abort', (err) => {
|
| 656 |
+
done = true;
|
| 657 |
+
for (const reader of readQueue) {
|
| 658 |
+
reader.reject(err);
|
| 659 |
+
}
|
| 660 |
+
readQueue.length = 0;
|
| 661 |
+
});
|
| 662 |
+
|
| 663 |
+
this.on('error', (err) => {
|
| 664 |
+
done = true;
|
| 665 |
+
for (const reader of readQueue) {
|
| 666 |
+
reader.reject(err);
|
| 667 |
+
}
|
| 668 |
+
readQueue.length = 0;
|
| 669 |
+
});
|
| 670 |
+
|
| 671 |
+
return {
|
| 672 |
+
next: async (): Promise<IteratorResult<BetaMessageStreamEvent>> => {
|
| 673 |
+
if (!pushQueue.length) {
|
| 674 |
+
if (done) {
|
| 675 |
+
return { value: undefined, done: true };
|
| 676 |
+
}
|
| 677 |
+
return new Promise<BetaMessageStreamEvent | undefined>((resolve, reject) =>
|
| 678 |
+
readQueue.push({ resolve, reject }),
|
| 679 |
+
).then((chunk) => (chunk ? { value: chunk, done: false } : { value: undefined, done: true }));
|
| 680 |
+
}
|
| 681 |
+
const chunk = pushQueue.shift()!;
|
| 682 |
+
return { value: chunk, done: false };
|
| 683 |
+
},
|
| 684 |
+
return: async () => {
|
| 685 |
+
this.abort();
|
| 686 |
+
return { value: undefined, done: true };
|
| 687 |
+
},
|
| 688 |
+
};
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
toReadableStream(): ReadableStream {
|
| 692 |
+
const stream = new Stream(this[Symbol.asyncIterator].bind(this), this.controller);
|
| 693 |
+
return stream.toReadableStream();
|
| 694 |
+
}
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
// used to ensure exhaustive case matching without throwing a runtime error
|
| 698 |
+
function checkNever(x: never) {}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/resources/index.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
export * from './shared';
|
| 4 |
+
export {
|
| 5 |
+
Beta,
|
| 6 |
+
type AnthropicBeta,
|
| 7 |
+
type BetaAPIError,
|
| 8 |
+
type BetaAuthenticationError,
|
| 9 |
+
type BetaBillingError,
|
| 10 |
+
type BetaError,
|
| 11 |
+
type BetaErrorResponse,
|
| 12 |
+
type BetaGatewayTimeoutError,
|
| 13 |
+
type BetaInvalidRequestError,
|
| 14 |
+
type BetaNotFoundError,
|
| 15 |
+
type BetaOverloadedError,
|
| 16 |
+
type BetaPermissionError,
|
| 17 |
+
type BetaRateLimitError,
|
| 18 |
+
} from './beta/beta';
|
| 19 |
+
export {
|
| 20 |
+
Completions,
|
| 21 |
+
type Completion,
|
| 22 |
+
type CompletionCreateParams,
|
| 23 |
+
type CompletionCreateParamsNonStreaming,
|
| 24 |
+
type CompletionCreateParamsStreaming,
|
| 25 |
+
} from './completions';
|
| 26 |
+
export {
|
| 27 |
+
Messages,
|
| 28 |
+
type Base64ImageSource,
|
| 29 |
+
type Base64PDFSource,
|
| 30 |
+
type CacheControlEphemeral,
|
| 31 |
+
type CitationCharLocation,
|
| 32 |
+
type CitationCharLocationParam,
|
| 33 |
+
type CitationContentBlockLocation,
|
| 34 |
+
type CitationContentBlockLocationParam,
|
| 35 |
+
type CitationPageLocation,
|
| 36 |
+
type CitationPageLocationParam,
|
| 37 |
+
type CitationWebSearchResultLocationParam,
|
| 38 |
+
type CitationsConfigParam,
|
| 39 |
+
type CitationsDelta,
|
| 40 |
+
type CitationsWebSearchResultLocation,
|
| 41 |
+
type ContentBlock,
|
| 42 |
+
type ContentBlockParam,
|
| 43 |
+
type ContentBlockStartEvent,
|
| 44 |
+
type ContentBlockStopEvent,
|
| 45 |
+
type ContentBlockSource,
|
| 46 |
+
type ContentBlockSourceContent,
|
| 47 |
+
type DocumentBlockParam,
|
| 48 |
+
type ImageBlockParam,
|
| 49 |
+
type InputJSONDelta,
|
| 50 |
+
type Message,
|
| 51 |
+
type MessageCountTokensTool,
|
| 52 |
+
type MessageDeltaEvent,
|
| 53 |
+
type MessageDeltaUsage,
|
| 54 |
+
type MessageParam,
|
| 55 |
+
type MessageStreamParams,
|
| 56 |
+
type MessageTokensCount,
|
| 57 |
+
type Metadata,
|
| 58 |
+
type Model,
|
| 59 |
+
type PlainTextSource,
|
| 60 |
+
type RawContentBlockDelta,
|
| 61 |
+
type RawContentBlockDeltaEvent,
|
| 62 |
+
type RawContentBlockStartEvent,
|
| 63 |
+
type RawContentBlockStopEvent,
|
| 64 |
+
type RawMessageDeltaEvent,
|
| 65 |
+
type RawMessageStartEvent,
|
| 66 |
+
type RawMessageStopEvent,
|
| 67 |
+
type RawMessageStreamEvent,
|
| 68 |
+
type RedactedThinkingBlock,
|
| 69 |
+
type RedactedThinkingBlockParam,
|
| 70 |
+
type ServerToolUsage,
|
| 71 |
+
type ServerToolUseBlock,
|
| 72 |
+
type ServerToolUseBlockParam,
|
| 73 |
+
type SignatureDelta,
|
| 74 |
+
type StopReason,
|
| 75 |
+
type TextBlock,
|
| 76 |
+
type TextBlockParam,
|
| 77 |
+
type TextCitation,
|
| 78 |
+
type TextCitationParam,
|
| 79 |
+
type TextDelta,
|
| 80 |
+
type ThinkingBlock,
|
| 81 |
+
type ThinkingBlockParam,
|
| 82 |
+
type ThinkingConfigDisabled,
|
| 83 |
+
type ThinkingConfigEnabled,
|
| 84 |
+
type ThinkingConfigParam,
|
| 85 |
+
type ThinkingDelta,
|
| 86 |
+
type Tool,
|
| 87 |
+
type ToolBash20250124,
|
| 88 |
+
type ToolChoice,
|
| 89 |
+
type ToolChoiceAny,
|
| 90 |
+
type ToolChoiceAuto,
|
| 91 |
+
type ToolChoiceNone,
|
| 92 |
+
type ToolChoiceTool,
|
| 93 |
+
type ToolResultBlockParam,
|
| 94 |
+
type ToolTextEditor20250124,
|
| 95 |
+
type ToolUnion,
|
| 96 |
+
type ToolUseBlock,
|
| 97 |
+
type ToolUseBlockParam,
|
| 98 |
+
type URLImageSource,
|
| 99 |
+
type URLPDFSource,
|
| 100 |
+
type Usage,
|
| 101 |
+
type WebSearchResultBlock,
|
| 102 |
+
type WebSearchResultBlockParam,
|
| 103 |
+
type WebSearchTool20250305,
|
| 104 |
+
type WebSearchToolRequestError,
|
| 105 |
+
type WebSearchToolResultBlock,
|
| 106 |
+
type WebSearchToolResultBlockContent,
|
| 107 |
+
type WebSearchToolResultBlockParam,
|
| 108 |
+
type WebSearchToolResultBlockParamContent,
|
| 109 |
+
type WebSearchToolResultError,
|
| 110 |
+
type MessageCreateParams,
|
| 111 |
+
type MessageCreateParamsNonStreaming,
|
| 112 |
+
type MessageCreateParamsStreaming,
|
| 113 |
+
type MessageCountTokensParams,
|
| 114 |
+
} from './messages/messages';
|
| 115 |
+
export {
|
| 116 |
+
Models,
|
| 117 |
+
type ModelInfo,
|
| 118 |
+
type ModelRetrieveParams,
|
| 119 |
+
type ModelListParams,
|
| 120 |
+
type ModelInfosPage,
|
| 121 |
+
} from './models';
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts
ADDED
|
@@ -0,0 +1,1831 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
import { APIPromise } from '../../core/api-promise';
|
| 4 |
+
import { APIResource } from '../../core/resource';
|
| 5 |
+
import { Stream } from '../../core/streaming';
|
| 6 |
+
import { RequestOptions } from '../../internal/request-options';
|
| 7 |
+
import { MessageStream } from '../../lib/MessageStream';
|
| 8 |
+
import * as BatchesAPI from './batches';
|
| 9 |
+
import {
|
| 10 |
+
BatchCreateParams,
|
| 11 |
+
BatchListParams,
|
| 12 |
+
Batches,
|
| 13 |
+
DeletedMessageBatch,
|
| 14 |
+
MessageBatch,
|
| 15 |
+
MessageBatchCanceledResult,
|
| 16 |
+
MessageBatchErroredResult,
|
| 17 |
+
MessageBatchExpiredResult,
|
| 18 |
+
MessageBatchIndividualResponse,
|
| 19 |
+
MessageBatchRequestCounts,
|
| 20 |
+
MessageBatchResult,
|
| 21 |
+
MessageBatchSucceededResult,
|
| 22 |
+
MessageBatchesPage,
|
| 23 |
+
} from './batches';
|
| 24 |
+
import * as MessagesAPI from './messages';
|
| 25 |
+
|
| 26 |
+
import { MODEL_NONSTREAMING_TOKENS } from '../../internal/constants';
|
| 27 |
+
|
| 28 |
+
export class Messages extends APIResource {
|
| 29 |
+
batches: BatchesAPI.Batches = new BatchesAPI.Batches(this._client);
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Send a structured list of input messages with text and/or image content, and the
|
| 33 |
+
* model will generate the next message in the conversation.
|
| 34 |
+
*
|
| 35 |
+
* The Messages API can be used for either single queries or stateless multi-turn
|
| 36 |
+
* conversations.
|
| 37 |
+
*
|
| 38 |
+
* Learn more about the Messages API in our [user guide](/en/docs/initial-setup)
|
| 39 |
+
*
|
| 40 |
+
* @example
|
| 41 |
+
* ```ts
|
| 42 |
+
* const message = await client.messages.create({
|
| 43 |
+
* max_tokens: 1024,
|
| 44 |
+
* messages: [{ content: 'Hello, world', role: 'user' }],
|
| 45 |
+
* model: 'claude-3-7-sonnet-20250219',
|
| 46 |
+
* });
|
| 47 |
+
* ```
|
| 48 |
+
*/
|
| 49 |
+
create(body: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
|
| 50 |
+
create(
|
| 51 |
+
body: MessageCreateParamsStreaming,
|
| 52 |
+
options?: RequestOptions,
|
| 53 |
+
): APIPromise<Stream<RawMessageStreamEvent>>;
|
| 54 |
+
create(
|
| 55 |
+
body: MessageCreateParamsBase,
|
| 56 |
+
options?: RequestOptions,
|
| 57 |
+
): APIPromise<Stream<RawMessageStreamEvent> | Message>;
|
| 58 |
+
create(
|
| 59 |
+
body: MessageCreateParams,
|
| 60 |
+
options?: RequestOptions,
|
| 61 |
+
): APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>> {
|
| 62 |
+
if (body.model in DEPRECATED_MODELS) {
|
| 63 |
+
console.warn(
|
| 64 |
+
`The model '${body.model}' is deprecated and will reach end-of-life on ${
|
| 65 |
+
DEPRECATED_MODELS[body.model]
|
| 66 |
+
}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`,
|
| 67 |
+
);
|
| 68 |
+
}
|
| 69 |
+
let timeout = (this._client as any)._options.timeout as number | null;
|
| 70 |
+
if (!body.stream && timeout == null) {
|
| 71 |
+
const maxNonstreamingTokens = MODEL_NONSTREAMING_TOKENS[body.model] ?? undefined;
|
| 72 |
+
timeout = this._client.calculateNonstreamingTimeout(body.max_tokens, maxNonstreamingTokens);
|
| 73 |
+
}
|
| 74 |
+
return this._client.post('/v1/messages', {
|
| 75 |
+
body,
|
| 76 |
+
timeout: timeout ?? 600000,
|
| 77 |
+
...options,
|
| 78 |
+
stream: body.stream ?? false,
|
| 79 |
+
}) as APIPromise<Message> | APIPromise<Stream<RawMessageStreamEvent>>;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* Create a Message stream
|
| 84 |
+
*/
|
| 85 |
+
stream(body: MessageStreamParams, options?: RequestOptions): MessageStream {
|
| 86 |
+
return MessageStream.createMessage(this, body, options);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Count the number of tokens in a Message.
|
| 91 |
+
*
|
| 92 |
+
* The Token Count API can be used to count the number of tokens in a Message,
|
| 93 |
+
* including tools, images, and documents, without creating it.
|
| 94 |
+
*
|
| 95 |
+
* Learn more about token counting in our
|
| 96 |
+
* [user guide](/en/docs/build-with-claude/token-counting)
|
| 97 |
+
*
|
| 98 |
+
* @example
|
| 99 |
+
* ```ts
|
| 100 |
+
* const messageTokensCount =
|
| 101 |
+
* await client.messages.countTokens({
|
| 102 |
+
* messages: [{ content: 'string', role: 'user' }],
|
| 103 |
+
* model: 'claude-3-7-sonnet-latest',
|
| 104 |
+
* });
|
| 105 |
+
* ```
|
| 106 |
+
*/
|
| 107 |
+
countTokens(body: MessageCountTokensParams, options?: RequestOptions): APIPromise<MessageTokensCount> {
|
| 108 |
+
return this._client.post('/v1/messages/count_tokens', { body, ...options });
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
export interface Base64ImageSource {
|
| 113 |
+
data: string;
|
| 114 |
+
|
| 115 |
+
media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp';
|
| 116 |
+
|
| 117 |
+
type: 'base64';
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
export interface Base64PDFSource {
|
| 121 |
+
data: string;
|
| 122 |
+
|
| 123 |
+
media_type: 'application/pdf';
|
| 124 |
+
|
| 125 |
+
type: 'base64';
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
export interface CacheControlEphemeral {
|
| 129 |
+
type: 'ephemeral';
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
export interface CitationCharLocation {
|
| 133 |
+
cited_text: string;
|
| 134 |
+
|
| 135 |
+
document_index: number;
|
| 136 |
+
|
| 137 |
+
document_title: string | null;
|
| 138 |
+
|
| 139 |
+
end_char_index: number;
|
| 140 |
+
|
| 141 |
+
start_char_index: number;
|
| 142 |
+
|
| 143 |
+
type: 'char_location';
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
export interface CitationCharLocationParam {
|
| 147 |
+
cited_text: string;
|
| 148 |
+
|
| 149 |
+
document_index: number;
|
| 150 |
+
|
| 151 |
+
document_title: string | null;
|
| 152 |
+
|
| 153 |
+
end_char_index: number;
|
| 154 |
+
|
| 155 |
+
start_char_index: number;
|
| 156 |
+
|
| 157 |
+
type: 'char_location';
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
export interface CitationContentBlockLocation {
|
| 161 |
+
cited_text: string;
|
| 162 |
+
|
| 163 |
+
document_index: number;
|
| 164 |
+
|
| 165 |
+
document_title: string | null;
|
| 166 |
+
|
| 167 |
+
end_block_index: number;
|
| 168 |
+
|
| 169 |
+
start_block_index: number;
|
| 170 |
+
|
| 171 |
+
type: 'content_block_location';
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
export interface CitationContentBlockLocationParam {
|
| 175 |
+
cited_text: string;
|
| 176 |
+
|
| 177 |
+
document_index: number;
|
| 178 |
+
|
| 179 |
+
document_title: string | null;
|
| 180 |
+
|
| 181 |
+
end_block_index: number;
|
| 182 |
+
|
| 183 |
+
start_block_index: number;
|
| 184 |
+
|
| 185 |
+
type: 'content_block_location';
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
export interface CitationPageLocation {
|
| 189 |
+
cited_text: string;
|
| 190 |
+
|
| 191 |
+
document_index: number;
|
| 192 |
+
|
| 193 |
+
document_title: string | null;
|
| 194 |
+
|
| 195 |
+
end_page_number: number;
|
| 196 |
+
|
| 197 |
+
start_page_number: number;
|
| 198 |
+
|
| 199 |
+
type: 'page_location';
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
export interface CitationPageLocationParam {
|
| 203 |
+
cited_text: string;
|
| 204 |
+
|
| 205 |
+
document_index: number;
|
| 206 |
+
|
| 207 |
+
document_title: string | null;
|
| 208 |
+
|
| 209 |
+
end_page_number: number;
|
| 210 |
+
|
| 211 |
+
start_page_number: number;
|
| 212 |
+
|
| 213 |
+
type: 'page_location';
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
export interface CitationWebSearchResultLocationParam {
|
| 217 |
+
cited_text: string;
|
| 218 |
+
|
| 219 |
+
encrypted_index: string;
|
| 220 |
+
|
| 221 |
+
title: string | null;
|
| 222 |
+
|
| 223 |
+
type: 'web_search_result_location';
|
| 224 |
+
|
| 225 |
+
url: string;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
export interface CitationsConfigParam {
|
| 229 |
+
enabled?: boolean;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
export interface CitationsDelta {
|
| 233 |
+
citation:
|
| 234 |
+
| CitationCharLocation
|
| 235 |
+
| CitationPageLocation
|
| 236 |
+
| CitationContentBlockLocation
|
| 237 |
+
| CitationsWebSearchResultLocation;
|
| 238 |
+
|
| 239 |
+
type: 'citations_delta';
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
export interface CitationsWebSearchResultLocation {
|
| 243 |
+
cited_text: string;
|
| 244 |
+
|
| 245 |
+
encrypted_index: string;
|
| 246 |
+
|
| 247 |
+
title: string | null;
|
| 248 |
+
|
| 249 |
+
type: 'web_search_result_location';
|
| 250 |
+
|
| 251 |
+
url: string;
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
export type ContentBlock =
|
| 255 |
+
| TextBlock
|
| 256 |
+
| ToolUseBlock
|
| 257 |
+
| ServerToolUseBlock
|
| 258 |
+
| WebSearchToolResultBlock
|
| 259 |
+
| ThinkingBlock
|
| 260 |
+
| RedactedThinkingBlock;
|
| 261 |
+
|
| 262 |
+
/**
|
| 263 |
+
* Regular text content.
|
| 264 |
+
*/
|
| 265 |
+
export type ContentBlockParam =
|
| 266 |
+
| ServerToolUseBlockParam
|
| 267 |
+
| WebSearchToolResultBlockParam
|
| 268 |
+
| TextBlockParam
|
| 269 |
+
| ImageBlockParam
|
| 270 |
+
| ToolUseBlockParam
|
| 271 |
+
| ToolResultBlockParam
|
| 272 |
+
| DocumentBlockParam
|
| 273 |
+
| ThinkingBlockParam
|
| 274 |
+
| RedactedThinkingBlockParam;
|
| 275 |
+
|
| 276 |
+
export interface ContentBlockSource {
|
| 277 |
+
content: string | Array<ContentBlockSourceContent>;
|
| 278 |
+
|
| 279 |
+
type: 'content';
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
export type ContentBlockSourceContent = TextBlockParam | ImageBlockParam;
|
| 283 |
+
|
| 284 |
+
export interface DocumentBlockParam {
|
| 285 |
+
source: Base64PDFSource | PlainTextSource | ContentBlockSource | URLPDFSource;
|
| 286 |
+
|
| 287 |
+
type: 'document';
|
| 288 |
+
|
| 289 |
+
/**
|
| 290 |
+
* Create a cache control breakpoint at this content block.
|
| 291 |
+
*/
|
| 292 |
+
cache_control?: CacheControlEphemeral | null;
|
| 293 |
+
|
| 294 |
+
citations?: CitationsConfigParam;
|
| 295 |
+
|
| 296 |
+
context?: string | null;
|
| 297 |
+
|
| 298 |
+
title?: string | null;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
export interface ImageBlockParam {
|
| 302 |
+
source: Base64ImageSource | URLImageSource;
|
| 303 |
+
|
| 304 |
+
type: 'image';
|
| 305 |
+
|
| 306 |
+
/**
|
| 307 |
+
* Create a cache control breakpoint at this content block.
|
| 308 |
+
*/
|
| 309 |
+
cache_control?: CacheControlEphemeral | null;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
export interface InputJSONDelta {
|
| 313 |
+
partial_json: string;
|
| 314 |
+
|
| 315 |
+
type: 'input_json_delta';
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
export interface Message {
|
| 319 |
+
/**
|
| 320 |
+
* Unique object identifier.
|
| 321 |
+
*
|
| 322 |
+
* The format and length of IDs may change over time.
|
| 323 |
+
*/
|
| 324 |
+
id: string;
|
| 325 |
+
|
| 326 |
+
/**
|
| 327 |
+
* Content generated by the model.
|
| 328 |
+
*
|
| 329 |
+
* This is an array of content blocks, each of which has a `type` that determines
|
| 330 |
+
* its shape.
|
| 331 |
+
*
|
| 332 |
+
* Example:
|
| 333 |
+
*
|
| 334 |
+
* ```json
|
| 335 |
+
* [{ "type": "text", "text": "Hi, I'm Claude." }]
|
| 336 |
+
* ```
|
| 337 |
+
*
|
| 338 |
+
* If the request input `messages` ended with an `assistant` turn, then the
|
| 339 |
+
* response `content` will continue directly from that last turn. You can use this
|
| 340 |
+
* to constrain the model's output.
|
| 341 |
+
*
|
| 342 |
+
* For example, if the input `messages` were:
|
| 343 |
+
*
|
| 344 |
+
* ```json
|
| 345 |
+
* [
|
| 346 |
+
* {
|
| 347 |
+
* "role": "user",
|
| 348 |
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
| 349 |
+
* },
|
| 350 |
+
* { "role": "assistant", "content": "The best answer is (" }
|
| 351 |
+
* ]
|
| 352 |
+
* ```
|
| 353 |
+
*
|
| 354 |
+
* Then the response `content` might be:
|
| 355 |
+
*
|
| 356 |
+
* ```json
|
| 357 |
+
* [{ "type": "text", "text": "B)" }]
|
| 358 |
+
* ```
|
| 359 |
+
*/
|
| 360 |
+
content: Array<ContentBlock>;
|
| 361 |
+
|
| 362 |
+
/**
|
| 363 |
+
* The model that will complete your prompt.\n\nSee
|
| 364 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 365 |
+
* details and options.
|
| 366 |
+
*/
|
| 367 |
+
model: Model;
|
| 368 |
+
|
| 369 |
+
/**
|
| 370 |
+
* Conversational role of the generated message.
|
| 371 |
+
*
|
| 372 |
+
* This will always be `"assistant"`.
|
| 373 |
+
*/
|
| 374 |
+
role: 'assistant';
|
| 375 |
+
|
| 376 |
+
/**
|
| 377 |
+
* The reason that we stopped.
|
| 378 |
+
*
|
| 379 |
+
* This may be one the following values:
|
| 380 |
+
*
|
| 381 |
+
* - `"end_turn"`: the model reached a natural stopping point
|
| 382 |
+
* - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum
|
| 383 |
+
* - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated
|
| 384 |
+
* - `"tool_use"`: the model invoked one or more tools
|
| 385 |
+
*
|
| 386 |
+
* In non-streaming mode this value is always non-null. In streaming mode, it is
|
| 387 |
+
* null in the `message_start` event and non-null otherwise.
|
| 388 |
+
*/
|
| 389 |
+
stop_reason: StopReason | null;
|
| 390 |
+
|
| 391 |
+
/**
|
| 392 |
+
* Which custom stop sequence was generated, if any.
|
| 393 |
+
*
|
| 394 |
+
* This value will be a non-null string if one of your custom stop sequences was
|
| 395 |
+
* generated.
|
| 396 |
+
*/
|
| 397 |
+
stop_sequence: string | null;
|
| 398 |
+
|
| 399 |
+
/**
|
| 400 |
+
* Object type.
|
| 401 |
+
*
|
| 402 |
+
* For Messages, this is always `"message"`.
|
| 403 |
+
*/
|
| 404 |
+
type: 'message';
|
| 405 |
+
|
| 406 |
+
/**
|
| 407 |
+
* Billing and rate-limit usage.
|
| 408 |
+
*
|
| 409 |
+
* Anthropic's API bills and rate-limits by token counts, as tokens represent the
|
| 410 |
+
* underlying cost to our systems.
|
| 411 |
+
*
|
| 412 |
+
* Under the hood, the API transforms requests into a format suitable for the
|
| 413 |
+
* model. The model's output then goes through a parsing stage before becoming an
|
| 414 |
+
* API response. As a result, the token counts in `usage` will not match one-to-one
|
| 415 |
+
* with the exact visible content of an API request or response.
|
| 416 |
+
*
|
| 417 |
+
* For example, `output_tokens` will be non-zero, even for an empty string response
|
| 418 |
+
* from Claude.
|
| 419 |
+
*
|
| 420 |
+
* Total input tokens in a request is the summation of `input_tokens`,
|
| 421 |
+
* `cache_creation_input_tokens`, and `cache_read_input_tokens`.
|
| 422 |
+
*/
|
| 423 |
+
usage: Usage;
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
export type MessageCountTokensTool =
|
| 427 |
+
| Tool
|
| 428 |
+
| ToolBash20250124
|
| 429 |
+
| ToolTextEditor20250124
|
| 430 |
+
| MessageCountTokensTool.TextEditor20250429
|
| 431 |
+
| WebSearchTool20250305;
|
| 432 |
+
|
| 433 |
+
export namespace MessageCountTokensTool {
|
| 434 |
+
export interface TextEditor20250429 {
|
| 435 |
+
/**
|
| 436 |
+
* Name of the tool.
|
| 437 |
+
*
|
| 438 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 439 |
+
*/
|
| 440 |
+
name: 'str_replace_based_edit_tool';
|
| 441 |
+
|
| 442 |
+
type: 'text_editor_20250429';
|
| 443 |
+
|
| 444 |
+
/**
|
| 445 |
+
* Create a cache control breakpoint at this content block.
|
| 446 |
+
*/
|
| 447 |
+
cache_control?: MessagesAPI.CacheControlEphemeral | null;
|
| 448 |
+
}
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
export interface MessageDeltaUsage {
|
| 452 |
+
/**
|
| 453 |
+
* The cumulative number of input tokens used to create the cache entry.
|
| 454 |
+
*/
|
| 455 |
+
cache_creation_input_tokens: number | null;
|
| 456 |
+
|
| 457 |
+
/**
|
| 458 |
+
* The cumulative number of input tokens read from the cache.
|
| 459 |
+
*/
|
| 460 |
+
cache_read_input_tokens: number | null;
|
| 461 |
+
|
| 462 |
+
/**
|
| 463 |
+
* The cumulative number of input tokens which were used.
|
| 464 |
+
*/
|
| 465 |
+
input_tokens: number | null;
|
| 466 |
+
|
| 467 |
+
/**
|
| 468 |
+
* The cumulative number of output tokens which were used.
|
| 469 |
+
*/
|
| 470 |
+
output_tokens: number;
|
| 471 |
+
|
| 472 |
+
/**
|
| 473 |
+
* The number of server tool requests.
|
| 474 |
+
*/
|
| 475 |
+
server_tool_use: ServerToolUsage | null;
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
export interface MessageParam {
|
| 479 |
+
content: string | Array<ContentBlockParam>;
|
| 480 |
+
|
| 481 |
+
role: 'user' | 'assistant';
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
export interface MessageTokensCount {
|
| 485 |
+
/**
|
| 486 |
+
* The total number of tokens across the provided list of messages, system prompt,
|
| 487 |
+
* and tools.
|
| 488 |
+
*/
|
| 489 |
+
input_tokens: number;
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
export interface Metadata {
|
| 493 |
+
/**
|
| 494 |
+
* An external identifier for the user who is associated with the request.
|
| 495 |
+
*
|
| 496 |
+
* This should be a uuid, hash value, or other opaque identifier. Anthropic may use
|
| 497 |
+
* this id to help detect abuse. Do not include any identifying information such as
|
| 498 |
+
* name, email address, or phone number.
|
| 499 |
+
*/
|
| 500 |
+
user_id?: string | null;
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
/**
|
| 504 |
+
* The model that will complete your prompt.\n\nSee
|
| 505 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 506 |
+
* details and options.
|
| 507 |
+
*/
|
| 508 |
+
export type Model =
|
| 509 |
+
| 'claude-3-7-sonnet-latest'
|
| 510 |
+
| 'claude-3-7-sonnet-20250219'
|
| 511 |
+
| 'claude-3-5-haiku-latest'
|
| 512 |
+
| 'claude-3-5-haiku-20241022'
|
| 513 |
+
| 'claude-sonnet-4-20250514'
|
| 514 |
+
| 'claude-sonnet-4-0'
|
| 515 |
+
| 'claude-4-sonnet-20250514'
|
| 516 |
+
| 'claude-3-5-sonnet-latest'
|
| 517 |
+
| 'claude-3-5-sonnet-20241022'
|
| 518 |
+
| 'claude-3-5-sonnet-20240620'
|
| 519 |
+
| 'claude-opus-4-0'
|
| 520 |
+
| 'claude-opus-4-20250514'
|
| 521 |
+
| 'claude-4-opus-20250514'
|
| 522 |
+
| 'claude-3-opus-latest'
|
| 523 |
+
| 'claude-3-opus-20240229'
|
| 524 |
+
| 'claude-3-sonnet-20240229'
|
| 525 |
+
| 'claude-3-haiku-20240307'
|
| 526 |
+
| 'claude-2.1'
|
| 527 |
+
| 'claude-2.0'
|
| 528 |
+
| (string & {});
|
| 529 |
+
|
| 530 |
+
const DEPRECATED_MODELS: {
|
| 531 |
+
[K in Model]?: string;
|
| 532 |
+
} = {
|
| 533 |
+
'claude-1.3': 'November 6th, 2024',
|
| 534 |
+
'claude-1.3-100k': 'November 6th, 2024',
|
| 535 |
+
'claude-instant-1.1': 'November 6th, 2024',
|
| 536 |
+
'claude-instant-1.1-100k': 'November 6th, 2024',
|
| 537 |
+
'claude-instant-1.2': 'November 6th, 2024',
|
| 538 |
+
'claude-3-sonnet-20240229': 'July 21st, 2025',
|
| 539 |
+
'claude-2.1': 'July 21st, 2025',
|
| 540 |
+
'claude-2.0': 'July 21st, 2025',
|
| 541 |
+
};
|
| 542 |
+
|
| 543 |
+
export interface PlainTextSource {
|
| 544 |
+
data: string;
|
| 545 |
+
|
| 546 |
+
media_type: 'text/plain';
|
| 547 |
+
|
| 548 |
+
type: 'text';
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
export type RawContentBlockDelta =
|
| 552 |
+
| TextDelta
|
| 553 |
+
| InputJSONDelta
|
| 554 |
+
| CitationsDelta
|
| 555 |
+
| ThinkingDelta
|
| 556 |
+
| SignatureDelta;
|
| 557 |
+
|
| 558 |
+
export interface RawContentBlockDeltaEvent {
|
| 559 |
+
delta: RawContentBlockDelta;
|
| 560 |
+
|
| 561 |
+
index: number;
|
| 562 |
+
|
| 563 |
+
type: 'content_block_delta';
|
| 564 |
+
}
|
| 565 |
+
|
| 566 |
+
export interface RawContentBlockStartEvent {
|
| 567 |
+
content_block:
|
| 568 |
+
| TextBlock
|
| 569 |
+
| ToolUseBlock
|
| 570 |
+
| ServerToolUseBlock
|
| 571 |
+
| WebSearchToolResultBlock
|
| 572 |
+
| ThinkingBlock
|
| 573 |
+
| RedactedThinkingBlock;
|
| 574 |
+
|
| 575 |
+
index: number;
|
| 576 |
+
|
| 577 |
+
type: 'content_block_start';
|
| 578 |
+
}
|
| 579 |
+
|
| 580 |
+
export interface RawContentBlockStopEvent {
|
| 581 |
+
index: number;
|
| 582 |
+
|
| 583 |
+
type: 'content_block_stop';
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
export interface RawMessageDeltaEvent {
|
| 587 |
+
delta: RawMessageDeltaEvent.Delta;
|
| 588 |
+
|
| 589 |
+
type: 'message_delta';
|
| 590 |
+
|
| 591 |
+
/**
|
| 592 |
+
* Billing and rate-limit usage.
|
| 593 |
+
*
|
| 594 |
+
* Anthropic's API bills and rate-limits by token counts, as tokens represent the
|
| 595 |
+
* underlying cost to our systems.
|
| 596 |
+
*
|
| 597 |
+
* Under the hood, the API transforms requests into a format suitable for the
|
| 598 |
+
* model. The model's output then goes through a parsing stage before becoming an
|
| 599 |
+
* API response. As a result, the token counts in `usage` will not match one-to-one
|
| 600 |
+
* with the exact visible content of an API request or response.
|
| 601 |
+
*
|
| 602 |
+
* For example, `output_tokens` will be non-zero, even for an empty string response
|
| 603 |
+
* from Claude.
|
| 604 |
+
*
|
| 605 |
+
* Total input tokens in a request is the summation of `input_tokens`,
|
| 606 |
+
* `cache_creation_input_tokens`, and `cache_read_input_tokens`.
|
| 607 |
+
*/
|
| 608 |
+
usage: MessageDeltaUsage;
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
+
export namespace RawMessageDeltaEvent {
|
| 612 |
+
export interface Delta {
|
| 613 |
+
stop_reason: MessagesAPI.StopReason | null;
|
| 614 |
+
|
| 615 |
+
stop_sequence: string | null;
|
| 616 |
+
}
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
export interface RawMessageStartEvent {
|
| 620 |
+
message: Message;
|
| 621 |
+
|
| 622 |
+
type: 'message_start';
|
| 623 |
+
}
|
| 624 |
+
|
| 625 |
+
export interface RawMessageStopEvent {
|
| 626 |
+
type: 'message_stop';
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
export type RawMessageStreamEvent =
|
| 630 |
+
| RawMessageStartEvent
|
| 631 |
+
| RawMessageDeltaEvent
|
| 632 |
+
| RawMessageStopEvent
|
| 633 |
+
| RawContentBlockStartEvent
|
| 634 |
+
| RawContentBlockDeltaEvent
|
| 635 |
+
| RawContentBlockStopEvent;
|
| 636 |
+
|
| 637 |
+
export interface RedactedThinkingBlock {
|
| 638 |
+
data: string;
|
| 639 |
+
|
| 640 |
+
type: 'redacted_thinking';
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
export interface RedactedThinkingBlockParam {
|
| 644 |
+
data: string;
|
| 645 |
+
|
| 646 |
+
type: 'redacted_thinking';
|
| 647 |
+
}
|
| 648 |
+
|
| 649 |
+
export interface ServerToolUsage {
|
| 650 |
+
/**
|
| 651 |
+
* The number of web search tool requests.
|
| 652 |
+
*/
|
| 653 |
+
web_search_requests: number;
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
export interface ServerToolUseBlock {
|
| 657 |
+
id: string;
|
| 658 |
+
|
| 659 |
+
input: unknown;
|
| 660 |
+
|
| 661 |
+
name: 'web_search';
|
| 662 |
+
|
| 663 |
+
type: 'server_tool_use';
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
export interface ServerToolUseBlockParam {
|
| 667 |
+
id: string;
|
| 668 |
+
|
| 669 |
+
input: unknown;
|
| 670 |
+
|
| 671 |
+
name: 'web_search';
|
| 672 |
+
|
| 673 |
+
type: 'server_tool_use';
|
| 674 |
+
|
| 675 |
+
/**
|
| 676 |
+
* Create a cache control breakpoint at this content block.
|
| 677 |
+
*/
|
| 678 |
+
cache_control?: CacheControlEphemeral | null;
|
| 679 |
+
}
|
| 680 |
+
|
| 681 |
+
export interface SignatureDelta {
|
| 682 |
+
signature: string;
|
| 683 |
+
|
| 684 |
+
type: 'signature_delta';
|
| 685 |
+
}
|
| 686 |
+
|
| 687 |
+
export type StopReason = 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'pause_turn' | 'refusal';
|
| 688 |
+
|
| 689 |
+
export interface TextBlock {
|
| 690 |
+
/**
|
| 691 |
+
* Citations supporting the text block.
|
| 692 |
+
*
|
| 693 |
+
* The type of citation returned will depend on the type of document being cited.
|
| 694 |
+
* Citing a PDF results in `page_location`, plain text results in `char_location`,
|
| 695 |
+
* and content document results in `content_block_location`.
|
| 696 |
+
*/
|
| 697 |
+
citations: Array<TextCitation> | null;
|
| 698 |
+
|
| 699 |
+
text: string;
|
| 700 |
+
|
| 701 |
+
type: 'text';
|
| 702 |
+
}
|
| 703 |
+
|
| 704 |
+
export interface TextBlockParam {
|
| 705 |
+
text: string;
|
| 706 |
+
|
| 707 |
+
type: 'text';
|
| 708 |
+
|
| 709 |
+
/**
|
| 710 |
+
* Create a cache control breakpoint at this content block.
|
| 711 |
+
*/
|
| 712 |
+
cache_control?: CacheControlEphemeral | null;
|
| 713 |
+
|
| 714 |
+
citations?: Array<TextCitationParam> | null;
|
| 715 |
+
}
|
| 716 |
+
|
| 717 |
+
export type TextCitation =
|
| 718 |
+
| CitationCharLocation
|
| 719 |
+
| CitationPageLocation
|
| 720 |
+
| CitationContentBlockLocation
|
| 721 |
+
| CitationsWebSearchResultLocation;
|
| 722 |
+
|
| 723 |
+
export type TextCitationParam =
|
| 724 |
+
| CitationCharLocationParam
|
| 725 |
+
| CitationPageLocationParam
|
| 726 |
+
| CitationContentBlockLocationParam
|
| 727 |
+
| CitationWebSearchResultLocationParam;
|
| 728 |
+
|
| 729 |
+
export interface TextDelta {
|
| 730 |
+
text: string;
|
| 731 |
+
|
| 732 |
+
type: 'text_delta';
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
export interface ThinkingBlock {
|
| 736 |
+
signature: string;
|
| 737 |
+
|
| 738 |
+
thinking: string;
|
| 739 |
+
|
| 740 |
+
type: 'thinking';
|
| 741 |
+
}
|
| 742 |
+
|
| 743 |
+
export interface ThinkingBlockParam {
|
| 744 |
+
signature: string;
|
| 745 |
+
|
| 746 |
+
thinking: string;
|
| 747 |
+
|
| 748 |
+
type: 'thinking';
|
| 749 |
+
}
|
| 750 |
+
|
| 751 |
+
export interface ThinkingConfigDisabled {
|
| 752 |
+
type: 'disabled';
|
| 753 |
+
}
|
| 754 |
+
|
| 755 |
+
export interface ThinkingConfigEnabled {
|
| 756 |
+
/**
|
| 757 |
+
* Determines how many tokens Claude can use for its internal reasoning process.
|
| 758 |
+
* Larger budgets can enable more thorough analysis for complex problems, improving
|
| 759 |
+
* response quality.
|
| 760 |
+
*
|
| 761 |
+
* Must be ≥1024 and less than `max_tokens`.
|
| 762 |
+
*
|
| 763 |
+
* See
|
| 764 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 765 |
+
* for details.
|
| 766 |
+
*/
|
| 767 |
+
budget_tokens: number;
|
| 768 |
+
|
| 769 |
+
type: 'enabled';
|
| 770 |
+
}
|
| 771 |
+
|
| 772 |
+
/**
|
| 773 |
+
* Configuration for enabling Claude's extended thinking.
|
| 774 |
+
*
|
| 775 |
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
| 776 |
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
| 777 |
+
* tokens and counts towards your `max_tokens` limit.
|
| 778 |
+
*
|
| 779 |
+
* See
|
| 780 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 781 |
+
* for details.
|
| 782 |
+
*/
|
| 783 |
+
export type ThinkingConfigParam = ThinkingConfigEnabled | ThinkingConfigDisabled;
|
| 784 |
+
|
| 785 |
+
export interface ThinkingDelta {
|
| 786 |
+
thinking: string;
|
| 787 |
+
|
| 788 |
+
type: 'thinking_delta';
|
| 789 |
+
}
|
| 790 |
+
|
| 791 |
+
export interface Tool {
|
| 792 |
+
/**
|
| 793 |
+
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
| 794 |
+
*
|
| 795 |
+
* This defines the shape of the `input` that your tool accepts and that the model
|
| 796 |
+
* will produce.
|
| 797 |
+
*/
|
| 798 |
+
input_schema: Tool.InputSchema;
|
| 799 |
+
|
| 800 |
+
/**
|
| 801 |
+
* Name of the tool.
|
| 802 |
+
*
|
| 803 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 804 |
+
*/
|
| 805 |
+
name: string;
|
| 806 |
+
|
| 807 |
+
/**
|
| 808 |
+
* Create a cache control breakpoint at this content block.
|
| 809 |
+
*/
|
| 810 |
+
cache_control?: CacheControlEphemeral | null;
|
| 811 |
+
|
| 812 |
+
/**
|
| 813 |
+
* Description of what this tool does.
|
| 814 |
+
*
|
| 815 |
+
* Tool descriptions should be as detailed as possible. The more information that
|
| 816 |
+
* the model has about what the tool is and how to use it, the better it will
|
| 817 |
+
* perform. You can use natural language descriptions to reinforce important
|
| 818 |
+
* aspects of the tool input JSON schema.
|
| 819 |
+
*/
|
| 820 |
+
description?: string;
|
| 821 |
+
|
| 822 |
+
type?: 'custom' | null;
|
| 823 |
+
}
|
| 824 |
+
|
| 825 |
+
export namespace Tool {
|
| 826 |
+
/**
|
| 827 |
+
* [JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.
|
| 828 |
+
*
|
| 829 |
+
* This defines the shape of the `input` that your tool accepts and that the model
|
| 830 |
+
* will produce.
|
| 831 |
+
*/
|
| 832 |
+
export interface InputSchema {
|
| 833 |
+
type: 'object';
|
| 834 |
+
|
| 835 |
+
properties?: unknown | null;
|
| 836 |
+
|
| 837 |
+
required?: Array<string> | null;
|
| 838 |
+
|
| 839 |
+
[k: string]: unknown;
|
| 840 |
+
}
|
| 841 |
+
}
|
| 842 |
+
|
| 843 |
+
export interface ToolBash20250124 {
|
| 844 |
+
/**
|
| 845 |
+
* Name of the tool.
|
| 846 |
+
*
|
| 847 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 848 |
+
*/
|
| 849 |
+
name: 'bash';
|
| 850 |
+
|
| 851 |
+
type: 'bash_20250124';
|
| 852 |
+
|
| 853 |
+
/**
|
| 854 |
+
* Create a cache control breakpoint at this content block.
|
| 855 |
+
*/
|
| 856 |
+
cache_control?: CacheControlEphemeral | null;
|
| 857 |
+
}
|
| 858 |
+
|
| 859 |
+
/**
|
| 860 |
+
* How the model should use the provided tools. The model can use a specific tool,
|
| 861 |
+
* any available tool, decide by itself, or not use tools at all.
|
| 862 |
+
*/
|
| 863 |
+
export type ToolChoice = ToolChoiceAuto | ToolChoiceAny | ToolChoiceTool | ToolChoiceNone;
|
| 864 |
+
|
| 865 |
+
/**
|
| 866 |
+
* The model will use any available tools.
|
| 867 |
+
*/
|
| 868 |
+
export interface ToolChoiceAny {
|
| 869 |
+
type: 'any';
|
| 870 |
+
|
| 871 |
+
/**
|
| 872 |
+
* Whether to disable parallel tool use.
|
| 873 |
+
*
|
| 874 |
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
|
| 875 |
+
* use.
|
| 876 |
+
*/
|
| 877 |
+
disable_parallel_tool_use?: boolean;
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
/**
|
| 881 |
+
* The model will automatically decide whether to use tools.
|
| 882 |
+
*/
|
| 883 |
+
export interface ToolChoiceAuto {
|
| 884 |
+
type: 'auto';
|
| 885 |
+
|
| 886 |
+
/**
|
| 887 |
+
* Whether to disable parallel tool use.
|
| 888 |
+
*
|
| 889 |
+
* Defaults to `false`. If set to `true`, the model will output at most one tool
|
| 890 |
+
* use.
|
| 891 |
+
*/
|
| 892 |
+
disable_parallel_tool_use?: boolean;
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
/**
|
| 896 |
+
* The model will not be allowed to use tools.
|
| 897 |
+
*/
|
| 898 |
+
export interface ToolChoiceNone {
|
| 899 |
+
type: 'none';
|
| 900 |
+
}
|
| 901 |
+
|
| 902 |
+
/**
|
| 903 |
+
* The model will use the specified tool with `tool_choice.name`.
|
| 904 |
+
*/
|
| 905 |
+
export interface ToolChoiceTool {
|
| 906 |
+
/**
|
| 907 |
+
* The name of the tool to use.
|
| 908 |
+
*/
|
| 909 |
+
name: string;
|
| 910 |
+
|
| 911 |
+
type: 'tool';
|
| 912 |
+
|
| 913 |
+
/**
|
| 914 |
+
* Whether to disable parallel tool use.
|
| 915 |
+
*
|
| 916 |
+
* Defaults to `false`. If set to `true`, the model will output exactly one tool
|
| 917 |
+
* use.
|
| 918 |
+
*/
|
| 919 |
+
disable_parallel_tool_use?: boolean;
|
| 920 |
+
}
|
| 921 |
+
|
| 922 |
+
export interface ToolResultBlockParam {
|
| 923 |
+
tool_use_id: string;
|
| 924 |
+
|
| 925 |
+
type: 'tool_result';
|
| 926 |
+
|
| 927 |
+
/**
|
| 928 |
+
* Create a cache control breakpoint at this content block.
|
| 929 |
+
*/
|
| 930 |
+
cache_control?: CacheControlEphemeral | null;
|
| 931 |
+
|
| 932 |
+
content?: string | Array<TextBlockParam | ImageBlockParam>;
|
| 933 |
+
|
| 934 |
+
is_error?: boolean;
|
| 935 |
+
}
|
| 936 |
+
|
| 937 |
+
export interface ToolTextEditor20250124 {
|
| 938 |
+
/**
|
| 939 |
+
* Name of the tool.
|
| 940 |
+
*
|
| 941 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 942 |
+
*/
|
| 943 |
+
name: 'str_replace_editor';
|
| 944 |
+
|
| 945 |
+
type: 'text_editor_20250124';
|
| 946 |
+
|
| 947 |
+
/**
|
| 948 |
+
* Create a cache control breakpoint at this content block.
|
| 949 |
+
*/
|
| 950 |
+
cache_control?: CacheControlEphemeral | null;
|
| 951 |
+
}
|
| 952 |
+
|
| 953 |
+
export type ToolUnion =
|
| 954 |
+
| Tool
|
| 955 |
+
| ToolBash20250124
|
| 956 |
+
| ToolTextEditor20250124
|
| 957 |
+
| ToolUnion.TextEditor20250429
|
| 958 |
+
| WebSearchTool20250305;
|
| 959 |
+
|
| 960 |
+
export namespace ToolUnion {
|
| 961 |
+
export interface TextEditor20250429 {
|
| 962 |
+
/**
|
| 963 |
+
* Name of the tool.
|
| 964 |
+
*
|
| 965 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 966 |
+
*/
|
| 967 |
+
name: 'str_replace_based_edit_tool';
|
| 968 |
+
|
| 969 |
+
type: 'text_editor_20250429';
|
| 970 |
+
|
| 971 |
+
/**
|
| 972 |
+
* Create a cache control breakpoint at this content block.
|
| 973 |
+
*/
|
| 974 |
+
cache_control?: MessagesAPI.CacheControlEphemeral | null;
|
| 975 |
+
}
|
| 976 |
+
}
|
| 977 |
+
|
| 978 |
+
export interface ToolUseBlock {
|
| 979 |
+
id: string;
|
| 980 |
+
|
| 981 |
+
input: unknown;
|
| 982 |
+
|
| 983 |
+
name: string;
|
| 984 |
+
|
| 985 |
+
type: 'tool_use';
|
| 986 |
+
}
|
| 987 |
+
|
| 988 |
+
export interface ToolUseBlockParam {
|
| 989 |
+
id: string;
|
| 990 |
+
|
| 991 |
+
input: unknown;
|
| 992 |
+
|
| 993 |
+
name: string;
|
| 994 |
+
|
| 995 |
+
type: 'tool_use';
|
| 996 |
+
|
| 997 |
+
/**
|
| 998 |
+
* Create a cache control breakpoint at this content block.
|
| 999 |
+
*/
|
| 1000 |
+
cache_control?: CacheControlEphemeral | null;
|
| 1001 |
+
}
|
| 1002 |
+
|
| 1003 |
+
export interface URLImageSource {
|
| 1004 |
+
type: 'url';
|
| 1005 |
+
|
| 1006 |
+
url: string;
|
| 1007 |
+
}
|
| 1008 |
+
|
| 1009 |
+
export interface URLPDFSource {
|
| 1010 |
+
type: 'url';
|
| 1011 |
+
|
| 1012 |
+
url: string;
|
| 1013 |
+
}
|
| 1014 |
+
|
| 1015 |
+
export interface Usage {
|
| 1016 |
+
/**
|
| 1017 |
+
* The number of input tokens used to create the cache entry.
|
| 1018 |
+
*/
|
| 1019 |
+
cache_creation_input_tokens: number | null;
|
| 1020 |
+
|
| 1021 |
+
/**
|
| 1022 |
+
* The number of input tokens read from the cache.
|
| 1023 |
+
*/
|
| 1024 |
+
cache_read_input_tokens: number | null;
|
| 1025 |
+
|
| 1026 |
+
/**
|
| 1027 |
+
* The number of input tokens which were used.
|
| 1028 |
+
*/
|
| 1029 |
+
input_tokens: number;
|
| 1030 |
+
|
| 1031 |
+
/**
|
| 1032 |
+
* The number of output tokens which were used.
|
| 1033 |
+
*/
|
| 1034 |
+
output_tokens: number;
|
| 1035 |
+
|
| 1036 |
+
/**
|
| 1037 |
+
* The number of server tool requests.
|
| 1038 |
+
*/
|
| 1039 |
+
server_tool_use: ServerToolUsage | null;
|
| 1040 |
+
|
| 1041 |
+
/**
|
| 1042 |
+
* If the request used the priority, standard, or batch tier.
|
| 1043 |
+
*/
|
| 1044 |
+
service_tier: 'standard' | 'priority' | 'batch' | null;
|
| 1045 |
+
}
|
| 1046 |
+
|
| 1047 |
+
export interface WebSearchResultBlock {
|
| 1048 |
+
encrypted_content: string;
|
| 1049 |
+
|
| 1050 |
+
page_age: string | null;
|
| 1051 |
+
|
| 1052 |
+
title: string;
|
| 1053 |
+
|
| 1054 |
+
type: 'web_search_result';
|
| 1055 |
+
|
| 1056 |
+
url: string;
|
| 1057 |
+
}
|
| 1058 |
+
|
| 1059 |
+
export interface WebSearchResultBlockParam {
|
| 1060 |
+
encrypted_content: string;
|
| 1061 |
+
|
| 1062 |
+
title: string;
|
| 1063 |
+
|
| 1064 |
+
type: 'web_search_result';
|
| 1065 |
+
|
| 1066 |
+
url: string;
|
| 1067 |
+
|
| 1068 |
+
page_age?: string | null;
|
| 1069 |
+
}
|
| 1070 |
+
|
| 1071 |
+
export interface WebSearchTool20250305 {
|
| 1072 |
+
/**
|
| 1073 |
+
* Name of the tool.
|
| 1074 |
+
*
|
| 1075 |
+
* This is how the tool will be called by the model and in `tool_use` blocks.
|
| 1076 |
+
*/
|
| 1077 |
+
name: 'web_search';
|
| 1078 |
+
|
| 1079 |
+
type: 'web_search_20250305';
|
| 1080 |
+
|
| 1081 |
+
/**
|
| 1082 |
+
* If provided, only these domains will be included in results. Cannot be used
|
| 1083 |
+
* alongside `blocked_domains`.
|
| 1084 |
+
*/
|
| 1085 |
+
allowed_domains?: Array<string> | null;
|
| 1086 |
+
|
| 1087 |
+
/**
|
| 1088 |
+
* If provided, these domains will never appear in results. Cannot be used
|
| 1089 |
+
* alongside `allowed_domains`.
|
| 1090 |
+
*/
|
| 1091 |
+
blocked_domains?: Array<string> | null;
|
| 1092 |
+
|
| 1093 |
+
/**
|
| 1094 |
+
* Create a cache control breakpoint at this content block.
|
| 1095 |
+
*/
|
| 1096 |
+
cache_control?: CacheControlEphemeral | null;
|
| 1097 |
+
|
| 1098 |
+
/**
|
| 1099 |
+
* Maximum number of times the tool can be used in the API request.
|
| 1100 |
+
*/
|
| 1101 |
+
max_uses?: number | null;
|
| 1102 |
+
|
| 1103 |
+
/**
|
| 1104 |
+
* Parameters for the user's location. Used to provide more relevant search
|
| 1105 |
+
* results.
|
| 1106 |
+
*/
|
| 1107 |
+
user_location?: WebSearchTool20250305.UserLocation | null;
|
| 1108 |
+
}
|
| 1109 |
+
|
| 1110 |
+
export namespace WebSearchTool20250305 {
|
| 1111 |
+
/**
|
| 1112 |
+
* Parameters for the user's location. Used to provide more relevant search
|
| 1113 |
+
* results.
|
| 1114 |
+
*/
|
| 1115 |
+
export interface UserLocation {
|
| 1116 |
+
type: 'approximate';
|
| 1117 |
+
|
| 1118 |
+
/**
|
| 1119 |
+
* The city of the user.
|
| 1120 |
+
*/
|
| 1121 |
+
city?: string | null;
|
| 1122 |
+
|
| 1123 |
+
/**
|
| 1124 |
+
* The two letter
|
| 1125 |
+
* [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the
|
| 1126 |
+
* user.
|
| 1127 |
+
*/
|
| 1128 |
+
country?: string | null;
|
| 1129 |
+
|
| 1130 |
+
/**
|
| 1131 |
+
* The region of the user.
|
| 1132 |
+
*/
|
| 1133 |
+
region?: string | null;
|
| 1134 |
+
|
| 1135 |
+
/**
|
| 1136 |
+
* The [IANA timezone](https://nodatime.org/TimeZones) of the user.
|
| 1137 |
+
*/
|
| 1138 |
+
timezone?: string | null;
|
| 1139 |
+
}
|
| 1140 |
+
}
|
| 1141 |
+
|
| 1142 |
+
export interface WebSearchToolRequestError {
|
| 1143 |
+
error_code:
|
| 1144 |
+
| 'invalid_tool_input'
|
| 1145 |
+
| 'unavailable'
|
| 1146 |
+
| 'max_uses_exceeded'
|
| 1147 |
+
| 'too_many_requests'
|
| 1148 |
+
| 'query_too_long';
|
| 1149 |
+
|
| 1150 |
+
type: 'web_search_tool_result_error';
|
| 1151 |
+
}
|
| 1152 |
+
|
| 1153 |
+
export interface WebSearchToolResultBlock {
|
| 1154 |
+
content: WebSearchToolResultBlockContent;
|
| 1155 |
+
|
| 1156 |
+
tool_use_id: string;
|
| 1157 |
+
|
| 1158 |
+
type: 'web_search_tool_result';
|
| 1159 |
+
}
|
| 1160 |
+
|
| 1161 |
+
export type WebSearchToolResultBlockContent = WebSearchToolResultError | Array<WebSearchResultBlock>;
|
| 1162 |
+
|
| 1163 |
+
export interface WebSearchToolResultBlockParam {
|
| 1164 |
+
content: WebSearchToolResultBlockParamContent;
|
| 1165 |
+
|
| 1166 |
+
tool_use_id: string;
|
| 1167 |
+
|
| 1168 |
+
type: 'web_search_tool_result';
|
| 1169 |
+
|
| 1170 |
+
/**
|
| 1171 |
+
* Create a cache control breakpoint at this content block.
|
| 1172 |
+
*/
|
| 1173 |
+
cache_control?: CacheControlEphemeral | null;
|
| 1174 |
+
}
|
| 1175 |
+
|
| 1176 |
+
export type WebSearchToolResultBlockParamContent =
|
| 1177 |
+
| Array<WebSearchResultBlockParam>
|
| 1178 |
+
| WebSearchToolRequestError;
|
| 1179 |
+
|
| 1180 |
+
export interface WebSearchToolResultError {
|
| 1181 |
+
error_code:
|
| 1182 |
+
| 'invalid_tool_input'
|
| 1183 |
+
| 'unavailable'
|
| 1184 |
+
| 'max_uses_exceeded'
|
| 1185 |
+
| 'too_many_requests'
|
| 1186 |
+
| 'query_too_long';
|
| 1187 |
+
|
| 1188 |
+
type: 'web_search_tool_result_error';
|
| 1189 |
+
}
|
| 1190 |
+
|
| 1191 |
+
export type MessageStreamEvent = RawMessageStreamEvent;
|
| 1192 |
+
|
| 1193 |
+
export type MessageStartEvent = RawMessageStartEvent;
|
| 1194 |
+
|
| 1195 |
+
export type MessageDeltaEvent = RawMessageDeltaEvent;
|
| 1196 |
+
|
| 1197 |
+
export type MessageStopEvent = RawMessageStopEvent;
|
| 1198 |
+
|
| 1199 |
+
export type ContentBlockStartEvent = RawContentBlockStartEvent;
|
| 1200 |
+
|
| 1201 |
+
export type ContentBlockDeltaEvent = RawContentBlockDeltaEvent;
|
| 1202 |
+
|
| 1203 |
+
export type ContentBlockStopEvent = RawContentBlockStopEvent;
|
| 1204 |
+
|
| 1205 |
+
export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming;
|
| 1206 |
+
|
| 1207 |
+
export interface MessageCreateParamsBase {
|
| 1208 |
+
/**
|
| 1209 |
+
* The maximum number of tokens to generate before stopping.
|
| 1210 |
+
*
|
| 1211 |
+
* Note that our models may stop _before_ reaching this maximum. This parameter
|
| 1212 |
+
* only specifies the absolute maximum number of tokens to generate.
|
| 1213 |
+
*
|
| 1214 |
+
* Different models have different maximum values for this parameter. See
|
| 1215 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for details.
|
| 1216 |
+
*/
|
| 1217 |
+
max_tokens: number;
|
| 1218 |
+
|
| 1219 |
+
/**
|
| 1220 |
+
* Input messages.
|
| 1221 |
+
*
|
| 1222 |
+
* Our models are trained to operate on alternating `user` and `assistant`
|
| 1223 |
+
* conversational turns. When creating a new `Message`, you specify the prior
|
| 1224 |
+
* conversational turns with the `messages` parameter, and the model then generates
|
| 1225 |
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
| 1226 |
+
* in your request will be combined into a single turn.
|
| 1227 |
+
*
|
| 1228 |
+
* Each input message must be an object with a `role` and `content`. You can
|
| 1229 |
+
* specify a single `user`-role message, or you can include multiple `user` and
|
| 1230 |
+
* `assistant` messages.
|
| 1231 |
+
*
|
| 1232 |
+
* If the final message uses the `assistant` role, the response content will
|
| 1233 |
+
* continue immediately from the content in that message. This can be used to
|
| 1234 |
+
* constrain part of the model's response.
|
| 1235 |
+
*
|
| 1236 |
+
* Example with a single `user` message:
|
| 1237 |
+
*
|
| 1238 |
+
* ```json
|
| 1239 |
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
| 1240 |
+
* ```
|
| 1241 |
+
*
|
| 1242 |
+
* Example with multiple conversational turns:
|
| 1243 |
+
*
|
| 1244 |
+
* ```json
|
| 1245 |
+
* [
|
| 1246 |
+
* { "role": "user", "content": "Hello there." },
|
| 1247 |
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
| 1248 |
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
| 1249 |
+
* ]
|
| 1250 |
+
* ```
|
| 1251 |
+
*
|
| 1252 |
+
* Example with a partially-filled response from Claude:
|
| 1253 |
+
*
|
| 1254 |
+
* ```json
|
| 1255 |
+
* [
|
| 1256 |
+
* {
|
| 1257 |
+
* "role": "user",
|
| 1258 |
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
| 1259 |
+
* },
|
| 1260 |
+
* { "role": "assistant", "content": "The best answer is (" }
|
| 1261 |
+
* ]
|
| 1262 |
+
* ```
|
| 1263 |
+
*
|
| 1264 |
+
* Each input message `content` may be either a single `string` or an array of
|
| 1265 |
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
| 1266 |
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
| 1267 |
+
* following input messages are equivalent:
|
| 1268 |
+
*
|
| 1269 |
+
* ```json
|
| 1270 |
+
* { "role": "user", "content": "Hello, Claude" }
|
| 1271 |
+
* ```
|
| 1272 |
+
*
|
| 1273 |
+
* ```json
|
| 1274 |
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
| 1275 |
+
* ```
|
| 1276 |
+
*
|
| 1277 |
+
* Starting with Claude 3 models, you can also send image content blocks:
|
| 1278 |
+
*
|
| 1279 |
+
* ```json
|
| 1280 |
+
* {
|
| 1281 |
+
* "role": "user",
|
| 1282 |
+
* "content": [
|
| 1283 |
+
* {
|
| 1284 |
+
* "type": "image",
|
| 1285 |
+
* "source": {
|
| 1286 |
+
* "type": "base64",
|
| 1287 |
+
* "media_type": "image/jpeg",
|
| 1288 |
+
* "data": "/9j/4AAQSkZJRg..."
|
| 1289 |
+
* }
|
| 1290 |
+
* },
|
| 1291 |
+
* { "type": "text", "text": "What is in this image?" }
|
| 1292 |
+
* ]
|
| 1293 |
+
* }
|
| 1294 |
+
* ```
|
| 1295 |
+
*
|
| 1296 |
+
* We currently support the `base64` source type for images, and the `image/jpeg`,
|
| 1297 |
+
* `image/png`, `image/gif`, and `image/webp` media types.
|
| 1298 |
+
*
|
| 1299 |
+
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
| 1300 |
+
* more input examples.
|
| 1301 |
+
*
|
| 1302 |
+
* Note that if you want to include a
|
| 1303 |
+
* [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
| 1304 |
+
* the top-level `system` parameter — there is no `"system"` role for input
|
| 1305 |
+
* messages in the Messages API.
|
| 1306 |
+
*
|
| 1307 |
+
* There is a limit of 100000 messages in a single request.
|
| 1308 |
+
*/
|
| 1309 |
+
messages: Array<MessageParam>;
|
| 1310 |
+
|
| 1311 |
+
/**
|
| 1312 |
+
* The model that will complete your prompt.\n\nSee
|
| 1313 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 1314 |
+
* details and options.
|
| 1315 |
+
*/
|
| 1316 |
+
model: Model;
|
| 1317 |
+
|
| 1318 |
+
/**
|
| 1319 |
+
* An object describing metadata about the request.
|
| 1320 |
+
*/
|
| 1321 |
+
metadata?: Metadata;
|
| 1322 |
+
|
| 1323 |
+
/**
|
| 1324 |
+
* Determines whether to use priority capacity (if available) or standard capacity
|
| 1325 |
+
* for this request.
|
| 1326 |
+
*
|
| 1327 |
+
* Anthropic offers different levels of service for your API requests. See
|
| 1328 |
+
* [service-tiers](https://docs.anthropic.com/en/api/service-tiers) for details.
|
| 1329 |
+
*/
|
| 1330 |
+
service_tier?: 'auto' | 'standard_only';
|
| 1331 |
+
|
| 1332 |
+
/**
|
| 1333 |
+
* Custom text sequences that will cause the model to stop generating.
|
| 1334 |
+
*
|
| 1335 |
+
* Our models will normally stop when they have naturally completed their turn,
|
| 1336 |
+
* which will result in a response `stop_reason` of `"end_turn"`.
|
| 1337 |
+
*
|
| 1338 |
+
* If you want the model to stop generating when it encounters custom strings of
|
| 1339 |
+
* text, you can use the `stop_sequences` parameter. If the model encounters one of
|
| 1340 |
+
* the custom sequences, the response `stop_reason` value will be `"stop_sequence"`
|
| 1341 |
+
* and the response `stop_sequence` value will contain the matched stop sequence.
|
| 1342 |
+
*/
|
| 1343 |
+
stop_sequences?: Array<string>;
|
| 1344 |
+
|
| 1345 |
+
/**
|
| 1346 |
+
* Whether to incrementally stream the response using server-sent events.
|
| 1347 |
+
*
|
| 1348 |
+
* See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
|
| 1349 |
+
* details.
|
| 1350 |
+
*/
|
| 1351 |
+
stream?: boolean;
|
| 1352 |
+
|
| 1353 |
+
/**
|
| 1354 |
+
* System prompt.
|
| 1355 |
+
*
|
| 1356 |
+
* A system prompt is a way of providing context and instructions to Claude, such
|
| 1357 |
+
* as specifying a particular goal or role. See our
|
| 1358 |
+
* [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
| 1359 |
+
*/
|
| 1360 |
+
system?: string | Array<TextBlockParam>;
|
| 1361 |
+
|
| 1362 |
+
/**
|
| 1363 |
+
* Amount of randomness injected into the response.
|
| 1364 |
+
*
|
| 1365 |
+
* Defaults to `1.0`. Ranges from `0.0` to `1.0`. Use `temperature` closer to `0.0`
|
| 1366 |
+
* for analytical / multiple choice, and closer to `1.0` for creative and
|
| 1367 |
+
* generative tasks.
|
| 1368 |
+
*
|
| 1369 |
+
* Note that even with `temperature` of `0.0`, the results will not be fully
|
| 1370 |
+
* deterministic.
|
| 1371 |
+
*/
|
| 1372 |
+
temperature?: number;
|
| 1373 |
+
|
| 1374 |
+
/**
|
| 1375 |
+
* Configuration for enabling Claude's extended thinking.
|
| 1376 |
+
*
|
| 1377 |
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
| 1378 |
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
| 1379 |
+
* tokens and counts towards your `max_tokens` limit.
|
| 1380 |
+
*
|
| 1381 |
+
* See
|
| 1382 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 1383 |
+
* for details.
|
| 1384 |
+
*/
|
| 1385 |
+
thinking?: ThinkingConfigParam;
|
| 1386 |
+
|
| 1387 |
+
/**
|
| 1388 |
+
* How the model should use the provided tools. The model can use a specific tool,
|
| 1389 |
+
* any available tool, decide by itself, or not use tools at all.
|
| 1390 |
+
*/
|
| 1391 |
+
tool_choice?: ToolChoice;
|
| 1392 |
+
|
| 1393 |
+
/**
|
| 1394 |
+
* Definitions of tools that the model may use.
|
| 1395 |
+
*
|
| 1396 |
+
* If you include `tools` in your API request, the model may return `tool_use`
|
| 1397 |
+
* content blocks that represent the model's use of those tools. You can then run
|
| 1398 |
+
* those tools using the tool input generated by the model and then optionally
|
| 1399 |
+
* return results back to the model using `tool_result` content blocks.
|
| 1400 |
+
*
|
| 1401 |
+
* Each tool definition includes:
|
| 1402 |
+
*
|
| 1403 |
+
* - `name`: Name of the tool.
|
| 1404 |
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
| 1405 |
+
* - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
| 1406 |
+
* tool `input` shape that the model will produce in `tool_use` output content
|
| 1407 |
+
* blocks.
|
| 1408 |
+
*
|
| 1409 |
+
* For example, if you defined `tools` as:
|
| 1410 |
+
*
|
| 1411 |
+
* ```json
|
| 1412 |
+
* [
|
| 1413 |
+
* {
|
| 1414 |
+
* "name": "get_stock_price",
|
| 1415 |
+
* "description": "Get the current stock price for a given ticker symbol.",
|
| 1416 |
+
* "input_schema": {
|
| 1417 |
+
* "type": "object",
|
| 1418 |
+
* "properties": {
|
| 1419 |
+
* "ticker": {
|
| 1420 |
+
* "type": "string",
|
| 1421 |
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
| 1422 |
+
* }
|
| 1423 |
+
* },
|
| 1424 |
+
* "required": ["ticker"]
|
| 1425 |
+
* }
|
| 1426 |
+
* }
|
| 1427 |
+
* ]
|
| 1428 |
+
* ```
|
| 1429 |
+
*
|
| 1430 |
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
| 1431 |
+
* `tool_use` content blocks in the response like this:
|
| 1432 |
+
*
|
| 1433 |
+
* ```json
|
| 1434 |
+
* [
|
| 1435 |
+
* {
|
| 1436 |
+
* "type": "tool_use",
|
| 1437 |
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1438 |
+
* "name": "get_stock_price",
|
| 1439 |
+
* "input": { "ticker": "^GSPC" }
|
| 1440 |
+
* }
|
| 1441 |
+
* ]
|
| 1442 |
+
* ```
|
| 1443 |
+
*
|
| 1444 |
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
| 1445 |
+
* input, and return the following back to the model in a subsequent `user`
|
| 1446 |
+
* message:
|
| 1447 |
+
*
|
| 1448 |
+
* ```json
|
| 1449 |
+
* [
|
| 1450 |
+
* {
|
| 1451 |
+
* "type": "tool_result",
|
| 1452 |
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1453 |
+
* "content": "259.75 USD"
|
| 1454 |
+
* }
|
| 1455 |
+
* ]
|
| 1456 |
+
* ```
|
| 1457 |
+
*
|
| 1458 |
+
* Tools can be used for workflows that include running client-side tools and
|
| 1459 |
+
* functions, or more generally whenever you want the model to produce a particular
|
| 1460 |
+
* JSON structure of output.
|
| 1461 |
+
*
|
| 1462 |
+
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
| 1463 |
+
*/
|
| 1464 |
+
tools?: Array<ToolUnion>;
|
| 1465 |
+
|
| 1466 |
+
/**
|
| 1467 |
+
* Only sample from the top K options for each subsequent token.
|
| 1468 |
+
*
|
| 1469 |
+
* Used to remove "long tail" low probability responses.
|
| 1470 |
+
* [Learn more technical details here](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277).
|
| 1471 |
+
*
|
| 1472 |
+
* Recommended for advanced use cases only. You usually only need to use
|
| 1473 |
+
* `temperature`.
|
| 1474 |
+
*/
|
| 1475 |
+
top_k?: number;
|
| 1476 |
+
|
| 1477 |
+
/**
|
| 1478 |
+
* Use nucleus sampling.
|
| 1479 |
+
*
|
| 1480 |
+
* In nucleus sampling, we compute the cumulative distribution over all the options
|
| 1481 |
+
* for each subsequent token in decreasing probability order and cut it off once it
|
| 1482 |
+
* reaches a particular probability specified by `top_p`. You should either alter
|
| 1483 |
+
* `temperature` or `top_p`, but not both.
|
| 1484 |
+
*
|
| 1485 |
+
* Recommended for advanced use cases only. You usually only need to use
|
| 1486 |
+
* `temperature`.
|
| 1487 |
+
*/
|
| 1488 |
+
top_p?: number;
|
| 1489 |
+
}
|
| 1490 |
+
|
| 1491 |
+
export namespace MessageCreateParams {
|
| 1492 |
+
export type MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming;
|
| 1493 |
+
export type MessageCreateParamsStreaming = MessagesAPI.MessageCreateParamsStreaming;
|
| 1494 |
+
}
|
| 1495 |
+
|
| 1496 |
+
export interface MessageCreateParamsNonStreaming extends MessageCreateParamsBase {
|
| 1497 |
+
/**
|
| 1498 |
+
* Whether to incrementally stream the response using server-sent events.
|
| 1499 |
+
*
|
| 1500 |
+
* See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
|
| 1501 |
+
* details.
|
| 1502 |
+
*/
|
| 1503 |
+
stream?: false;
|
| 1504 |
+
}
|
| 1505 |
+
|
| 1506 |
+
export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
|
| 1507 |
+
/**
|
| 1508 |
+
* Whether to incrementally stream the response using server-sent events.
|
| 1509 |
+
*
|
| 1510 |
+
* See [streaming](https://docs.anthropic.com/en/api/messages-streaming) for
|
| 1511 |
+
* details.
|
| 1512 |
+
*/
|
| 1513 |
+
stream: true;
|
| 1514 |
+
}
|
| 1515 |
+
|
| 1516 |
+
export type MessageStreamParams = MessageCreateParamsBase;
|
| 1517 |
+
|
| 1518 |
+
export interface MessageCountTokensParams {
|
| 1519 |
+
/**
|
| 1520 |
+
* Input messages.
|
| 1521 |
+
*
|
| 1522 |
+
* Our models are trained to operate on alternating `user` and `assistant`
|
| 1523 |
+
* conversational turns. When creating a new `Message`, you specify the prior
|
| 1524 |
+
* conversational turns with the `messages` parameter, and the model then generates
|
| 1525 |
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
| 1526 |
+
* in your request will be combined into a single turn.
|
| 1527 |
+
*
|
| 1528 |
+
* Each input message must be an object with a `role` and `content`. You can
|
| 1529 |
+
* specify a single `user`-role message, or you can include multiple `user` and
|
| 1530 |
+
* `assistant` messages.
|
| 1531 |
+
*
|
| 1532 |
+
* If the final message uses the `assistant` role, the response content will
|
| 1533 |
+
* continue immediately from the content in that message. This can be used to
|
| 1534 |
+
* constrain part of the model's response.
|
| 1535 |
+
*
|
| 1536 |
+
* Example with a single `user` message:
|
| 1537 |
+
*
|
| 1538 |
+
* ```json
|
| 1539 |
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
| 1540 |
+
* ```
|
| 1541 |
+
*
|
| 1542 |
+
* Example with multiple conversational turns:
|
| 1543 |
+
*
|
| 1544 |
+
* ```json
|
| 1545 |
+
* [
|
| 1546 |
+
* { "role": "user", "content": "Hello there." },
|
| 1547 |
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
| 1548 |
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
| 1549 |
+
* ]
|
| 1550 |
+
* ```
|
| 1551 |
+
*
|
| 1552 |
+
* Example with a partially-filled response from Claude:
|
| 1553 |
+
*
|
| 1554 |
+
* ```json
|
| 1555 |
+
* [
|
| 1556 |
+
* {
|
| 1557 |
+
* "role": "user",
|
| 1558 |
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
| 1559 |
+
* },
|
| 1560 |
+
* { "role": "assistant", "content": "The best answer is (" }
|
| 1561 |
+
* ]
|
| 1562 |
+
* ```
|
| 1563 |
+
*
|
| 1564 |
+
* Each input message `content` may be either a single `string` or an array of
|
| 1565 |
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
| 1566 |
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
| 1567 |
+
* following input messages are equivalent:
|
| 1568 |
+
*
|
| 1569 |
+
* ```json
|
| 1570 |
+
* { "role": "user", "content": "Hello, Claude" }
|
| 1571 |
+
* ```
|
| 1572 |
+
*
|
| 1573 |
+
* ```json
|
| 1574 |
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
| 1575 |
+
* ```
|
| 1576 |
+
*
|
| 1577 |
+
* Starting with Claude 3 models, you can also send image content blocks:
|
| 1578 |
+
*
|
| 1579 |
+
* ```json
|
| 1580 |
+
* {
|
| 1581 |
+
* "role": "user",
|
| 1582 |
+
* "content": [
|
| 1583 |
+
* {
|
| 1584 |
+
* "type": "image",
|
| 1585 |
+
* "source": {
|
| 1586 |
+
* "type": "base64",
|
| 1587 |
+
* "media_type": "image/jpeg",
|
| 1588 |
+
* "data": "/9j/4AAQSkZJRg..."
|
| 1589 |
+
* }
|
| 1590 |
+
* },
|
| 1591 |
+
* { "type": "text", "text": "What is in this image?" }
|
| 1592 |
+
* ]
|
| 1593 |
+
* }
|
| 1594 |
+
* ```
|
| 1595 |
+
*
|
| 1596 |
+
* We currently support the `base64` source type for images, and the `image/jpeg`,
|
| 1597 |
+
* `image/png`, `image/gif`, and `image/webp` media types.
|
| 1598 |
+
*
|
| 1599 |
+
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
| 1600 |
+
* more input examples.
|
| 1601 |
+
*
|
| 1602 |
+
* Note that if you want to include a
|
| 1603 |
+
* [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
| 1604 |
+
* the top-level `system` parameter — there is no `"system"` role for input
|
| 1605 |
+
* messages in the Messages API.
|
| 1606 |
+
*
|
| 1607 |
+
* There is a limit of 100000 messages in a single request.
|
| 1608 |
+
*/
|
| 1609 |
+
messages: Array<MessageParam>;
|
| 1610 |
+
|
| 1611 |
+
/**
|
| 1612 |
+
* The model that will complete your prompt.\n\nSee
|
| 1613 |
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
| 1614 |
+
* details and options.
|
| 1615 |
+
*/
|
| 1616 |
+
model: Model;
|
| 1617 |
+
|
| 1618 |
+
/**
|
| 1619 |
+
* System prompt.
|
| 1620 |
+
*
|
| 1621 |
+
* A system prompt is a way of providing context and instructions to Claude, such
|
| 1622 |
+
* as specifying a particular goal or role. See our
|
| 1623 |
+
* [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
| 1624 |
+
*/
|
| 1625 |
+
system?: string | Array<TextBlockParam>;
|
| 1626 |
+
|
| 1627 |
+
/**
|
| 1628 |
+
* Configuration for enabling Claude's extended thinking.
|
| 1629 |
+
*
|
| 1630 |
+
* When enabled, responses include `thinking` content blocks showing Claude's
|
| 1631 |
+
* thinking process before the final answer. Requires a minimum budget of 1,024
|
| 1632 |
+
* tokens and counts towards your `max_tokens` limit.
|
| 1633 |
+
*
|
| 1634 |
+
* See
|
| 1635 |
+
* [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking)
|
| 1636 |
+
* for details.
|
| 1637 |
+
*/
|
| 1638 |
+
thinking?: ThinkingConfigParam;
|
| 1639 |
+
|
| 1640 |
+
/**
|
| 1641 |
+
* How the model should use the provided tools. The model can use a specific tool,
|
| 1642 |
+
* any available tool, decide by itself, or not use tools at all.
|
| 1643 |
+
*/
|
| 1644 |
+
tool_choice?: ToolChoice;
|
| 1645 |
+
|
| 1646 |
+
/**
|
| 1647 |
+
* Definitions of tools that the model may use.
|
| 1648 |
+
*
|
| 1649 |
+
* If you include `tools` in your API request, the model may return `tool_use`
|
| 1650 |
+
* content blocks that represent the model's use of those tools. You can then run
|
| 1651 |
+
* those tools using the tool input generated by the model and then optionally
|
| 1652 |
+
* return results back to the model using `tool_result` content blocks.
|
| 1653 |
+
*
|
| 1654 |
+
* Each tool definition includes:
|
| 1655 |
+
*
|
| 1656 |
+
* - `name`: Name of the tool.
|
| 1657 |
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
| 1658 |
+
* - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the
|
| 1659 |
+
* tool `input` shape that the model will produce in `tool_use` output content
|
| 1660 |
+
* blocks.
|
| 1661 |
+
*
|
| 1662 |
+
* For example, if you defined `tools` as:
|
| 1663 |
+
*
|
| 1664 |
+
* ```json
|
| 1665 |
+
* [
|
| 1666 |
+
* {
|
| 1667 |
+
* "name": "get_stock_price",
|
| 1668 |
+
* "description": "Get the current stock price for a given ticker symbol.",
|
| 1669 |
+
* "input_schema": {
|
| 1670 |
+
* "type": "object",
|
| 1671 |
+
* "properties": {
|
| 1672 |
+
* "ticker": {
|
| 1673 |
+
* "type": "string",
|
| 1674 |
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
| 1675 |
+
* }
|
| 1676 |
+
* },
|
| 1677 |
+
* "required": ["ticker"]
|
| 1678 |
+
* }
|
| 1679 |
+
* }
|
| 1680 |
+
* ]
|
| 1681 |
+
* ```
|
| 1682 |
+
*
|
| 1683 |
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
| 1684 |
+
* `tool_use` content blocks in the response like this:
|
| 1685 |
+
*
|
| 1686 |
+
* ```json
|
| 1687 |
+
* [
|
| 1688 |
+
* {
|
| 1689 |
+
* "type": "tool_use",
|
| 1690 |
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1691 |
+
* "name": "get_stock_price",
|
| 1692 |
+
* "input": { "ticker": "^GSPC" }
|
| 1693 |
+
* }
|
| 1694 |
+
* ]
|
| 1695 |
+
* ```
|
| 1696 |
+
*
|
| 1697 |
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
| 1698 |
+
* input, and return the following back to the model in a subsequent `user`
|
| 1699 |
+
* message:
|
| 1700 |
+
*
|
| 1701 |
+
* ```json
|
| 1702 |
+
* [
|
| 1703 |
+
* {
|
| 1704 |
+
* "type": "tool_result",
|
| 1705 |
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
| 1706 |
+
* "content": "259.75 USD"
|
| 1707 |
+
* }
|
| 1708 |
+
* ]
|
| 1709 |
+
* ```
|
| 1710 |
+
*
|
| 1711 |
+
* Tools can be used for workflows that include running client-side tools and
|
| 1712 |
+
* functions, or more generally whenever you want the model to produce a particular
|
| 1713 |
+
* JSON structure of output.
|
| 1714 |
+
*
|
| 1715 |
+
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
| 1716 |
+
*/
|
| 1717 |
+
tools?: Array<MessageCountTokensTool>;
|
| 1718 |
+
}
|
| 1719 |
+
|
| 1720 |
+
Messages.Batches = Batches;
|
| 1721 |
+
|
| 1722 |
+
export declare namespace Messages {
|
| 1723 |
+
export {
|
| 1724 |
+
type Base64ImageSource as Base64ImageSource,
|
| 1725 |
+
type Base64PDFSource as Base64PDFSource,
|
| 1726 |
+
type CacheControlEphemeral as CacheControlEphemeral,
|
| 1727 |
+
type CitationCharLocation as CitationCharLocation,
|
| 1728 |
+
type CitationCharLocationParam as CitationCharLocationParam,
|
| 1729 |
+
type CitationContentBlockLocation as CitationContentBlockLocation,
|
| 1730 |
+
type CitationContentBlockLocationParam as CitationContentBlockLocationParam,
|
| 1731 |
+
type CitationPageLocation as CitationPageLocation,
|
| 1732 |
+
type CitationPageLocationParam as CitationPageLocationParam,
|
| 1733 |
+
type CitationWebSearchResultLocationParam as CitationWebSearchResultLocationParam,
|
| 1734 |
+
type CitationsConfigParam as CitationsConfigParam,
|
| 1735 |
+
type CitationsDelta as CitationsDelta,
|
| 1736 |
+
type CitationsWebSearchResultLocation as CitationsWebSearchResultLocation,
|
| 1737 |
+
type ContentBlock as ContentBlock,
|
| 1738 |
+
type ContentBlockParam as ContentBlockParam,
|
| 1739 |
+
type ContentBlockStartEvent as ContentBlockStartEvent,
|
| 1740 |
+
type ContentBlockStopEvent as ContentBlockStopEvent,
|
| 1741 |
+
type ContentBlockSource as ContentBlockSource,
|
| 1742 |
+
type ContentBlockSourceContent as ContentBlockSourceContent,
|
| 1743 |
+
type DocumentBlockParam as DocumentBlockParam,
|
| 1744 |
+
type ImageBlockParam as ImageBlockParam,
|
| 1745 |
+
type InputJSONDelta as InputJSONDelta,
|
| 1746 |
+
type Message as Message,
|
| 1747 |
+
type MessageCountTokensTool as MessageCountTokensTool,
|
| 1748 |
+
type MessageDeltaEvent as MessageDeltaEvent,
|
| 1749 |
+
type MessageDeltaUsage as MessageDeltaUsage,
|
| 1750 |
+
type MessageParam as MessageParam,
|
| 1751 |
+
type MessageTokensCount as MessageTokensCount,
|
| 1752 |
+
type Metadata as Metadata,
|
| 1753 |
+
type Model as Model,
|
| 1754 |
+
type PlainTextSource as PlainTextSource,
|
| 1755 |
+
type RawContentBlockDelta as RawContentBlockDelta,
|
| 1756 |
+
type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent,
|
| 1757 |
+
type RawContentBlockStartEvent as RawContentBlockStartEvent,
|
| 1758 |
+
type RawContentBlockStopEvent as RawContentBlockStopEvent,
|
| 1759 |
+
type RawMessageDeltaEvent as RawMessageDeltaEvent,
|
| 1760 |
+
type RawMessageStartEvent as RawMessageStartEvent,
|
| 1761 |
+
type RawMessageStopEvent as RawMessageStopEvent,
|
| 1762 |
+
type RawMessageStreamEvent as RawMessageStreamEvent,
|
| 1763 |
+
type RedactedThinkingBlock as RedactedThinkingBlock,
|
| 1764 |
+
type RedactedThinkingBlockParam as RedactedThinkingBlockParam,
|
| 1765 |
+
type ServerToolUsage as ServerToolUsage,
|
| 1766 |
+
type ServerToolUseBlock as ServerToolUseBlock,
|
| 1767 |
+
type ServerToolUseBlockParam as ServerToolUseBlockParam,
|
| 1768 |
+
type SignatureDelta as SignatureDelta,
|
| 1769 |
+
type StopReason as StopReason,
|
| 1770 |
+
type TextBlock as TextBlock,
|
| 1771 |
+
type TextBlockParam as TextBlockParam,
|
| 1772 |
+
type TextCitation as TextCitation,
|
| 1773 |
+
type TextCitationParam as TextCitationParam,
|
| 1774 |
+
type TextDelta as TextDelta,
|
| 1775 |
+
type ThinkingBlock as ThinkingBlock,
|
| 1776 |
+
type ThinkingBlockParam as ThinkingBlockParam,
|
| 1777 |
+
type ThinkingConfigDisabled as ThinkingConfigDisabled,
|
| 1778 |
+
type ThinkingConfigEnabled as ThinkingConfigEnabled,
|
| 1779 |
+
type ThinkingConfigParam as ThinkingConfigParam,
|
| 1780 |
+
type ThinkingDelta as ThinkingDelta,
|
| 1781 |
+
type Tool as Tool,
|
| 1782 |
+
type ToolBash20250124 as ToolBash20250124,
|
| 1783 |
+
type ToolChoice as ToolChoice,
|
| 1784 |
+
type ToolChoiceAny as ToolChoiceAny,
|
| 1785 |
+
type ToolChoiceAuto as ToolChoiceAuto,
|
| 1786 |
+
type ToolChoiceNone as ToolChoiceNone,
|
| 1787 |
+
type ToolChoiceTool as ToolChoiceTool,
|
| 1788 |
+
type ToolResultBlockParam as ToolResultBlockParam,
|
| 1789 |
+
type ToolTextEditor20250124 as ToolTextEditor20250124,
|
| 1790 |
+
type ToolUnion as ToolUnion,
|
| 1791 |
+
type ToolUseBlock as ToolUseBlock,
|
| 1792 |
+
type ToolUseBlockParam as ToolUseBlockParam,
|
| 1793 |
+
type URLImageSource as URLImageSource,
|
| 1794 |
+
type URLPDFSource as URLPDFSource,
|
| 1795 |
+
type Usage as Usage,
|
| 1796 |
+
type WebSearchResultBlock as WebSearchResultBlock,
|
| 1797 |
+
type WebSearchResultBlockParam as WebSearchResultBlockParam,
|
| 1798 |
+
type WebSearchTool20250305 as WebSearchTool20250305,
|
| 1799 |
+
type WebSearchToolRequestError as WebSearchToolRequestError,
|
| 1800 |
+
type WebSearchToolResultBlock as WebSearchToolResultBlock,
|
| 1801 |
+
type WebSearchToolResultBlockContent as WebSearchToolResultBlockContent,
|
| 1802 |
+
type WebSearchToolResultBlockParam as WebSearchToolResultBlockParam,
|
| 1803 |
+
type WebSearchToolResultBlockParamContent as WebSearchToolResultBlockParamContent,
|
| 1804 |
+
type WebSearchToolResultError as WebSearchToolResultError,
|
| 1805 |
+
type MessageStreamEvent as MessageStreamEvent,
|
| 1806 |
+
type MessageStartEvent as MessageStartEvent,
|
| 1807 |
+
type MessageStopEvent as MessageStopEvent,
|
| 1808 |
+
type ContentBlockDeltaEvent as ContentBlockDeltaEvent,
|
| 1809 |
+
type MessageCreateParams as MessageCreateParams,
|
| 1810 |
+
type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming,
|
| 1811 |
+
type MessageCreateParamsStreaming as MessageCreateParamsStreaming,
|
| 1812 |
+
type MessageStreamParams as MessageStreamParams,
|
| 1813 |
+
type MessageCountTokensParams as MessageCountTokensParams,
|
| 1814 |
+
};
|
| 1815 |
+
|
| 1816 |
+
export {
|
| 1817 |
+
Batches as Batches,
|
| 1818 |
+
type DeletedMessageBatch as DeletedMessageBatch,
|
| 1819 |
+
type MessageBatch as MessageBatch,
|
| 1820 |
+
type MessageBatchCanceledResult as MessageBatchCanceledResult,
|
| 1821 |
+
type MessageBatchErroredResult as MessageBatchErroredResult,
|
| 1822 |
+
type MessageBatchExpiredResult as MessageBatchExpiredResult,
|
| 1823 |
+
type MessageBatchIndividualResponse as MessageBatchIndividualResponse,
|
| 1824 |
+
type MessageBatchRequestCounts as MessageBatchRequestCounts,
|
| 1825 |
+
type MessageBatchResult as MessageBatchResult,
|
| 1826 |
+
type MessageBatchSucceededResult as MessageBatchSucceededResult,
|
| 1827 |
+
type MessageBatchesPage as MessageBatchesPage,
|
| 1828 |
+
type BatchCreateParams as BatchCreateParams,
|
| 1829 |
+
type BatchListParams as BatchListParams,
|
| 1830 |
+
};
|
| 1831 |
+
}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@anthropic-ai/sdk/src/resources/shared.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
export interface APIErrorObject {
|
| 4 |
+
message: string;
|
| 5 |
+
|
| 6 |
+
type: 'api_error';
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
export interface AuthenticationError {
|
| 10 |
+
message: string;
|
| 11 |
+
|
| 12 |
+
type: 'authentication_error';
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export interface BillingError {
|
| 16 |
+
message: string;
|
| 17 |
+
|
| 18 |
+
type: 'billing_error';
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
export type ErrorObject =
|
| 22 |
+
| InvalidRequestError
|
| 23 |
+
| AuthenticationError
|
| 24 |
+
| BillingError
|
| 25 |
+
| PermissionError
|
| 26 |
+
| NotFoundError
|
| 27 |
+
| RateLimitError
|
| 28 |
+
| GatewayTimeoutError
|
| 29 |
+
| APIErrorObject
|
| 30 |
+
| OverloadedError;
|
| 31 |
+
|
| 32 |
+
export interface ErrorResponse {
|
| 33 |
+
error: ErrorObject;
|
| 34 |
+
|
| 35 |
+
type: 'error';
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
export interface GatewayTimeoutError {
|
| 39 |
+
message: string;
|
| 40 |
+
|
| 41 |
+
type: 'timeout_error';
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
export interface InvalidRequestError {
|
| 45 |
+
message: string;
|
| 46 |
+
|
| 47 |
+
type: 'invalid_request_error';
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
export interface NotFoundError {
|
| 51 |
+
message: string;
|
| 52 |
+
|
| 53 |
+
type: 'not_found_error';
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
export interface OverloadedError {
|
| 57 |
+
message: string;
|
| 58 |
+
|
| 59 |
+
type: 'overloaded_error';
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
export interface PermissionError {
|
| 63 |
+
message: string;
|
| 64 |
+
|
| 65 |
+
type: 'permission_error';
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
export interface RateLimitError {
|
| 69 |
+
message: string;
|
| 70 |
+
|
| 71 |
+
type: 'rate_limit_error';
|
| 72 |
+
}
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@esbuild/linux-x64/bin/esbuild
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:92d1ca653cf188da8d7650ddfe1c32d5a139bf3a9a2808f3e622e6d667ce0389
|
| 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'use strict'
|
| 2 |
+
|
| 3 |
+
function Negotiator (options) {
|
| 4 |
+
if (!new.target) {
|
| 5 |
+
return new Negotiator(options)
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
const {
|
| 9 |
+
supportedValues = [],
|
| 10 |
+
cache
|
| 11 |
+
} = (options && typeof options === 'object' && options) || {}
|
| 12 |
+
|
| 13 |
+
this.supportedValues = supportedValues
|
| 14 |
+
|
| 15 |
+
this.cache = cache
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
Negotiator.prototype.negotiate = function (header) {
|
| 19 |
+
if (typeof header !== 'string') {
|
| 20 |
+
return null
|
| 21 |
+
}
|
| 22 |
+
if (!this.cache) {
|
| 23 |
+
return negotiate(header, this.supportedValues)
|
| 24 |
+
}
|
| 25 |
+
if (!this.cache.has(header)) {
|
| 26 |
+
this.cache.set(header, negotiate(header, this.supportedValues))
|
| 27 |
+
}
|
| 28 |
+
return this.cache.get(header)
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
function negotiate (header, supportedValues) {
|
| 32 |
+
if (
|
| 33 |
+
!header ||
|
| 34 |
+
!Array.isArray(supportedValues) ||
|
| 35 |
+
supportedValues.length === 0
|
| 36 |
+
) {
|
| 37 |
+
return null
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
if (header === '*') {
|
| 41 |
+
return supportedValues[0]
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
let preferredEncoding = null
|
| 45 |
+
let preferredEncodingPriority = Infinity
|
| 46 |
+
let preferredEncodingQuality = 0
|
| 47 |
+
|
| 48 |
+
function processMatch (enc, quality) {
|
| 49 |
+
if (quality === 0 || preferredEncodingQuality > quality) {
|
| 50 |
+
return false
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
const encoding = (enc === '*' && supportedValues[0]) || enc
|
| 54 |
+
const priority = supportedValues.indexOf(encoding)
|
| 55 |
+
if (priority === -1) {
|
| 56 |
+
return false
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
if (priority === 0 && quality === 1) {
|
| 60 |
+
preferredEncoding = encoding
|
| 61 |
+
return true
|
| 62 |
+
} else if (preferredEncodingQuality < quality) {
|
| 63 |
+
preferredEncoding = encoding
|
| 64 |
+
preferredEncodingPriority = priority
|
| 65 |
+
preferredEncodingQuality = quality
|
| 66 |
+
} else if (preferredEncodingPriority > priority) {
|
| 67 |
+
preferredEncoding = encoding
|
| 68 |
+
preferredEncodingPriority = priority
|
| 69 |
+
preferredEncodingQuality = quality
|
| 70 |
+
}
|
| 71 |
+
return false
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
parse(header, processMatch)
|
| 75 |
+
|
| 76 |
+
return preferredEncoding
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
const BEGIN = 0
|
| 80 |
+
const TOKEN = 1
|
| 81 |
+
const QUALITY = 2
|
| 82 |
+
const END = 3
|
| 83 |
+
|
| 84 |
+
function parse (header, processMatch) {
|
| 85 |
+
let str = ''
|
| 86 |
+
let quality
|
| 87 |
+
let state = BEGIN
|
| 88 |
+
for (let i = 0, il = header.length; i < il; ++i) {
|
| 89 |
+
const char = header[i]
|
| 90 |
+
|
| 91 |
+
if (char === ' ' || char === '\t') {
|
| 92 |
+
continue
|
| 93 |
+
} else if (char === ';') {
|
| 94 |
+
if (state === TOKEN) {
|
| 95 |
+
state = QUALITY
|
| 96 |
+
quality = ''
|
| 97 |
+
}
|
| 98 |
+
continue
|
| 99 |
+
} else if (char === ',') {
|
| 100 |
+
if (state === TOKEN) {
|
| 101 |
+
if (processMatch(str, 1)) {
|
| 102 |
+
state = END
|
| 103 |
+
break
|
| 104 |
+
}
|
| 105 |
+
state = BEGIN
|
| 106 |
+
str = ''
|
| 107 |
+
} else if (state === QUALITY) {
|
| 108 |
+
if (processMatch(str, parseFloat(quality) || 0)) {
|
| 109 |
+
state = END
|
| 110 |
+
break
|
| 111 |
+
}
|
| 112 |
+
state = BEGIN
|
| 113 |
+
str = ''
|
| 114 |
+
quality = ''
|
| 115 |
+
}
|
| 116 |
+
continue
|
| 117 |
+
} else if (
|
| 118 |
+
state === QUALITY
|
| 119 |
+
) {
|
| 120 |
+
if (char === 'q' || char === '=') {
|
| 121 |
+
continue
|
| 122 |
+
} else if (
|
| 123 |
+
char === '.' ||
|
| 124 |
+
char === '1' ||
|
| 125 |
+
char === '0' ||
|
| 126 |
+
char === '2' ||
|
| 127 |
+
char === '3' ||
|
| 128 |
+
char === '4' ||
|
| 129 |
+
char === '5' ||
|
| 130 |
+
char === '6' ||
|
| 131 |
+
char === '7' ||
|
| 132 |
+
char === '8' ||
|
| 133 |
+
char === '9'
|
| 134 |
+
) {
|
| 135 |
+
quality += char
|
| 136 |
+
continue
|
| 137 |
+
}
|
| 138 |
+
} else if (state === BEGIN) {
|
| 139 |
+
state = TOKEN
|
| 140 |
+
str += char
|
| 141 |
+
continue
|
| 142 |
+
}
|
| 143 |
+
if (state === TOKEN) {
|
| 144 |
+
const prevChar = header[i - 1]
|
| 145 |
+
if (prevChar === ' ' || prevChar === '\t') {
|
| 146 |
+
str = ''
|
| 147 |
+
}
|
| 148 |
+
str += char
|
| 149 |
+
continue
|
| 150 |
+
}
|
| 151 |
+
if (processMatch(str, parseFloat(quality) || 0)) {
|
| 152 |
+
state = END
|
| 153 |
+
break
|
| 154 |
+
}
|
| 155 |
+
state = BEGIN
|
| 156 |
+
str = char
|
| 157 |
+
quality = ''
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
if (state === TOKEN) {
|
| 161 |
+
processMatch(str, 1)
|
| 162 |
+
} else if (state === QUALITY) {
|
| 163 |
+
processMatch(str, parseFloat(quality) || 0)
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
module.exports = negotiate
|
| 168 |
+
module.exports.default = negotiate
|
| 169 |
+
module.exports.negotiate = negotiate
|
| 170 |
+
module.exports.Negotiator = Negotiator
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@fastify/ajv-compiler/types/index.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import _ajv, { AnySchema, Options as AjvOptions, ValidateFunction } from 'ajv'
|
| 2 |
+
import AjvJTD, { JTDOptions } from 'ajv/dist/jtd'
|
| 3 |
+
import type { Options, ErrorObject } from 'ajv'
|
| 4 |
+
import { AnyValidateFunction } from 'ajv/dist/core'
|
| 5 |
+
|
| 6 |
+
type Ajv = _ajv
|
| 7 |
+
type AjvSerializerGenerator = typeof AjvCompiler
|
| 8 |
+
|
| 9 |
+
type AjvJTDCompile = AjvJTD['compileSerializer']
|
| 10 |
+
type AjvCompile = (schema: AnySchema, _meta?: boolean) => AnyValidateFunction
|
| 11 |
+
|
| 12 |
+
declare function buildCompilerFromPool (externalSchemas: { [key: string]: AnySchema | AnySchema[] }, options?: { mode: 'JTD'; customOptions?: JTDOptions; onCreate?: (ajvInstance: Ajv) => void }): AjvCompile
|
| 13 |
+
declare function buildCompilerFromPool (externalSchemas: { [key: string]: AnySchema | AnySchema[] }, options?: { mode?: never; customOptions?: AjvOptions; onCreate?: (ajvInstance: Ajv) => void }): AjvCompile
|
| 14 |
+
|
| 15 |
+
declare function buildSerializerFromPool (externalSchemas: any, serializerOpts?: { mode?: never; } & JTDOptions): AjvJTDCompile
|
| 16 |
+
|
| 17 |
+
declare function AjvCompiler (opts: { jtdSerializer: true }): AjvCompiler.BuildSerializerFromPool
|
| 18 |
+
declare function AjvCompiler (opts?: { jtdSerializer?: false }): AjvCompiler.BuildCompilerFromPool
|
| 19 |
+
|
| 20 |
+
declare function StandaloneValidator (options: AjvCompiler.StandaloneOptions): AjvCompiler.BuildCompilerFromPool
|
| 21 |
+
|
| 22 |
+
declare namespace AjvCompiler {
|
| 23 |
+
export type { Options, ErrorObject }
|
| 24 |
+
export { Ajv }
|
| 25 |
+
|
| 26 |
+
export type BuildSerializerFromPool = typeof buildSerializerFromPool
|
| 27 |
+
|
| 28 |
+
export type BuildCompilerFromPool = typeof buildCompilerFromPool
|
| 29 |
+
|
| 30 |
+
export const AjvReference: Symbol
|
| 31 |
+
|
| 32 |
+
export enum HttpParts {
|
| 33 |
+
Body = 'body',
|
| 34 |
+
Headers = 'headers',
|
| 35 |
+
Params = 'params',
|
| 36 |
+
Query = 'querystring',
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
export type RouteDefinition = {
|
| 40 |
+
method: string,
|
| 41 |
+
url: string,
|
| 42 |
+
httpPart: HttpParts,
|
| 43 |
+
schema?: unknown,
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
export type StandaloneRestoreFunction = (opts: RouteDefinition) => ValidateFunction
|
| 47 |
+
|
| 48 |
+
export type StandaloneStoreFunction = (opts: RouteDefinition, schemaValidationCode: string) => void
|
| 49 |
+
|
| 50 |
+
export type StandaloneOptionsReadModeOn = {
|
| 51 |
+
readMode: true;
|
| 52 |
+
restoreFunction?: StandaloneRestoreFunction
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
export type StandaloneOptionsReadModeOff = {
|
| 56 |
+
readMode?: false | undefined;
|
| 57 |
+
storeFunction?: StandaloneStoreFunction;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
export type StandaloneOptions = StandaloneOptionsReadModeOn | StandaloneOptionsReadModeOff
|
| 61 |
+
|
| 62 |
+
export type ValidatorFactory = BuildCompilerFromPool | BuildSerializerFromPool
|
| 63 |
+
|
| 64 |
+
export type ValidatorCompiler = ReturnType<ValidatorFactory>
|
| 65 |
+
|
| 66 |
+
export { StandaloneValidator }
|
| 67 |
+
|
| 68 |
+
export const AjvCompiler: AjvSerializerGenerator
|
| 69 |
+
export { AjvCompiler as default }
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
export = AjvCompiler
|
platform/dbops/archive/databases_old/data/home/x/india-h200-1-workspace/claude-code-router/node_modules/@fastify/cors/.github/dependabot.yml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version: 2
|
| 2 |
+
updates:
|
| 3 |
+
- package-ecosystem: "github-actions"
|
| 4 |
+
directory: "/"
|
| 5 |
+
schedule:
|
| 6 |
+
interval: "monthly"
|
| 7 |
+
open-pull-requests-limit: 10
|
| 8 |
+
|
| 9 |
+
- package-ecosystem: "npm"
|
| 10 |
+
directory: "/"
|
| 11 |
+
schedule:
|
| 12 |
+
interval: "monthly"
|
| 13 |
+
open-pull-requests-limit: 10
|