@anthropic-ai/sdk 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +27 -15
- package/core.d.ts +12 -8
- package/core.d.ts.map +1 -1
- package/core.js +20 -14
- package/core.js.map +1 -1
- package/core.mjs +20 -14
- package/core.mjs.map +1 -1
- package/error.d.ts +18 -24
- package/error.d.ts.map +1 -1
- package/error.js +1 -31
- package/error.js.map +1 -1
- package/error.mjs +1 -31
- package/error.mjs.map +1 -1
- package/index.d.mts +21 -8
- package/index.d.ts +21 -8
- package/index.d.ts.map +1 -1
- package/index.js +13 -8
- package/index.js.map +1 -1
- package/index.mjs +9 -6
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/beta.d.ts +14 -6
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +5 -4
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +5 -4
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/index.d.ts +2 -2
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +4 -3
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/messages/messages.d.ts +1 -1
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/models.d.ts +49 -0
- package/resources/beta/models.d.ts.map +1 -0
- package/resources/beta/models.js +30 -0
- package/resources/beta/models.js.map +1 -0
- package/resources/beta/models.mjs +25 -0
- package/resources/beta/models.mjs.map +1 -0
- package/resources/completions.d.ts +1 -1
- package/resources/completions.d.ts.map +1 -1
- package/resources/index.d.ts +4 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +20 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages/batches.d.ts +212 -0
- package/resources/messages/batches.d.ts.map +1 -0
- package/resources/messages/batches.js +71 -0
- package/resources/messages/batches.js.map +1 -0
- package/resources/messages/batches.mjs +66 -0
- package/resources/messages/batches.mjs.map +1 -0
- package/resources/messages/index.d.ts +3 -0
- package/resources/messages/index.d.ts.map +1 -0
- package/resources/messages/index.js +10 -0
- package/resources/messages/index.js.map +1 -0
- package/resources/{beta/prompt-caching → messages}/index.mjs +1 -1
- package/resources/messages/index.mjs.map +1 -0
- package/resources/{messages.d.ts → messages/messages.d.ts} +235 -9
- package/resources/messages/messages.d.ts.map +1 -0
- package/resources/messages/messages.js +76 -0
- package/resources/messages/messages.js.map +1 -0
- package/resources/{messages.mjs → messages/messages.mjs} +20 -3
- package/resources/messages/messages.mjs.map +1 -0
- package/resources/models.d.ts +49 -0
- package/resources/models.d.ts.map +1 -0
- package/resources/models.js +30 -0
- package/resources/models.js.map +1 -0
- package/resources/models.mjs +25 -0
- package/resources/models.mjs.map +1 -0
- package/resources/shared.d.ts +42 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/src/core.ts +52 -32
- package/src/error.ts +23 -39
- package/src/index.ts +72 -37
- package/src/resources/beta/beta.ts +28 -6
- package/src/resources/beta/index.ts +3 -1
- package/src/resources/beta/messages/messages.ts +1 -1
- package/src/resources/beta/models.ts +78 -0
- package/src/resources/completions.ts +1 -1
- package/src/resources/index.ts +11 -1
- package/src/resources/messages/batches.ts +298 -0
- package/src/resources/messages/index.ts +63 -0
- package/src/resources/{messages.ts → messages/messages.ts} +304 -10
- package/src/resources/models.ts +75 -0
- package/src/resources/shared.ts +72 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/lib/PromptCachingBetaMessageStream.d.ts +0 -96
- package/lib/PromptCachingBetaMessageStream.d.ts.map +0 -1
- package/lib/PromptCachingBetaMessageStream.js +0 -459
- package/lib/PromptCachingBetaMessageStream.js.map +0 -1
- package/lib/PromptCachingBetaMessageStream.mjs +0 -455
- package/lib/PromptCachingBetaMessageStream.mjs.map +0 -1
- package/resources/beta/prompt-caching/index.d.ts +0 -3
- package/resources/beta/prompt-caching/index.d.ts.map +0 -1
- package/resources/beta/prompt-caching/index.js +0 -9
- package/resources/beta/prompt-caching/index.js.map +0 -1
- package/resources/beta/prompt-caching/index.mjs.map +0 -1
- package/resources/beta/prompt-caching/messages.d.ts +0 -518
- package/resources/beta/prompt-caching/messages.d.ts.map +0 -1
- package/resources/beta/prompt-caching/messages.js +0 -29
- package/resources/beta/prompt-caching/messages.js.map +0 -1
- package/resources/beta/prompt-caching/messages.mjs +0 -25
- package/resources/beta/prompt-caching/messages.mjs.map +0 -1
- package/resources/beta/prompt-caching/prompt-caching.d.ts +0 -10
- package/resources/beta/prompt-caching/prompt-caching.d.ts.map +0 -1
- package/resources/beta/prompt-caching/prompt-caching.js +0 -39
- package/resources/beta/prompt-caching/prompt-caching.js.map +0 -1
- package/resources/beta/prompt-caching/prompt-caching.mjs +0 -12
- package/resources/beta/prompt-caching/prompt-caching.mjs.map +0 -1
- package/resources/messages.d.ts.map +0 -1
- package/resources/messages.js +0 -36
- package/resources/messages.js.map +0 -1
- package/resources/messages.mjs.map +0 -1
- package/src/lib/PromptCachingBetaMessageStream.ts +0 -579
- package/src/resources/beta/prompt-caching/index.ts +0 -20
- package/src/resources/beta/prompt-caching/messages.ts +0 -642
- package/src/resources/beta/prompt-caching/prompt-caching.ts +0 -47
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from "../../resource.js";
|
|
4
|
+
import { isRequestOptions } from "../../core.js";
|
|
5
|
+
import * as Core from "../../core.js";
|
|
6
|
+
import { Page, type PageParams } from "../../pagination.js";
|
|
7
|
+
|
|
8
|
+
export class Models extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Get a specific model.
|
|
11
|
+
*
|
|
12
|
+
* The Models API response can be used to determine information about a specific
|
|
13
|
+
* model or resolve a model alias to a model ID.
|
|
14
|
+
*/
|
|
15
|
+
retrieve(modelId: string, options?: Core.RequestOptions): Core.APIPromise<BetaModelInfo> {
|
|
16
|
+
return this._client.get(`/v1/models/${modelId}?beta=true`, options);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* List available models.
|
|
21
|
+
*
|
|
22
|
+
* The Models API response can be used to determine which models are available for
|
|
23
|
+
* use in the API. More recently released models are listed first.
|
|
24
|
+
*/
|
|
25
|
+
list(
|
|
26
|
+
query?: ModelListParams,
|
|
27
|
+
options?: Core.RequestOptions,
|
|
28
|
+
): Core.PagePromise<BetaModelInfosPage, BetaModelInfo>;
|
|
29
|
+
list(options?: Core.RequestOptions): Core.PagePromise<BetaModelInfosPage, BetaModelInfo>;
|
|
30
|
+
list(
|
|
31
|
+
query: ModelListParams | Core.RequestOptions = {},
|
|
32
|
+
options?: Core.RequestOptions,
|
|
33
|
+
): Core.PagePromise<BetaModelInfosPage, BetaModelInfo> {
|
|
34
|
+
if (isRequestOptions(query)) {
|
|
35
|
+
return this.list({}, query);
|
|
36
|
+
}
|
|
37
|
+
return this._client.getAPIList('/v1/models?beta=true', BetaModelInfosPage, { query, ...options });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class BetaModelInfosPage extends Page<BetaModelInfo> {}
|
|
42
|
+
|
|
43
|
+
export interface BetaModelInfo {
|
|
44
|
+
/**
|
|
45
|
+
* Unique model identifier.
|
|
46
|
+
*/
|
|
47
|
+
id: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* RFC 3339 datetime string representing the time at which the model was released.
|
|
51
|
+
* May be set to an epoch value if the release date is unknown.
|
|
52
|
+
*/
|
|
53
|
+
created_at: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A human-readable name for the model.
|
|
57
|
+
*/
|
|
58
|
+
display_name: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Object type.
|
|
62
|
+
*
|
|
63
|
+
* For Models, this is always `"model"`.
|
|
64
|
+
*/
|
|
65
|
+
type: 'model';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface ModelListParams extends PageParams {}
|
|
69
|
+
|
|
70
|
+
Models.BetaModelInfosPage = BetaModelInfosPage;
|
|
71
|
+
|
|
72
|
+
export declare namespace Models {
|
|
73
|
+
export {
|
|
74
|
+
type BetaModelInfo as BetaModelInfo,
|
|
75
|
+
BetaModelInfosPage as BetaModelInfosPage,
|
|
76
|
+
type ModelListParams as ModelListParams,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -4,7 +4,7 @@ import { APIResource } from "../resource.js";
|
|
|
4
4
|
import { APIPromise } from "../core.js";
|
|
5
5
|
import * as Core from "../core.js";
|
|
6
6
|
import * as CompletionsAPI from "./completions.js";
|
|
7
|
-
import * as MessagesAPI from "./messages.js";
|
|
7
|
+
import * as MessagesAPI from "./messages/messages.js";
|
|
8
8
|
import { Stream } from "../streaming.js";
|
|
9
9
|
|
|
10
10
|
export class Completions extends APIResource {
|
package/src/resources/index.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
export * from "./shared.js";
|
|
3
4
|
export {
|
|
4
5
|
Beta,
|
|
5
6
|
type AnthropicBeta,
|
|
6
7
|
type BetaAPIError,
|
|
7
8
|
type BetaAuthenticationError,
|
|
9
|
+
type BetaBillingError,
|
|
8
10
|
type BetaError,
|
|
9
11
|
type BetaErrorResponse,
|
|
12
|
+
type BetaGatewayTimeoutError,
|
|
10
13
|
type BetaInvalidRequestError,
|
|
11
14
|
type BetaNotFoundError,
|
|
12
15
|
type BetaOverloadedError,
|
|
@@ -22,10 +25,14 @@ export {
|
|
|
22
25
|
} from "./completions.js";
|
|
23
26
|
export {
|
|
24
27
|
Messages,
|
|
28
|
+
type Base64PDFSource,
|
|
29
|
+
type CacheControlEphemeral,
|
|
25
30
|
type ContentBlock,
|
|
26
31
|
type ContentBlockDeltaEvent,
|
|
32
|
+
type ContentBlockParam,
|
|
27
33
|
type ContentBlockStartEvent,
|
|
28
34
|
type ContentBlockStopEvent,
|
|
35
|
+
type DocumentBlockParam,
|
|
29
36
|
type ImageBlockParam,
|
|
30
37
|
type InputJsonDelta,
|
|
31
38
|
type InputJSONDelta,
|
|
@@ -37,6 +44,7 @@ export {
|
|
|
37
44
|
type MessageStopEvent,
|
|
38
45
|
type MessageStreamEvent,
|
|
39
46
|
type MessageStreamParams,
|
|
47
|
+
type MessageTokensCount,
|
|
40
48
|
type Metadata,
|
|
41
49
|
type Model,
|
|
42
50
|
type RawContentBlockDeltaEvent,
|
|
@@ -61,4 +69,6 @@ export {
|
|
|
61
69
|
type MessageCreateParams,
|
|
62
70
|
type MessageCreateParamsNonStreaming,
|
|
63
71
|
type MessageCreateParamsStreaming,
|
|
64
|
-
|
|
72
|
+
type MessageCountTokensParams,
|
|
73
|
+
} from "./messages/messages.js";
|
|
74
|
+
export { ModelInfosPage, Models, type ModelInfo, type ModelListParams } from "./models.js";
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from "../../resource.js";
|
|
4
|
+
import { isRequestOptions } from "../../core.js";
|
|
5
|
+
import * as Core from "../../core.js";
|
|
6
|
+
import * as Shared from "../shared.js";
|
|
7
|
+
import * as MessagesAPI from "./messages.js";
|
|
8
|
+
import { Page, type PageParams } from "../../pagination.js";
|
|
9
|
+
import { JSONLDecoder } from "../../internal/decoders/jsonl.js";
|
|
10
|
+
import { AnthropicError } from "../../error.js";
|
|
11
|
+
|
|
12
|
+
export class Batches extends APIResource {
|
|
13
|
+
/**
|
|
14
|
+
* Send a batch of Message creation requests.
|
|
15
|
+
*
|
|
16
|
+
* The Message Batches API can be used to process multiple Messages API requests at
|
|
17
|
+
* once. Once a Message Batch is created, it begins processing immediately. Batches
|
|
18
|
+
* can take up to 24 hours to complete.
|
|
19
|
+
*/
|
|
20
|
+
create(body: BatchCreateParams, options?: Core.RequestOptions): Core.APIPromise<MessageBatch> {
|
|
21
|
+
return this._client.post('/v1/messages/batches', { body, ...options });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This endpoint is idempotent and can be used to poll for Message Batch
|
|
26
|
+
* completion. To access the results of a Message Batch, make a request to the
|
|
27
|
+
* `results_url` field in the response.
|
|
28
|
+
*/
|
|
29
|
+
retrieve(messageBatchId: string, options?: Core.RequestOptions): Core.APIPromise<MessageBatch> {
|
|
30
|
+
return this._client.get(`/v1/messages/batches/${messageBatchId}`, options);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* List all Message Batches within a Workspace. Most recently created batches are
|
|
35
|
+
* returned first.
|
|
36
|
+
*/
|
|
37
|
+
list(
|
|
38
|
+
query?: BatchListParams,
|
|
39
|
+
options?: Core.RequestOptions,
|
|
40
|
+
): Core.PagePromise<MessageBatchesPage, MessageBatch>;
|
|
41
|
+
list(options?: Core.RequestOptions): Core.PagePromise<MessageBatchesPage, MessageBatch>;
|
|
42
|
+
list(
|
|
43
|
+
query: BatchListParams | Core.RequestOptions = {},
|
|
44
|
+
options?: Core.RequestOptions,
|
|
45
|
+
): Core.PagePromise<MessageBatchesPage, MessageBatch> {
|
|
46
|
+
if (isRequestOptions(query)) {
|
|
47
|
+
return this.list({}, query);
|
|
48
|
+
}
|
|
49
|
+
return this._client.getAPIList('/v1/messages/batches', MessageBatchesPage, { query, ...options });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Batches may be canceled any time before processing ends. Once cancellation is
|
|
54
|
+
* initiated, the batch enters a `canceling` state, at which time the system may
|
|
55
|
+
* complete any in-progress, non-interruptible requests before finalizing
|
|
56
|
+
* cancellation.
|
|
57
|
+
*
|
|
58
|
+
* The number of canceled requests is specified in `request_counts`. To determine
|
|
59
|
+
* which requests were canceled, check the individual results within the batch.
|
|
60
|
+
* Note that cancellation may not result in any canceled requests if they were
|
|
61
|
+
* non-interruptible.
|
|
62
|
+
*/
|
|
63
|
+
cancel(messageBatchId: string, options?: Core.RequestOptions): Core.APIPromise<MessageBatch> {
|
|
64
|
+
return this._client.post(`/v1/messages/batches/${messageBatchId}/cancel`, options);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Streams the results of a Message Batch as a `.jsonl` file.
|
|
69
|
+
*
|
|
70
|
+
* Each line in the file is a JSON object containing the result of a single request
|
|
71
|
+
* in the Message Batch. Results are not guaranteed to be in the same order as
|
|
72
|
+
* requests. Use the `custom_id` field to match results to requests.
|
|
73
|
+
*/
|
|
74
|
+
async results(
|
|
75
|
+
messageBatchId: string,
|
|
76
|
+
options?: Core.RequestOptions,
|
|
77
|
+
): Promise<JSONLDecoder<MessageBatchIndividualResponse>> {
|
|
78
|
+
const batch = await this.retrieve(messageBatchId);
|
|
79
|
+
if (!batch.results_url) {
|
|
80
|
+
throw new AnthropicError(
|
|
81
|
+
`No batch \`results_url\`; Has it finished processing? ${batch.processing_status} - ${batch.id}`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return this._client
|
|
86
|
+
.get(batch.results_url, { ...options, __binaryResponse: true })
|
|
87
|
+
._thenUnwrap((_, props) => JSONLDecoder.fromResponse(props.response, props.controller));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export class MessageBatchesPage extends Page<MessageBatch> {}
|
|
92
|
+
|
|
93
|
+
export interface MessageBatch {
|
|
94
|
+
/**
|
|
95
|
+
* Unique object identifier.
|
|
96
|
+
*
|
|
97
|
+
* The format and length of IDs may change over time.
|
|
98
|
+
*/
|
|
99
|
+
id: string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* RFC 3339 datetime string representing the time at which the Message Batch was
|
|
103
|
+
* archived and its results became unavailable.
|
|
104
|
+
*/
|
|
105
|
+
archived_at: string | null;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* RFC 3339 datetime string representing the time at which cancellation was
|
|
109
|
+
* initiated for the Message Batch. Specified only if cancellation was initiated.
|
|
110
|
+
*/
|
|
111
|
+
cancel_initiated_at: string | null;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* RFC 3339 datetime string representing the time at which the Message Batch was
|
|
115
|
+
* created.
|
|
116
|
+
*/
|
|
117
|
+
created_at: string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* RFC 3339 datetime string representing the time at which processing for the
|
|
121
|
+
* Message Batch ended. Specified only once processing ends.
|
|
122
|
+
*
|
|
123
|
+
* Processing ends when every request in a Message Batch has either succeeded,
|
|
124
|
+
* errored, canceled, or expired.
|
|
125
|
+
*/
|
|
126
|
+
ended_at: string | null;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* RFC 3339 datetime string representing the time at which the Message Batch will
|
|
130
|
+
* expire and end processing, which is 24 hours after creation.
|
|
131
|
+
*/
|
|
132
|
+
expires_at: string;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Processing status of the Message Batch.
|
|
136
|
+
*/
|
|
137
|
+
processing_status: 'in_progress' | 'canceling' | 'ended';
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Tallies requests within the Message Batch, categorized by their status.
|
|
141
|
+
*
|
|
142
|
+
* Requests start as `processing` and move to one of the other statuses only once
|
|
143
|
+
* processing of the entire batch ends. The sum of all values always matches the
|
|
144
|
+
* total number of requests in the batch.
|
|
145
|
+
*/
|
|
146
|
+
request_counts: MessageBatchRequestCounts;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* URL to a `.jsonl` file containing the results of the Message Batch requests.
|
|
150
|
+
* Specified only once processing ends.
|
|
151
|
+
*
|
|
152
|
+
* Results in the file are not guaranteed to be in the same order as requests. Use
|
|
153
|
+
* the `custom_id` field to match results to requests.
|
|
154
|
+
*/
|
|
155
|
+
results_url: string | null;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Object type.
|
|
159
|
+
*
|
|
160
|
+
* For Message Batches, this is always `"message_batch"`.
|
|
161
|
+
*/
|
|
162
|
+
type: 'message_batch';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface MessageBatchCanceledResult {
|
|
166
|
+
type: 'canceled';
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface MessageBatchErroredResult {
|
|
170
|
+
error: Shared.ErrorResponse;
|
|
171
|
+
|
|
172
|
+
type: 'errored';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface MessageBatchExpiredResult {
|
|
176
|
+
type: 'expired';
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface MessageBatchIndividualResponse {
|
|
180
|
+
/**
|
|
181
|
+
* Developer-provided ID created for each request in a Message Batch. Useful for
|
|
182
|
+
* matching results to requests, as results may be given out of request order.
|
|
183
|
+
*
|
|
184
|
+
* Must be unique for each request within the Message Batch.
|
|
185
|
+
*/
|
|
186
|
+
custom_id: string;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Processing result for this request.
|
|
190
|
+
*
|
|
191
|
+
* Contains a Message output if processing was successful, an error response if
|
|
192
|
+
* processing failed, or the reason why processing was not attempted, such as
|
|
193
|
+
* cancellation or expiration.
|
|
194
|
+
*/
|
|
195
|
+
result: MessageBatchResult;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface MessageBatchRequestCounts {
|
|
199
|
+
/**
|
|
200
|
+
* Number of requests in the Message Batch that have been canceled.
|
|
201
|
+
*
|
|
202
|
+
* This is zero until processing of the entire Message Batch has ended.
|
|
203
|
+
*/
|
|
204
|
+
canceled: number;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Number of requests in the Message Batch that encountered an error.
|
|
208
|
+
*
|
|
209
|
+
* This is zero until processing of the entire Message Batch has ended.
|
|
210
|
+
*/
|
|
211
|
+
errored: number;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Number of requests in the Message Batch that have expired.
|
|
215
|
+
*
|
|
216
|
+
* This is zero until processing of the entire Message Batch has ended.
|
|
217
|
+
*/
|
|
218
|
+
expired: number;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Number of requests in the Message Batch that are processing.
|
|
222
|
+
*/
|
|
223
|
+
processing: number;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Number of requests in the Message Batch that have completed successfully.
|
|
227
|
+
*
|
|
228
|
+
* This is zero until processing of the entire Message Batch has ended.
|
|
229
|
+
*/
|
|
230
|
+
succeeded: number;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Processing result for this request.
|
|
235
|
+
*
|
|
236
|
+
* Contains a Message output if processing was successful, an error response if
|
|
237
|
+
* processing failed, or the reason why processing was not attempted, such as
|
|
238
|
+
* cancellation or expiration.
|
|
239
|
+
*/
|
|
240
|
+
export type MessageBatchResult =
|
|
241
|
+
| MessageBatchSucceededResult
|
|
242
|
+
| MessageBatchErroredResult
|
|
243
|
+
| MessageBatchCanceledResult
|
|
244
|
+
| MessageBatchExpiredResult;
|
|
245
|
+
|
|
246
|
+
export interface MessageBatchSucceededResult {
|
|
247
|
+
message: MessagesAPI.Message;
|
|
248
|
+
|
|
249
|
+
type: 'succeeded';
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface BatchCreateParams {
|
|
253
|
+
/**
|
|
254
|
+
* List of requests for prompt completion. Each is an individual request to create
|
|
255
|
+
* a Message.
|
|
256
|
+
*/
|
|
257
|
+
requests: Array<BatchCreateParams.Request>;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export namespace BatchCreateParams {
|
|
261
|
+
export interface Request {
|
|
262
|
+
/**
|
|
263
|
+
* Developer-provided ID created for each request in a Message Batch. Useful for
|
|
264
|
+
* matching results to requests, as results may be given out of request order.
|
|
265
|
+
*
|
|
266
|
+
* Must be unique for each request within the Message Batch.
|
|
267
|
+
*/
|
|
268
|
+
custom_id: string;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Messages API creation parameters for the individual request.
|
|
272
|
+
*
|
|
273
|
+
* See the [Messages API reference](/en/api/messages) for full documentation on
|
|
274
|
+
* available parameters.
|
|
275
|
+
*/
|
|
276
|
+
params: MessagesAPI.MessageCreateParamsNonStreaming;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface BatchListParams extends PageParams {}
|
|
281
|
+
|
|
282
|
+
Batches.MessageBatchesPage = MessageBatchesPage;
|
|
283
|
+
|
|
284
|
+
export declare namespace Batches {
|
|
285
|
+
export {
|
|
286
|
+
type MessageBatch as MessageBatch,
|
|
287
|
+
type MessageBatchCanceledResult as MessageBatchCanceledResult,
|
|
288
|
+
type MessageBatchErroredResult as MessageBatchErroredResult,
|
|
289
|
+
type MessageBatchExpiredResult as MessageBatchExpiredResult,
|
|
290
|
+
type MessageBatchIndividualResponse as MessageBatchIndividualResponse,
|
|
291
|
+
type MessageBatchRequestCounts as MessageBatchRequestCounts,
|
|
292
|
+
type MessageBatchResult as MessageBatchResult,
|
|
293
|
+
type MessageBatchSucceededResult as MessageBatchSucceededResult,
|
|
294
|
+
MessageBatchesPage as MessageBatchesPage,
|
|
295
|
+
type BatchCreateParams as BatchCreateParams,
|
|
296
|
+
type BatchListParams as BatchListParams,
|
|
297
|
+
};
|
|
298
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
MessageBatchesPage,
|
|
5
|
+
Batches,
|
|
6
|
+
type MessageBatch,
|
|
7
|
+
type MessageBatchCanceledResult,
|
|
8
|
+
type MessageBatchErroredResult,
|
|
9
|
+
type MessageBatchExpiredResult,
|
|
10
|
+
type MessageBatchIndividualResponse,
|
|
11
|
+
type MessageBatchRequestCounts,
|
|
12
|
+
type MessageBatchResult,
|
|
13
|
+
type MessageBatchSucceededResult,
|
|
14
|
+
type BatchCreateParams,
|
|
15
|
+
type BatchListParams,
|
|
16
|
+
} from "./batches.js";
|
|
17
|
+
export {
|
|
18
|
+
Messages,
|
|
19
|
+
type Base64PDFSource,
|
|
20
|
+
type CacheControlEphemeral,
|
|
21
|
+
type ContentBlock,
|
|
22
|
+
type ContentBlockDeltaEvent,
|
|
23
|
+
type ContentBlockParam,
|
|
24
|
+
type ContentBlockStartEvent,
|
|
25
|
+
type ContentBlockStopEvent,
|
|
26
|
+
type DocumentBlockParam,
|
|
27
|
+
type ImageBlockParam,
|
|
28
|
+
type InputJSONDelta,
|
|
29
|
+
type Message,
|
|
30
|
+
type MessageDeltaEvent,
|
|
31
|
+
type MessageDeltaUsage,
|
|
32
|
+
type MessageParam,
|
|
33
|
+
type MessageStartEvent,
|
|
34
|
+
type MessageStopEvent,
|
|
35
|
+
type MessageStreamEvent,
|
|
36
|
+
type MessageTokensCount,
|
|
37
|
+
type Metadata,
|
|
38
|
+
type Model,
|
|
39
|
+
type RawContentBlockDeltaEvent,
|
|
40
|
+
type RawContentBlockStartEvent,
|
|
41
|
+
type RawContentBlockStopEvent,
|
|
42
|
+
type RawMessageDeltaEvent,
|
|
43
|
+
type RawMessageStartEvent,
|
|
44
|
+
type RawMessageStopEvent,
|
|
45
|
+
type RawMessageStreamEvent,
|
|
46
|
+
type TextBlock,
|
|
47
|
+
type TextBlockParam,
|
|
48
|
+
type TextDelta,
|
|
49
|
+
type Tool,
|
|
50
|
+
type ToolChoice,
|
|
51
|
+
type ToolChoiceAny,
|
|
52
|
+
type ToolChoiceAuto,
|
|
53
|
+
type ToolChoiceTool,
|
|
54
|
+
type ToolResultBlockParam,
|
|
55
|
+
type ToolUseBlock,
|
|
56
|
+
type ToolUseBlockParam,
|
|
57
|
+
type Usage,
|
|
58
|
+
type MessageCreateParams,
|
|
59
|
+
type MessageCreateParamsBase,
|
|
60
|
+
type MessageCreateParamsNonStreaming,
|
|
61
|
+
type MessageCreateParamsStreaming,
|
|
62
|
+
type MessageCountTokensParams,
|
|
63
|
+
} from "./messages.js";
|