@struct-ai/sdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -3
- package/dist/commonjs/core.d.ts +2 -0
- package/dist/commonjs/core.js +53 -7
- package/dist/esm/core.d.ts +2 -0
- package/dist/esm/core.js +54 -8
- package/package.json +21 -21
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/content-capture.d.ts +0 -10
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/context.d.ts +0 -30
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/core.d.ts +0 -120
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/events.d.ts +0 -12
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/index.d.ts +0 -6
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/integrations/anthropic-content.d.ts +0 -24
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/integrations/anthropic.d.ts +0 -34
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/integrations/index.d.ts +0 -5
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/integrations/langchain-callback.d.ts +0 -134
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/integrations/langchain-content.d.ts +0 -35
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/integrations/langchain.d.ts +0 -11
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/package.json +0 -3
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/semconv.d.ts +0 -54
- package/dist/node_modules/@struct-ai/sdk/dist/commonjs/truncation.d.ts +0 -10
- package/dist/node_modules/@struct-ai/sdk/dist/esm/content-capture.d.ts +0 -10
- package/dist/node_modules/@struct-ai/sdk/dist/esm/context.d.ts +0 -30
- package/dist/node_modules/@struct-ai/sdk/dist/esm/core.d.ts +0 -120
- package/dist/node_modules/@struct-ai/sdk/dist/esm/events.d.ts +0 -12
- package/dist/node_modules/@struct-ai/sdk/dist/esm/index.d.ts +0 -6
- package/dist/node_modules/@struct-ai/sdk/dist/esm/integrations/anthropic-content.d.ts +0 -24
- package/dist/node_modules/@struct-ai/sdk/dist/esm/integrations/anthropic.d.ts +0 -34
- package/dist/node_modules/@struct-ai/sdk/dist/esm/integrations/index.d.ts +0 -5
- package/dist/node_modules/@struct-ai/sdk/dist/esm/integrations/langchain-callback.d.ts +0 -134
- package/dist/node_modules/@struct-ai/sdk/dist/esm/integrations/langchain-content.d.ts +0 -35
- package/dist/node_modules/@struct-ai/sdk/dist/esm/integrations/langchain.d.ts +0 -11
- package/dist/node_modules/@struct-ai/sdk/dist/esm/package.json +0 -3
- package/dist/node_modules/@struct-ai/sdk/dist/esm/semconv.d.ts +0 -54
- package/dist/node_modules/@struct-ai/sdk/dist/esm/truncation.d.ts +0 -10
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/dist/commonjs/package.json +0 -3
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/dist/esm/package.json +0 -3
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/package.json +0 -103
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/package.json +0 -103
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/anthropic/package.json +0 -118
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/package.json +0 -916
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/langgraph/package.json +0 -188
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/openai/package.json +0 -105
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/api/package.json +0 -96
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/api-logs/package.json +0 -91
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/core/package.json +0 -96
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json +0 -108
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json +0 -105
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/resources/package.json +0 -100
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/sdk-logs/package.json +0 -109
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/sdk-trace-base/package.json +0 -100
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/sdk-trace-node/package.json +0 -76
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/package.json +0 -140
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/nock/package.json +0 -89
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/tshy/package.json +0 -81
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/tsx/package.json +0 -68
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/typescript/package.json +0 -120
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/vitest/package.json +0 -239
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/node_modules/zod/package.json +0 -135
- package/dist/node_modules/@struct-ai/sdk/dist/node_modules/@struct-ai/sdk/package.json +0 -103
- package/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/core.d.ts +0 -244
- package/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/error.d.ts +0 -54
- package/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/index.d.ts +0 -188
- package/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/package.json +0 -103
- package/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/pagination.d.ts +0 -26
- package/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/resource.d.ts +0 -6
- package/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/streaming.d.ts +0 -41
- package/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/uploads.d.ts +0 -75
- package/dist/node_modules/@struct-ai/sdk/node_modules/@anthropic-ai/sdk/version.d.ts +0 -2
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/anthropic/experimental.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/anthropic/index.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/anthropic/package.json +0 -118
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/agents.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/caches.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/chat_history.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/context.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/documents.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/embeddings.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/example_selectors.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/index.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/indexing.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/load.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/memory.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/messages.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/output_parsers.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/outputs.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/package.json +0 -916
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/prompt_values.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/prompts.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/retrievers.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/runnables.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/singletons.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/stores.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/structured_query.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/tools.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/core/vectorstores.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/langgraph/index.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/langgraph/package.json +0 -188
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/langgraph/prebuilt.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/langgraph/pregel.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/langgraph/remote.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/langgraph/web.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/langgraph/zod.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/openai/index.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/@langchain/openai/package.json +0 -105
- package/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/api/package.json +0 -96
- package/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/api-logs/package.json +0 -91
- package/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/core/package.json +0 -96
- package/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/exporter-logs-otlp-proto/package.json +0 -108
- package/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/exporter-trace-otlp-proto/package.json +0 -105
- package/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/resources/package.json +0 -100
- package/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/sdk-logs/package.json +0 -109
- package/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/sdk-trace-base/package.json +0 -100
- package/dist/node_modules/@struct-ai/sdk/node_modules/@opentelemetry/sdk-trace-node/package.json +0 -76
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/assert.d.ts +0 -1062
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/async_hooks.d.ts +0 -605
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/buffer.buffer.d.ts +0 -471
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/buffer.d.ts +0 -1936
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/child_process.d.ts +0 -1475
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/cluster.d.ts +0 -577
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/console.d.ts +0 -452
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/constants.d.ts +0 -21
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/crypto.d.ts +0 -4590
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/dgram.d.ts +0 -597
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/dns.d.ts +0 -871
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/domain.d.ts +0 -170
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/events.d.ts +0 -977
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/fs.d.ts +0 -4375
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/globals.d.ts +0 -172
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/globals.typedarray.d.ts +0 -38
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/http.d.ts +0 -2049
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/http2.d.ts +0 -2631
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/https.d.ts +0 -578
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/index.d.ts +0 -93
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/inspector.generated.d.ts +0 -3966
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/module.d.ts +0 -539
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/net.d.ts +0 -1031
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/os.d.ts +0 -506
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/package.json +0 -140
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/path.d.ts +0 -200
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/perf_hooks.d.ts +0 -961
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/process.d.ts +0 -1961
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/punycode.d.ts +0 -117
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/querystring.d.ts +0 -152
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/readline.d.ts +0 -589
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/repl.d.ts +0 -430
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/sea.d.ts +0 -153
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/stream.d.ts +0 -1698
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/test.d.ts +0 -1787
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/timers.d.ts +0 -286
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/tls.d.ts +0 -1259
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/trace_events.d.ts +0 -197
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/tty.d.ts +0 -208
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/url.d.ts +0 -964
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/util.d.ts +0 -2331
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/v8.d.ts +0 -809
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/vm.d.ts +0 -1001
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/wasi.d.ts +0 -181
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/worker_threads.d.ts +0 -715
- package/dist/node_modules/@struct-ai/sdk/node_modules/@types/node/zlib.d.ts +0 -598
- package/dist/node_modules/@struct-ai/sdk/node_modules/nock/package.json +0 -89
- package/dist/node_modules/@struct-ai/sdk/node_modules/tshy/package.json +0 -81
- package/dist/node_modules/@struct-ai/sdk/node_modules/tsx/package.json +0 -68
- package/dist/node_modules/@struct-ai/sdk/node_modules/typescript/package.json +0 -120
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/config.d.ts +0 -3
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/coverage.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/environments.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/globals.d.ts +0 -22
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/import-meta.d.ts +0 -5
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/importMeta.d.ts +0 -4
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/jsdom.d.ts +0 -6
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/mocker.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/node.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/optional-runtime-types.d.ts +0 -6
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/optional-types.d.ts +0 -7
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/package.json +0 -239
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/reporters.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/runners.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/snapshot.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/suite.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/vitest/worker.d.ts +0 -1
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/index.d.ts +0 -4
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/locales/package.json +0 -7
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/mini/package.json +0 -7
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/package.json +0 -135
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/v3/package.json +0 -7
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/v4/classic/package.json +0 -7
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/v4/core/package.json +0 -7
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/v4/locales/package.json +0 -7
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/v4/mini/package.json +0 -7
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/v4/package.json +0 -7
- package/dist/node_modules/@struct-ai/sdk/node_modules/zod/v4-mini/package.json +0 -7
- package/dist/node_modules/@struct-ai/sdk/package.json +0 -103
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Stream } from "./streaming.js";
|
|
4
|
-
import { APIError } from "./error.js";
|
|
5
|
-
import { type Readable, type Agent, type RequestInfo, type RequestInit, type Response, type HeadersInit } from "./_shims/index.js";
|
|
6
|
-
export { type Response };
|
|
7
|
-
import { BlobLike } from "./uploads.js";
|
|
8
|
-
export { maybeMultipartFormRequestOptions, multipartFormRequestOptions, createForm, type Uploadable, } from "./uploads.js";
|
|
9
|
-
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
10
|
-
type PromiseOrValue<T> = T | Promise<T>;
|
|
11
|
-
type APIResponseProps = {
|
|
12
|
-
response: Response;
|
|
13
|
-
options: FinalRequestOptions;
|
|
14
|
-
controller: AbortController;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* A subclass of `Promise` providing additional helper methods
|
|
18
|
-
* for interacting with the SDK.
|
|
19
|
-
*/
|
|
20
|
-
export declare class APIPromise<T> extends Promise<T> {
|
|
21
|
-
private responsePromise;
|
|
22
|
-
private parseResponse;
|
|
23
|
-
private parsedPromise;
|
|
24
|
-
constructor(responsePromise: Promise<APIResponseProps>, parseResponse?: (props: APIResponseProps) => PromiseOrValue<T>);
|
|
25
|
-
_thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
|
|
26
|
-
/**
|
|
27
|
-
* Gets the raw `Response` instance instead of parsing the response
|
|
28
|
-
* data.
|
|
29
|
-
*
|
|
30
|
-
* If you want to parse the response body but still get the `Response`
|
|
31
|
-
* instance, you can use {@link withResponse()}.
|
|
32
|
-
*
|
|
33
|
-
* 👋 Getting the wrong TypeScript type for `Response`?
|
|
34
|
-
* Try setting `"moduleResolution": "NodeNext"` if you can,
|
|
35
|
-
* or add one of these imports before your first `import … from '@anthropic-ai/sdk'`:
|
|
36
|
-
* - `import '@anthropic-ai/sdk/shims/node'` (if you're running on Node)
|
|
37
|
-
* - `import '@anthropic-ai/sdk/shims/web'` (otherwise)
|
|
38
|
-
*/
|
|
39
|
-
asResponse(): Promise<Response>;
|
|
40
|
-
/**
|
|
41
|
-
* Gets the parsed response data and the raw `Response` instance.
|
|
42
|
-
*
|
|
43
|
-
* If you just want to get the raw `Response` instance without parsing it,
|
|
44
|
-
* you can use {@link asResponse()}.
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* 👋 Getting the wrong TypeScript type for `Response`?
|
|
48
|
-
* Try setting `"moduleResolution": "NodeNext"` if you can,
|
|
49
|
-
* or add one of these imports before your first `import … from '@anthropic-ai/sdk'`:
|
|
50
|
-
* - `import '@anthropic-ai/sdk/shims/node'` (if you're running on Node)
|
|
51
|
-
* - `import '@anthropic-ai/sdk/shims/web'` (otherwise)
|
|
52
|
-
*/
|
|
53
|
-
withResponse(): Promise<{
|
|
54
|
-
data: T;
|
|
55
|
-
response: Response;
|
|
56
|
-
}>;
|
|
57
|
-
private parse;
|
|
58
|
-
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
|
|
59
|
-
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
|
60
|
-
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
|
61
|
-
}
|
|
62
|
-
export declare abstract class APIClient {
|
|
63
|
-
baseURL: string;
|
|
64
|
-
maxRetries: number;
|
|
65
|
-
timeout: number;
|
|
66
|
-
httpAgent: Agent | undefined;
|
|
67
|
-
private fetch;
|
|
68
|
-
protected idempotencyHeader?: string;
|
|
69
|
-
constructor({ baseURL, maxRetries, timeout, // 10 minutes
|
|
70
|
-
httpAgent, fetch: overridenFetch, }: {
|
|
71
|
-
baseURL: string;
|
|
72
|
-
maxRetries?: number | undefined;
|
|
73
|
-
timeout: number | undefined;
|
|
74
|
-
httpAgent: Agent | undefined;
|
|
75
|
-
fetch: Fetch | undefined;
|
|
76
|
-
});
|
|
77
|
-
protected authHeaders(opts: FinalRequestOptions): Headers;
|
|
78
|
-
/**
|
|
79
|
-
* Override this to add your own default headers, for example:
|
|
80
|
-
*
|
|
81
|
-
* {
|
|
82
|
-
* ...super.defaultHeaders(),
|
|
83
|
-
* Authorization: 'Bearer 123',
|
|
84
|
-
* }
|
|
85
|
-
*/
|
|
86
|
-
protected defaultHeaders(opts: FinalRequestOptions): Headers;
|
|
87
|
-
protected abstract defaultQuery(): DefaultQuery | undefined;
|
|
88
|
-
/**
|
|
89
|
-
* Override this to add your own headers validation:
|
|
90
|
-
*/
|
|
91
|
-
protected validateHeaders(headers: Headers, customHeaders: Headers): void;
|
|
92
|
-
protected defaultIdempotencyKey(): string;
|
|
93
|
-
get<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp>;
|
|
94
|
-
post<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp>;
|
|
95
|
-
patch<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp>;
|
|
96
|
-
put<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp>;
|
|
97
|
-
delete<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp>;
|
|
98
|
-
private methodRequest;
|
|
99
|
-
getAPIList<Item, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(path: string, Page: new (...args: any[]) => PageClass, opts?: RequestOptions<any>): PagePromise<PageClass, Item>;
|
|
100
|
-
private calculateContentLength;
|
|
101
|
-
buildRequest<Req>(options: FinalRequestOptions<Req>, { retryCount }?: {
|
|
102
|
-
retryCount?: number;
|
|
103
|
-
}): {
|
|
104
|
-
req: RequestInit;
|
|
105
|
-
url: string;
|
|
106
|
-
timeout: number;
|
|
107
|
-
};
|
|
108
|
-
private buildHeaders;
|
|
109
|
-
/**
|
|
110
|
-
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
111
|
-
*/
|
|
112
|
-
protected prepareOptions(options: FinalRequestOptions): Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* Used as a callback for mutating the given `RequestInit` object.
|
|
115
|
-
*
|
|
116
|
-
* This is useful for cases where you want to add certain headers based off of
|
|
117
|
-
* the request properties, e.g. `method` or `url`.
|
|
118
|
-
*/
|
|
119
|
-
protected prepareRequest(request: RequestInit, { url, options }: {
|
|
120
|
-
url: string;
|
|
121
|
-
options: FinalRequestOptions;
|
|
122
|
-
}): Promise<void>;
|
|
123
|
-
protected parseHeaders(headers: HeadersInit | null | undefined): Record<string, string>;
|
|
124
|
-
protected makeStatusError(status: number | undefined, error: Object | undefined, message: string | undefined, headers: Headers | undefined): APIError;
|
|
125
|
-
request<Req, Rsp>(options: PromiseOrValue<FinalRequestOptions<Req>>, remainingRetries?: number | null): APIPromise<Rsp>;
|
|
126
|
-
private makeRequest;
|
|
127
|
-
requestAPIList<Item = unknown, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass, options: FinalRequestOptions): PagePromise<PageClass, Item>;
|
|
128
|
-
buildURL<Req>(path: string, query: Req | null | undefined): string;
|
|
129
|
-
protected stringifyQuery(query: Record<string, unknown>): string;
|
|
130
|
-
fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
|
|
131
|
-
protected getRequestClient(): RequestClient;
|
|
132
|
-
private shouldRetry;
|
|
133
|
-
private retryRequest;
|
|
134
|
-
private calculateDefaultRetryTimeoutMillis;
|
|
135
|
-
private getUserAgent;
|
|
136
|
-
}
|
|
137
|
-
export type PageInfo = {
|
|
138
|
-
url: URL;
|
|
139
|
-
} | {
|
|
140
|
-
params: Record<string, unknown> | null;
|
|
141
|
-
};
|
|
142
|
-
export declare abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
143
|
-
#private;
|
|
144
|
-
protected options: FinalRequestOptions;
|
|
145
|
-
protected response: Response;
|
|
146
|
-
protected body: unknown;
|
|
147
|
-
constructor(client: APIClient, response: Response, body: unknown, options: FinalRequestOptions);
|
|
148
|
-
/**
|
|
149
|
-
* @deprecated Use nextPageInfo instead
|
|
150
|
-
*/
|
|
151
|
-
abstract nextPageParams(): Partial<Record<string, unknown>> | null;
|
|
152
|
-
abstract nextPageInfo(): PageInfo | null;
|
|
153
|
-
abstract getPaginatedItems(): Item[];
|
|
154
|
-
hasNextPage(): boolean;
|
|
155
|
-
getNextPage(): Promise<this>;
|
|
156
|
-
iterPages(): AsyncGenerator<AbstractPage<Item>, void, unknown>;
|
|
157
|
-
[Symbol.asyncIterator](): AsyncGenerator<Awaited<Item>, void, unknown>;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
|
161
|
-
*
|
|
162
|
-
* It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
|
|
163
|
-
*
|
|
164
|
-
* for await (const item of client.items.list()) {
|
|
165
|
-
* console.log(item)
|
|
166
|
-
* }
|
|
167
|
-
*/
|
|
168
|
-
export declare class PagePromise<PageClass extends AbstractPage<Item>, Item = ReturnType<PageClass['getPaginatedItems']>[number]> extends APIPromise<PageClass> implements AsyncIterable<Item> {
|
|
169
|
-
constructor(client: APIClient, request: Promise<APIResponseProps>, Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass);
|
|
170
|
-
/**
|
|
171
|
-
* Allow auto-paginating iteration on an unawaited list call, eg:
|
|
172
|
-
*
|
|
173
|
-
* for await (const item of client.items.list()) {
|
|
174
|
-
* console.log(item)
|
|
175
|
-
* }
|
|
176
|
-
*/
|
|
177
|
-
[Symbol.asyncIterator](): AsyncGenerator<Awaited<Item>, void, unknown>;
|
|
178
|
-
}
|
|
179
|
-
export declare const createResponseHeaders: (headers: Awaited<ReturnType<Fetch>>['headers']) => Record<string, string>;
|
|
180
|
-
type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
181
|
-
export type RequestClient = {
|
|
182
|
-
fetch: Fetch;
|
|
183
|
-
};
|
|
184
|
-
export type Headers = Record<string, string | null | undefined>;
|
|
185
|
-
export type DefaultQuery = Record<string, string | undefined>;
|
|
186
|
-
export type KeysEnum<T> = {
|
|
187
|
-
[P in keyof Required<T>]: true;
|
|
188
|
-
};
|
|
189
|
-
export type RequestOptions<Req = unknown | Record<string, unknown> | Readable | BlobLike | ArrayBufferView | ArrayBuffer> = {
|
|
190
|
-
method?: HTTPMethod;
|
|
191
|
-
path?: string;
|
|
192
|
-
query?: Req | undefined;
|
|
193
|
-
body?: Req | null | undefined;
|
|
194
|
-
headers?: Headers | undefined;
|
|
195
|
-
maxRetries?: number;
|
|
196
|
-
stream?: boolean | undefined;
|
|
197
|
-
timeout?: number;
|
|
198
|
-
httpAgent?: Agent;
|
|
199
|
-
signal?: AbortSignal | undefined | null;
|
|
200
|
-
idempotencyKey?: string;
|
|
201
|
-
__binaryRequest?: boolean | undefined;
|
|
202
|
-
__binaryResponse?: boolean | undefined;
|
|
203
|
-
__streamClass?: typeof Stream;
|
|
204
|
-
};
|
|
205
|
-
export declare const isRequestOptions: (obj: unknown) => obj is RequestOptions<unknown>;
|
|
206
|
-
export type FinalRequestOptions<Req = unknown | Record<string, unknown> | Readable | DataView> = RequestOptions<Req> & {
|
|
207
|
-
method: HTTPMethod;
|
|
208
|
-
path: string;
|
|
209
|
-
};
|
|
210
|
-
export declare const safeJSON: (text: string) => any;
|
|
211
|
-
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
212
|
-
export declare const castToError: (err: any) => Error;
|
|
213
|
-
export declare const ensurePresent: <T>(value: T | null | undefined) => T;
|
|
214
|
-
/**
|
|
215
|
-
* Read an environment variable.
|
|
216
|
-
*
|
|
217
|
-
* Trims beginning and trailing whitespace.
|
|
218
|
-
*
|
|
219
|
-
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
|
220
|
-
*/
|
|
221
|
-
export declare const readEnv: (env: string) => string | undefined;
|
|
222
|
-
export declare const coerceInteger: (value: unknown) => number;
|
|
223
|
-
export declare const coerceFloat: (value: unknown) => number;
|
|
224
|
-
export declare const coerceBoolean: (value: unknown) => boolean;
|
|
225
|
-
export declare const maybeCoerceInteger: (value: unknown) => number | undefined;
|
|
226
|
-
export declare const maybeCoerceFloat: (value: unknown) => number | undefined;
|
|
227
|
-
export declare const maybeCoerceBoolean: (value: unknown) => boolean | undefined;
|
|
228
|
-
export declare function isEmptyObj(obj: Object | null | undefined): boolean;
|
|
229
|
-
export declare function hasOwn(obj: Object, key: string): boolean;
|
|
230
|
-
export declare function debug(action: string, ...args: any[]): void;
|
|
231
|
-
export declare const isRunningInBrowser: () => boolean;
|
|
232
|
-
export interface HeadersProtocol {
|
|
233
|
-
get: (header: string) => string | null | undefined;
|
|
234
|
-
}
|
|
235
|
-
export type HeadersLike = Record<string, string | string[] | undefined> | HeadersProtocol;
|
|
236
|
-
export declare const isHeadersProtocol: (headers: any) => headers is HeadersProtocol;
|
|
237
|
-
export declare const getRequiredHeader: (headers: HeadersLike | Headers, header: string) => string;
|
|
238
|
-
export declare const getHeader: (headers: HeadersLike | Headers, header: string) => string | undefined;
|
|
239
|
-
/**
|
|
240
|
-
* Encodes a string to Base64 format.
|
|
241
|
-
*/
|
|
242
|
-
export declare const toBase64: (str: string | null | undefined) => string;
|
|
243
|
-
export declare function isObj(obj: unknown): obj is Record<string, unknown>;
|
|
244
|
-
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Headers } from "./core.js";
|
|
2
|
-
export declare class AnthropicError extends Error {
|
|
3
|
-
}
|
|
4
|
-
export declare class APIError extends AnthropicError {
|
|
5
|
-
readonly status: number | undefined;
|
|
6
|
-
readonly headers: Headers | undefined;
|
|
7
|
-
readonly error: Object | undefined;
|
|
8
|
-
readonly request_id: string | null | undefined;
|
|
9
|
-
constructor(status: number | undefined, error: Object | undefined, message: string | undefined, headers: Headers | undefined);
|
|
10
|
-
private static makeMessage;
|
|
11
|
-
static generate(status: number | undefined, errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined): APIError;
|
|
12
|
-
}
|
|
13
|
-
export declare class APIUserAbortError extends APIError {
|
|
14
|
-
readonly status: undefined;
|
|
15
|
-
constructor({ message }?: {
|
|
16
|
-
message?: string;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
export declare class APIConnectionError extends APIError {
|
|
20
|
-
readonly status: undefined;
|
|
21
|
-
constructor({ message, cause }: {
|
|
22
|
-
message?: string | undefined;
|
|
23
|
-
cause?: Error | undefined;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
export declare class APIConnectionTimeoutError extends APIConnectionError {
|
|
27
|
-
constructor({ message }?: {
|
|
28
|
-
message?: string;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
export declare class BadRequestError extends APIError {
|
|
32
|
-
readonly status: 400;
|
|
33
|
-
}
|
|
34
|
-
export declare class AuthenticationError extends APIError {
|
|
35
|
-
readonly status: 401;
|
|
36
|
-
}
|
|
37
|
-
export declare class PermissionDeniedError extends APIError {
|
|
38
|
-
readonly status: 403;
|
|
39
|
-
}
|
|
40
|
-
export declare class NotFoundError extends APIError {
|
|
41
|
-
readonly status: 404;
|
|
42
|
-
}
|
|
43
|
-
export declare class ConflictError extends APIError {
|
|
44
|
-
readonly status: 409;
|
|
45
|
-
}
|
|
46
|
-
export declare class UnprocessableEntityError extends APIError {
|
|
47
|
-
readonly status: 422;
|
|
48
|
-
}
|
|
49
|
-
export declare class RateLimitError extends APIError {
|
|
50
|
-
readonly status: 429;
|
|
51
|
-
}
|
|
52
|
-
export declare class InternalServerError extends APIError {
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import * as Errors from "./error.js";
|
|
2
|
-
import * as Uploads from "./uploads.js";
|
|
3
|
-
import { type Agent } from "./_shims/index.js";
|
|
4
|
-
import * as Core from "./core.js";
|
|
5
|
-
import * as Pagination from "./pagination.js";
|
|
6
|
-
import * as API from "./resources/index.js";
|
|
7
|
-
export interface ClientOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Defaults to process.env['ANTHROPIC_API_KEY'].
|
|
10
|
-
*/
|
|
11
|
-
apiKey?: string | null | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Defaults to process.env['ANTHROPIC_AUTH_TOKEN'].
|
|
14
|
-
*/
|
|
15
|
-
authToken?: string | null | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
18
|
-
*
|
|
19
|
-
* Defaults to process.env['ANTHROPIC_BASE_URL'].
|
|
20
|
-
*/
|
|
21
|
-
baseURL?: string | null | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* The maximum amount of time (in milliseconds) that the client should wait for a response
|
|
24
|
-
* from the server before timing out a single request.
|
|
25
|
-
*
|
|
26
|
-
* Note that request timeouts are retried by default, so in a worst-case scenario you may wait
|
|
27
|
-
* much longer than this timeout before the promise succeeds or fails.
|
|
28
|
-
*/
|
|
29
|
-
timeout?: number;
|
|
30
|
-
/**
|
|
31
|
-
* An HTTP agent used to manage HTTP(S) connections.
|
|
32
|
-
*
|
|
33
|
-
* If not provided, an agent will be constructed by default in the Node.js environment,
|
|
34
|
-
* otherwise no agent is used.
|
|
35
|
-
*/
|
|
36
|
-
httpAgent?: Agent;
|
|
37
|
-
/**
|
|
38
|
-
* Specify a custom `fetch` function implementation.
|
|
39
|
-
*
|
|
40
|
-
* If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is
|
|
41
|
-
* defined globally.
|
|
42
|
-
*/
|
|
43
|
-
fetch?: Core.Fetch | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* The maximum number of times that the client will retry a request in case of a
|
|
46
|
-
* temporary failure, like a network error or a 5XX error from the server.
|
|
47
|
-
*
|
|
48
|
-
* @default 2
|
|
49
|
-
*/
|
|
50
|
-
maxRetries?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Default headers to include with every request to the API.
|
|
53
|
-
*
|
|
54
|
-
* These can be removed in individual requests by explicitly setting the
|
|
55
|
-
* header to `undefined` or `null` in request options.
|
|
56
|
-
*/
|
|
57
|
-
defaultHeaders?: Core.Headers;
|
|
58
|
-
/**
|
|
59
|
-
* Default query parameters to include with every request to the API.
|
|
60
|
-
*
|
|
61
|
-
* These can be removed in individual requests by explicitly setting the
|
|
62
|
-
* param to `undefined` in request options.
|
|
63
|
-
*/
|
|
64
|
-
defaultQuery?: Core.DefaultQuery;
|
|
65
|
-
/**
|
|
66
|
-
* By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
67
|
-
* Only set this option to `true` if you understand the risks and have appropriate mitigations in place.
|
|
68
|
-
*/
|
|
69
|
-
dangerouslyAllowBrowser?: boolean;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* API Client for interfacing with the Anthropic API.
|
|
73
|
-
*/
|
|
74
|
-
export declare class Anthropic extends Core.APIClient {
|
|
75
|
-
apiKey: string | null;
|
|
76
|
-
authToken: string | null;
|
|
77
|
-
private _options;
|
|
78
|
-
/**
|
|
79
|
-
* API Client for interfacing with the Anthropic API.
|
|
80
|
-
*
|
|
81
|
-
* @param {string | null | undefined} [opts.apiKey=process.env['ANTHROPIC_API_KEY'] ?? null]
|
|
82
|
-
* @param {string | null | undefined} [opts.authToken=process.env['ANTHROPIC_AUTH_TOKEN'] ?? null]
|
|
83
|
-
* @param {string} [opts.baseURL=process.env['ANTHROPIC_BASE_URL'] ?? https://api.anthropic.com] - Override the default base URL for the API.
|
|
84
|
-
* @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
85
|
-
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
86
|
-
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
87
|
-
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
88
|
-
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
89
|
-
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
90
|
-
* @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
91
|
-
*/
|
|
92
|
-
constructor({ baseURL, apiKey, authToken, ...opts }?: ClientOptions);
|
|
93
|
-
completions: API.Completions;
|
|
94
|
-
messages: API.Messages;
|
|
95
|
-
beta: API.Beta;
|
|
96
|
-
protected defaultQuery(): Core.DefaultQuery | undefined;
|
|
97
|
-
protected defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
98
|
-
protected validateHeaders(headers: Core.Headers, customHeaders: Core.Headers): void;
|
|
99
|
-
protected authHeaders(opts: Core.FinalRequestOptions): Core.Headers;
|
|
100
|
-
protected apiKeyAuth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
101
|
-
protected bearerAuth(opts: Core.FinalRequestOptions): Core.Headers;
|
|
102
|
-
static Anthropic: typeof Anthropic;
|
|
103
|
-
static HUMAN_PROMPT: string;
|
|
104
|
-
static AI_PROMPT: string;
|
|
105
|
-
static DEFAULT_TIMEOUT: number;
|
|
106
|
-
static AnthropicError: typeof Errors.AnthropicError;
|
|
107
|
-
static APIError: typeof Errors.APIError;
|
|
108
|
-
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
109
|
-
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
110
|
-
static APIUserAbortError: typeof Errors.APIUserAbortError;
|
|
111
|
-
static NotFoundError: typeof Errors.NotFoundError;
|
|
112
|
-
static ConflictError: typeof Errors.ConflictError;
|
|
113
|
-
static RateLimitError: typeof Errors.RateLimitError;
|
|
114
|
-
static BadRequestError: typeof Errors.BadRequestError;
|
|
115
|
-
static AuthenticationError: typeof Errors.AuthenticationError;
|
|
116
|
-
static InternalServerError: typeof Errors.InternalServerError;
|
|
117
|
-
static PermissionDeniedError: typeof Errors.PermissionDeniedError;
|
|
118
|
-
static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
|
|
119
|
-
static toFile: typeof Uploads.toFile;
|
|
120
|
-
static fileFromPath: typeof Uploads.fileFromPath;
|
|
121
|
-
}
|
|
122
|
-
export declare const HUMAN_PROMPT: string, AI_PROMPT: string;
|
|
123
|
-
export declare const AnthropicError: typeof Errors.AnthropicError, APIError: typeof Errors.APIError, APIConnectionError: typeof Errors.APIConnectionError, APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError, APIUserAbortError: typeof Errors.APIUserAbortError, NotFoundError: typeof Errors.NotFoundError, ConflictError: typeof Errors.ConflictError, RateLimitError: typeof Errors.RateLimitError, BadRequestError: typeof Errors.BadRequestError, AuthenticationError: typeof Errors.AuthenticationError, InternalServerError: typeof Errors.InternalServerError, PermissionDeniedError: typeof Errors.PermissionDeniedError, UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
|
|
124
|
-
export import toFile = Uploads.toFile;
|
|
125
|
-
export import fileFromPath = Uploads.fileFromPath;
|
|
126
|
-
export declare namespace Anthropic {
|
|
127
|
-
export import RequestOptions = Core.RequestOptions;
|
|
128
|
-
export import Page = Pagination.Page;
|
|
129
|
-
export import PageParams = Pagination.PageParams;
|
|
130
|
-
export import PageResponse = Pagination.PageResponse;
|
|
131
|
-
export import Completions = API.Completions;
|
|
132
|
-
export import Completion = API.Completion;
|
|
133
|
-
export import CompletionCreateParams = API.CompletionCreateParams;
|
|
134
|
-
export import CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
|
|
135
|
-
export import CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
|
|
136
|
-
export import Messages = API.Messages;
|
|
137
|
-
export import ContentBlock = API.ContentBlock;
|
|
138
|
-
export import ContentBlockDeltaEvent = API.ContentBlockDeltaEvent;
|
|
139
|
-
export import ContentBlockStartEvent = API.ContentBlockStartEvent;
|
|
140
|
-
export import ContentBlockStopEvent = API.ContentBlockStopEvent;
|
|
141
|
-
export import ImageBlockParam = API.ImageBlockParam;
|
|
142
|
-
export import InputJSONDelta = API.InputJSONDelta;
|
|
143
|
-
export import Message = API.Message;
|
|
144
|
-
export import MessageDeltaEvent = API.MessageDeltaEvent;
|
|
145
|
-
export import MessageDeltaUsage = API.MessageDeltaUsage;
|
|
146
|
-
export import MessageParam = API.MessageParam;
|
|
147
|
-
export import MessageStartEvent = API.MessageStartEvent;
|
|
148
|
-
export import MessageStopEvent = API.MessageStopEvent;
|
|
149
|
-
export import MessageStreamEvent = API.MessageStreamEvent;
|
|
150
|
-
export import Metadata = API.Metadata;
|
|
151
|
-
export import Model = API.Model;
|
|
152
|
-
export import RawContentBlockDeltaEvent = API.RawContentBlockDeltaEvent;
|
|
153
|
-
export import RawContentBlockStartEvent = API.RawContentBlockStartEvent;
|
|
154
|
-
export import RawContentBlockStopEvent = API.RawContentBlockStopEvent;
|
|
155
|
-
export import RawMessageDeltaEvent = API.RawMessageDeltaEvent;
|
|
156
|
-
export import RawMessageStartEvent = API.RawMessageStartEvent;
|
|
157
|
-
export import RawMessageStopEvent = API.RawMessageStopEvent;
|
|
158
|
-
export import RawMessageStreamEvent = API.RawMessageStreamEvent;
|
|
159
|
-
export import TextBlock = API.TextBlock;
|
|
160
|
-
export import TextBlockParam = API.TextBlockParam;
|
|
161
|
-
export import TextDelta = API.TextDelta;
|
|
162
|
-
export import Tool = API.Tool;
|
|
163
|
-
export import ToolChoice = API.ToolChoice;
|
|
164
|
-
export import ToolChoiceAny = API.ToolChoiceAny;
|
|
165
|
-
export import ToolChoiceAuto = API.ToolChoiceAuto;
|
|
166
|
-
export import ToolChoiceTool = API.ToolChoiceTool;
|
|
167
|
-
export import ToolResultBlockParam = API.ToolResultBlockParam;
|
|
168
|
-
export import ToolUseBlock = API.ToolUseBlock;
|
|
169
|
-
export import ToolUseBlockParam = API.ToolUseBlockParam;
|
|
170
|
-
export import Usage = API.Usage;
|
|
171
|
-
export import MessageCreateParams = API.MessageCreateParams;
|
|
172
|
-
export import MessageCreateParamsNonStreaming = API.MessageCreateParamsNonStreaming;
|
|
173
|
-
export import MessageCreateParamsStreaming = API.MessageCreateParamsStreaming;
|
|
174
|
-
export import MessageStreamParams = API.MessageStreamParams;
|
|
175
|
-
export import Beta = API.Beta;
|
|
176
|
-
export import AnthropicBeta = API.AnthropicBeta;
|
|
177
|
-
export import BetaAPIError = API.BetaAPIError;
|
|
178
|
-
export import BetaAuthenticationError = API.BetaAuthenticationError;
|
|
179
|
-
export import BetaError = API.BetaError;
|
|
180
|
-
export import BetaErrorResponse = API.BetaErrorResponse;
|
|
181
|
-
export import BetaInvalidRequestError = API.BetaInvalidRequestError;
|
|
182
|
-
export import BetaNotFoundError = API.BetaNotFoundError;
|
|
183
|
-
export import BetaOverloadedError = API.BetaOverloadedError;
|
|
184
|
-
export import BetaPermissionError = API.BetaPermissionError;
|
|
185
|
-
export import BetaRateLimitError = API.BetaRateLimitError;
|
|
186
|
-
}
|
|
187
|
-
export default Anthropic;
|
|
188
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@anthropic-ai/sdk",
|
|
3
|
-
"version": "0.30.1",
|
|
4
|
-
"description": "The official TypeScript library for the Anthropic API",
|
|
5
|
-
"author": "Anthropic <support@anthropic.com>",
|
|
6
|
-
"types": "./index.d.ts",
|
|
7
|
-
"main": "./index.js",
|
|
8
|
-
"type": "commonjs",
|
|
9
|
-
"repository": "github:anthropics/anthropic-sdk-typescript",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"packageManager": "yarn@1.22.22",
|
|
12
|
-
"files": [
|
|
13
|
-
"*"
|
|
14
|
-
],
|
|
15
|
-
"private": false,
|
|
16
|
-
"scripts": {
|
|
17
|
-
"test": "./scripts/test",
|
|
18
|
-
"build": "./scripts/build-all",
|
|
19
|
-
"format": "prettier --write --cache --cache-strategy metadata . !dist",
|
|
20
|
-
"tsn": "ts-node -r tsconfig-paths/register",
|
|
21
|
-
"lint": "./scripts/lint",
|
|
22
|
-
"fix": "./scripts/format"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@types/node": "^18.11.18",
|
|
26
|
-
"@types/node-fetch": "^2.6.4",
|
|
27
|
-
"abort-controller": "^3.0.0",
|
|
28
|
-
"agentkeepalive": "^4.2.1",
|
|
29
|
-
"form-data-encoder": "1.7.2",
|
|
30
|
-
"formdata-node": "^4.3.2",
|
|
31
|
-
"node-fetch": "^2.6.7"
|
|
32
|
-
},
|
|
33
|
-
"sideEffects": [
|
|
34
|
-
"./_shims/index.js",
|
|
35
|
-
"./_shims/index.mjs",
|
|
36
|
-
"./shims/node.js",
|
|
37
|
-
"./shims/node.mjs",
|
|
38
|
-
"./shims/web.js",
|
|
39
|
-
"./shims/web.mjs"
|
|
40
|
-
],
|
|
41
|
-
"imports": {
|
|
42
|
-
"@anthropic-ai/sdk": ".",
|
|
43
|
-
"@anthropic-ai/sdk/*": "./src/*"
|
|
44
|
-
},
|
|
45
|
-
"exports": {
|
|
46
|
-
"./_shims/auto/*": {
|
|
47
|
-
"deno": {
|
|
48
|
-
"types": "./_shims/auto/*.d.ts",
|
|
49
|
-
"require": "./_shims/auto/*.js",
|
|
50
|
-
"default": "./_shims/auto/*.mjs"
|
|
51
|
-
},
|
|
52
|
-
"bun": {
|
|
53
|
-
"types": "./_shims/auto/*.d.ts",
|
|
54
|
-
"require": "./_shims/auto/*-bun.js",
|
|
55
|
-
"default": "./_shims/auto/*-bun.mjs"
|
|
56
|
-
},
|
|
57
|
-
"browser": {
|
|
58
|
-
"types": "./_shims/auto/*.d.ts",
|
|
59
|
-
"require": "./_shims/auto/*.js",
|
|
60
|
-
"default": "./_shims/auto/*.mjs"
|
|
61
|
-
},
|
|
62
|
-
"worker": {
|
|
63
|
-
"types": "./_shims/auto/*.d.ts",
|
|
64
|
-
"require": "./_shims/auto/*.js",
|
|
65
|
-
"default": "./_shims/auto/*.mjs"
|
|
66
|
-
},
|
|
67
|
-
"workerd": {
|
|
68
|
-
"types": "./_shims/auto/*.d.ts",
|
|
69
|
-
"require": "./_shims/auto/*.js",
|
|
70
|
-
"default": "./_shims/auto/*.mjs"
|
|
71
|
-
},
|
|
72
|
-
"node": {
|
|
73
|
-
"types": "./_shims/auto/*-node.d.ts",
|
|
74
|
-
"require": "./_shims/auto/*-node.js",
|
|
75
|
-
"default": "./_shims/auto/*-node.mjs"
|
|
76
|
-
},
|
|
77
|
-
"types": "./_shims/auto/*.d.ts",
|
|
78
|
-
"require": "./_shims/auto/*.js",
|
|
79
|
-
"default": "./_shims/auto/*.mjs"
|
|
80
|
-
},
|
|
81
|
-
".": {
|
|
82
|
-
"require": {
|
|
83
|
-
"types": "./index.d.ts",
|
|
84
|
-
"default": "./index.js"
|
|
85
|
-
},
|
|
86
|
-
"types": "./index.d.mts",
|
|
87
|
-
"default": "./index.mjs"
|
|
88
|
-
},
|
|
89
|
-
"./*.mjs": {
|
|
90
|
-
"types": "./*.d.ts",
|
|
91
|
-
"default": "./*.mjs"
|
|
92
|
-
},
|
|
93
|
-
"./*.js": {
|
|
94
|
-
"types": "./*.d.ts",
|
|
95
|
-
"default": "./*.js"
|
|
96
|
-
},
|
|
97
|
-
"./*": {
|
|
98
|
-
"types": "./*.d.ts",
|
|
99
|
-
"require": "./*.js",
|
|
100
|
-
"default": "./*.mjs"
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from "./core.js";
|
|
2
|
-
export interface PageResponse<Item> {
|
|
3
|
-
data: Array<Item>;
|
|
4
|
-
has_more: boolean;
|
|
5
|
-
first_id: string | null;
|
|
6
|
-
last_id: string | null;
|
|
7
|
-
}
|
|
8
|
-
export interface PageParams {
|
|
9
|
-
/**
|
|
10
|
-
* Number of items per page.
|
|
11
|
-
*/
|
|
12
|
-
limit?: number;
|
|
13
|
-
before_id?: string;
|
|
14
|
-
after_id?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare class Page<Item> extends AbstractPage<Item> implements PageResponse<Item> {
|
|
17
|
-
data: Array<Item>;
|
|
18
|
-
has_more: boolean;
|
|
19
|
-
first_id: string | null;
|
|
20
|
-
last_id: string | null;
|
|
21
|
-
constructor(client: APIClient, response: Response, body: PageResponse<Item>, options: FinalRequestOptions);
|
|
22
|
-
getPaginatedItems(): Item[];
|
|
23
|
-
nextPageParams(): Partial<PageParams> | null;
|
|
24
|
-
nextPageInfo(): PageInfo | null;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { ReadableStream, type Response } from "./_shims/index.js";
|
|
3
|
-
export type ServerSentEvent = {
|
|
4
|
-
event: string | null;
|
|
5
|
-
data: string;
|
|
6
|
-
raw: string[];
|
|
7
|
-
};
|
|
8
|
-
export declare class Stream<Item> implements AsyncIterable<Item> {
|
|
9
|
-
private iterator;
|
|
10
|
-
controller: AbortController;
|
|
11
|
-
constructor(iterator: () => AsyncIterator<Item>, controller: AbortController);
|
|
12
|
-
static fromSSEResponse<Item>(response: Response, controller: AbortController): Stream<Item>;
|
|
13
|
-
/**
|
|
14
|
-
* Generates a Stream from a newline-separated ReadableStream
|
|
15
|
-
* where each item is a JSON value.
|
|
16
|
-
*/
|
|
17
|
-
static fromReadableStream<Item>(readableStream: ReadableStream, controller: AbortController): Stream<Item>;
|
|
18
|
-
[Symbol.asyncIterator](): AsyncIterator<Item>;
|
|
19
|
-
/**
|
|
20
|
-
* Splits the stream into two streams which can be
|
|
21
|
-
* independently read from at different speeds.
|
|
22
|
-
*/
|
|
23
|
-
tee(): [Stream<Item>, Stream<Item>];
|
|
24
|
-
/**
|
|
25
|
-
* Converts this stream to a newline-separated ReadableStream of
|
|
26
|
-
* JSON stringified values in the stream
|
|
27
|
-
* which can be turned back into a Stream with `Stream.fromReadableStream()`.
|
|
28
|
-
*/
|
|
29
|
-
toReadableStream(): ReadableStream;
|
|
30
|
-
}
|
|
31
|
-
export declare function _iterSSEMessages(response: Response, controller: AbortController): AsyncGenerator<ServerSentEvent, void, unknown>;
|
|
32
|
-
/** This is an internal helper function that's just used for testing */
|
|
33
|
-
export declare function _decodeChunks(chunks: string[]): string[];
|
|
34
|
-
/**
|
|
35
|
-
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
36
|
-
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
37
|
-
*
|
|
38
|
-
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
39
|
-
*/
|
|
40
|
-
export declare function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
|
|
41
|
-
//# sourceMappingURL=streaming.d.ts.map
|