@anthropic-ai/sdk 0.30.1 → 0.31.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 +36 -0
- package/README.md +3 -3
- package/index.d.mts +24 -61
- package/index.d.ts +24 -61
- package/index.d.ts.map +1 -1
- package/index.js +21 -9
- package/index.js.map +1 -1
- package/index.mjs +21 -9
- package/index.mjs.map +1 -1
- package/package.json +2 -2
- package/resources/beta/beta.d.ts +6 -49
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +4 -4
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +4 -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.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/messages/batches.d.ts +1 -15
- package/resources/beta/messages/batches.d.ts.map +1 -1
- package/resources/beta/messages/batches.js +1 -27
- package/resources/beta/messages/batches.js.map +1 -1
- package/resources/beta/messages/batches.mjs +1 -4
- package/resources/beta/messages/batches.mjs.map +1 -1
- package/resources/beta/messages/index.d.ts +2 -2
- package/resources/beta/messages/index.d.ts.map +1 -1
- package/resources/beta/messages/index.js +3 -3
- package/resources/beta/messages/index.js.map +1 -1
- package/resources/beta/messages/index.mjs +1 -1
- package/resources/beta/messages/index.mjs.map +1 -1
- package/resources/beta/messages/messages.d.ts +242 -51
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js +20 -4
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs +20 -4
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/prompt-caching/index.d.ts +1 -1
- package/resources/beta/prompt-caching/index.d.ts.map +1 -1
- package/resources/beta/prompt-caching/index.js +3 -3
- package/resources/beta/prompt-caching/index.js.map +1 -1
- package/resources/beta/prompt-caching/index.mjs +1 -1
- package/resources/beta/prompt-caching/index.mjs.map +1 -1
- package/resources/beta/prompt-caching/messages.d.ts +6 -14
- package/resources/beta/prompt-caching/messages.d.ts.map +1 -1
- package/resources/beta/prompt-caching/messages.js +0 -2
- package/resources/beta/prompt-caching/messages.js.map +1 -1
- package/resources/beta/prompt-caching/messages.mjs +0 -2
- package/resources/beta/prompt-caching/messages.mjs.map +1 -1
- package/resources/beta/prompt-caching/prompt-caching.d.ts +2 -15
- package/resources/beta/prompt-caching/prompt-caching.d.ts.map +1 -1
- package/resources/beta/prompt-caching/prompt-caching.js +2 -3
- package/resources/beta/prompt-caching/prompt-caching.js.map +1 -1
- package/resources/beta/prompt-caching/prompt-caching.mjs +2 -3
- package/resources/beta/prompt-caching/prompt-caching.mjs.map +1 -1
- package/resources/completions.d.ts +1 -4
- package/resources/completions.d.ts.map +1 -1
- package/resources/completions.js +0 -2
- package/resources/completions.js.map +1 -1
- package/resources/completions.mjs +0 -2
- package/resources/completions.mjs.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.ts +6 -39
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +0 -2
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +0 -2
- package/resources/messages.mjs.map +1 -1
- package/src/index.ts +148 -79
- package/src/resources/beta/beta.ts +107 -50
- package/src/resources/beta/index.ts +49 -45
- package/src/resources/beta/messages/batches.ts +19 -16
- package/src/resources/beta/messages/index.ts +55 -51
- package/src/resources/beta/messages/messages.ts +347 -52
- package/src/resources/beta/prompt-caching/index.ts +15 -15
- package/src/resources/beta/prompt-caching/messages.ts +22 -15
- package/src/resources/beta/prompt-caching/prompt-caching.ts +37 -16
- package/src/resources/completions.ts +7 -5
- package/src/resources/index.ts +53 -53
- package/src/resources/messages.ts +47 -40
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -7,6 +7,23 @@ import * as MessagesMessagesAPI from "./messages.js";
|
|
|
7
7
|
import * as MessagesAPI from "../../messages.js";
|
|
8
8
|
import * as BetaAPI from "../beta.js";
|
|
9
9
|
import * as BatchesAPI from "./batches.js";
|
|
10
|
+
import {
|
|
11
|
+
BatchCancelParams,
|
|
12
|
+
BatchCreateParams,
|
|
13
|
+
BatchListParams,
|
|
14
|
+
BatchResultsParams,
|
|
15
|
+
BatchRetrieveParams,
|
|
16
|
+
Batches,
|
|
17
|
+
BetaMessageBatch,
|
|
18
|
+
BetaMessageBatchCanceledResult,
|
|
19
|
+
BetaMessageBatchErroredResult,
|
|
20
|
+
BetaMessageBatchExpiredResult,
|
|
21
|
+
BetaMessageBatchIndividualResponse,
|
|
22
|
+
BetaMessageBatchRequestCounts,
|
|
23
|
+
BetaMessageBatchResult,
|
|
24
|
+
BetaMessageBatchSucceededResult,
|
|
25
|
+
BetaMessageBatchesPage,
|
|
26
|
+
} from "./batches.js";
|
|
10
27
|
import { Stream } from "../../../streaming.js";
|
|
11
28
|
|
|
12
29
|
export class Messages extends APIResource {
|
|
@@ -44,6 +61,43 @@ export class Messages extends APIResource {
|
|
|
44
61
|
stream: params.stream ?? false,
|
|
45
62
|
}) as APIPromise<BetaMessage> | APIPromise<Stream<BetaRawMessageStreamEvent>>;
|
|
46
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Count the number of tokens in a Message.
|
|
67
|
+
*
|
|
68
|
+
* The Token Count API can be used to count the number of tokens in a Message,
|
|
69
|
+
* including tools, images, and documents, without creating it.
|
|
70
|
+
*/
|
|
71
|
+
countTokens(
|
|
72
|
+
params: MessageCountTokensParams,
|
|
73
|
+
options?: Core.RequestOptions,
|
|
74
|
+
): Core.APIPromise<BetaMessageTokensCount> {
|
|
75
|
+
const { betas, ...body } = params;
|
|
76
|
+
return this._client.post('/v1/messages/count_tokens?beta=true', {
|
|
77
|
+
body,
|
|
78
|
+
...options,
|
|
79
|
+
headers: {
|
|
80
|
+
'anthropic-beta': [...(betas ?? []), 'token-counting-2024-11-01'].toString(),
|
|
81
|
+
...options?.headers,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface BetaBase64PDFBlock {
|
|
88
|
+
source: BetaBase64PDFSource;
|
|
89
|
+
|
|
90
|
+
type: 'document';
|
|
91
|
+
|
|
92
|
+
cache_control?: BetaCacheControlEphemeral | null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface BetaBase64PDFSource {
|
|
96
|
+
data: string;
|
|
97
|
+
|
|
98
|
+
media_type: 'application/pdf';
|
|
99
|
+
|
|
100
|
+
type: 'base64';
|
|
47
101
|
}
|
|
48
102
|
|
|
49
103
|
export interface BetaCacheControlEphemeral {
|
|
@@ -56,7 +110,8 @@ export type BetaContentBlockParam =
|
|
|
56
110
|
| BetaTextBlockParam
|
|
57
111
|
| BetaImageBlockParam
|
|
58
112
|
| BetaToolUseBlockParam
|
|
59
|
-
| BetaToolResultBlockParam
|
|
113
|
+
| BetaToolResultBlockParam
|
|
114
|
+
| BetaBase64PDFBlock;
|
|
60
115
|
|
|
61
116
|
export interface BetaImageBlockParam {
|
|
62
117
|
source: BetaImageBlockParam.Source;
|
|
@@ -200,6 +255,14 @@ export interface BetaMessageParam {
|
|
|
200
255
|
role: 'user' | 'assistant';
|
|
201
256
|
}
|
|
202
257
|
|
|
258
|
+
export interface BetaMessageTokensCount {
|
|
259
|
+
/**
|
|
260
|
+
* The total number of tokens across the provided list of messages, system prompt,
|
|
261
|
+
* and tools.
|
|
262
|
+
*/
|
|
263
|
+
input_tokens: number;
|
|
264
|
+
}
|
|
265
|
+
|
|
203
266
|
export interface BetaMetadata {
|
|
204
267
|
/**
|
|
205
268
|
* An external identifier for the user who is associated with the request.
|
|
@@ -310,6 +373,11 @@ export interface BetaTool {
|
|
|
310
373
|
*/
|
|
311
374
|
input_schema: BetaTool.InputSchema;
|
|
312
375
|
|
|
376
|
+
/**
|
|
377
|
+
* Name of the tool.
|
|
378
|
+
*
|
|
379
|
+
* This is how the tool will be called by the model and in tool_use blocks.
|
|
380
|
+
*/
|
|
313
381
|
name: string;
|
|
314
382
|
|
|
315
383
|
cache_control?: BetaCacheControlEphemeral | null;
|
|
@@ -343,6 +411,11 @@ export namespace BetaTool {
|
|
|
343
411
|
}
|
|
344
412
|
|
|
345
413
|
export interface BetaToolBash20241022 {
|
|
414
|
+
/**
|
|
415
|
+
* Name of the tool.
|
|
416
|
+
*
|
|
417
|
+
* This is how the tool will be called by the model and in tool_use blocks.
|
|
418
|
+
*/
|
|
346
419
|
name: 'bash';
|
|
347
420
|
|
|
348
421
|
type: 'bash_20241022';
|
|
@@ -407,16 +480,30 @@ export interface BetaToolChoiceTool {
|
|
|
407
480
|
}
|
|
408
481
|
|
|
409
482
|
export interface BetaToolComputerUse20241022 {
|
|
483
|
+
/**
|
|
484
|
+
* The height of the display in pixels.
|
|
485
|
+
*/
|
|
410
486
|
display_height_px: number;
|
|
411
487
|
|
|
488
|
+
/**
|
|
489
|
+
* The width of the display in pixels.
|
|
490
|
+
*/
|
|
412
491
|
display_width_px: number;
|
|
413
492
|
|
|
493
|
+
/**
|
|
494
|
+
* Name of the tool.
|
|
495
|
+
*
|
|
496
|
+
* This is how the tool will be called by the model and in tool_use blocks.
|
|
497
|
+
*/
|
|
414
498
|
name: 'computer';
|
|
415
499
|
|
|
416
500
|
type: 'computer_20241022';
|
|
417
501
|
|
|
418
502
|
cache_control?: BetaCacheControlEphemeral | null;
|
|
419
503
|
|
|
504
|
+
/**
|
|
505
|
+
* The X11 display number (e.g. 0, 1) for the display.
|
|
506
|
+
*/
|
|
420
507
|
display_number?: number | null;
|
|
421
508
|
}
|
|
422
509
|
|
|
@@ -433,6 +520,11 @@ export interface BetaToolResultBlockParam {
|
|
|
433
520
|
}
|
|
434
521
|
|
|
435
522
|
export interface BetaToolTextEditor20241022 {
|
|
523
|
+
/**
|
|
524
|
+
* Name of the tool.
|
|
525
|
+
*
|
|
526
|
+
* This is how the tool will be called by the model and in tool_use blocks.
|
|
527
|
+
*/
|
|
436
528
|
name: 'str_replace_editor';
|
|
437
529
|
|
|
438
530
|
type: 'text_editor_20241022';
|
|
@@ -784,55 +876,258 @@ export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
|
|
|
784
876
|
stream: true;
|
|
785
877
|
}
|
|
786
878
|
|
|
787
|
-
export
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
879
|
+
export interface MessageCountTokensParams {
|
|
880
|
+
/**
|
|
881
|
+
* Body param: Input messages.
|
|
882
|
+
*
|
|
883
|
+
* Our models are trained to operate on alternating `user` and `assistant`
|
|
884
|
+
* conversational turns. When creating a new `Message`, you specify the prior
|
|
885
|
+
* conversational turns with the `messages` parameter, and the model then generates
|
|
886
|
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
|
887
|
+
* in your request will be combined into a single turn.
|
|
888
|
+
*
|
|
889
|
+
* Each input message must be an object with a `role` and `content`. You can
|
|
890
|
+
* specify a single `user`-role message, or you can include multiple `user` and
|
|
891
|
+
* `assistant` messages.
|
|
892
|
+
*
|
|
893
|
+
* If the final message uses the `assistant` role, the response content will
|
|
894
|
+
* continue immediately from the content in that message. This can be used to
|
|
895
|
+
* constrain part of the model's response.
|
|
896
|
+
*
|
|
897
|
+
* Example with a single `user` message:
|
|
898
|
+
*
|
|
899
|
+
* ```json
|
|
900
|
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
|
901
|
+
* ```
|
|
902
|
+
*
|
|
903
|
+
* Example with multiple conversational turns:
|
|
904
|
+
*
|
|
905
|
+
* ```json
|
|
906
|
+
* [
|
|
907
|
+
* { "role": "user", "content": "Hello there." },
|
|
908
|
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
|
909
|
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
|
910
|
+
* ]
|
|
911
|
+
* ```
|
|
912
|
+
*
|
|
913
|
+
* Example with a partially-filled response from Claude:
|
|
914
|
+
*
|
|
915
|
+
* ```json
|
|
916
|
+
* [
|
|
917
|
+
* {
|
|
918
|
+
* "role": "user",
|
|
919
|
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
|
920
|
+
* },
|
|
921
|
+
* { "role": "assistant", "content": "The best answer is (" }
|
|
922
|
+
* ]
|
|
923
|
+
* ```
|
|
924
|
+
*
|
|
925
|
+
* Each input message `content` may be either a single `string` or an array of
|
|
926
|
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
|
927
|
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
|
928
|
+
* following input messages are equivalent:
|
|
929
|
+
*
|
|
930
|
+
* ```json
|
|
931
|
+
* { "role": "user", "content": "Hello, Claude" }
|
|
932
|
+
* ```
|
|
933
|
+
*
|
|
934
|
+
* ```json
|
|
935
|
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
936
|
+
* ```
|
|
937
|
+
*
|
|
938
|
+
* Starting with Claude 3 models, you can also send image content blocks:
|
|
939
|
+
*
|
|
940
|
+
* ```json
|
|
941
|
+
* {
|
|
942
|
+
* "role": "user",
|
|
943
|
+
* "content": [
|
|
944
|
+
* {
|
|
945
|
+
* "type": "image",
|
|
946
|
+
* "source": {
|
|
947
|
+
* "type": "base64",
|
|
948
|
+
* "media_type": "image/jpeg",
|
|
949
|
+
* "data": "/9j/4AAQSkZJRg..."
|
|
950
|
+
* }
|
|
951
|
+
* },
|
|
952
|
+
* { "type": "text", "text": "What is in this image?" }
|
|
953
|
+
* ]
|
|
954
|
+
* }
|
|
955
|
+
* ```
|
|
956
|
+
*
|
|
957
|
+
* We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
958
|
+
* `image/png`, `image/gif`, and `image/webp` media types.
|
|
959
|
+
*
|
|
960
|
+
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
961
|
+
* more input examples.
|
|
962
|
+
*
|
|
963
|
+
* Note that if you want to include a
|
|
964
|
+
* [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
|
965
|
+
* the top-level `system` parameter — there is no `"system"` role for input
|
|
966
|
+
* messages in the Messages API.
|
|
967
|
+
*/
|
|
968
|
+
messages: Array<BetaMessageParam>;
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Body param: The model that will complete your prompt.\n\nSee
|
|
972
|
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
973
|
+
* details and options.
|
|
974
|
+
*/
|
|
975
|
+
model: MessagesAPI.Model;
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Body param: System prompt.
|
|
979
|
+
*
|
|
980
|
+
* A system prompt is a way of providing context and instructions to Claude, such
|
|
981
|
+
* as specifying a particular goal or role. See our
|
|
982
|
+
* [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
|
983
|
+
*/
|
|
984
|
+
system?: string | Array<BetaTextBlockParam>;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Body param: How the model should use the provided tools. The model can use a
|
|
988
|
+
* specific tool, any available tool, or decide by itself.
|
|
989
|
+
*/
|
|
990
|
+
tool_choice?: BetaToolChoice;
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Body param: Definitions of tools that the model may use.
|
|
994
|
+
*
|
|
995
|
+
* If you include `tools` in your API request, the model may return `tool_use`
|
|
996
|
+
* content blocks that represent the model's use of those tools. You can then run
|
|
997
|
+
* those tools using the tool input generated by the model and then optionally
|
|
998
|
+
* return results back to the model using `tool_result` content blocks.
|
|
999
|
+
*
|
|
1000
|
+
* Each tool definition includes:
|
|
1001
|
+
*
|
|
1002
|
+
* - `name`: Name of the tool.
|
|
1003
|
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
|
1004
|
+
* - `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`
|
|
1005
|
+
* shape that the model will produce in `tool_use` output content blocks.
|
|
1006
|
+
*
|
|
1007
|
+
* For example, if you defined `tools` as:
|
|
1008
|
+
*
|
|
1009
|
+
* ```json
|
|
1010
|
+
* [
|
|
1011
|
+
* {
|
|
1012
|
+
* "name": "get_stock_price",
|
|
1013
|
+
* "description": "Get the current stock price for a given ticker symbol.",
|
|
1014
|
+
* "input_schema": {
|
|
1015
|
+
* "type": "object",
|
|
1016
|
+
* "properties": {
|
|
1017
|
+
* "ticker": {
|
|
1018
|
+
* "type": "string",
|
|
1019
|
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
|
1020
|
+
* }
|
|
1021
|
+
* },
|
|
1022
|
+
* "required": ["ticker"]
|
|
1023
|
+
* }
|
|
1024
|
+
* }
|
|
1025
|
+
* ]
|
|
1026
|
+
* ```
|
|
1027
|
+
*
|
|
1028
|
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
|
1029
|
+
* `tool_use` content blocks in the response like this:
|
|
1030
|
+
*
|
|
1031
|
+
* ```json
|
|
1032
|
+
* [
|
|
1033
|
+
* {
|
|
1034
|
+
* "type": "tool_use",
|
|
1035
|
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
1036
|
+
* "name": "get_stock_price",
|
|
1037
|
+
* "input": { "ticker": "^GSPC" }
|
|
1038
|
+
* }
|
|
1039
|
+
* ]
|
|
1040
|
+
* ```
|
|
1041
|
+
*
|
|
1042
|
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
|
1043
|
+
* input, and return the following back to the model in a subsequent `user`
|
|
1044
|
+
* message:
|
|
1045
|
+
*
|
|
1046
|
+
* ```json
|
|
1047
|
+
* [
|
|
1048
|
+
* {
|
|
1049
|
+
* "type": "tool_result",
|
|
1050
|
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
1051
|
+
* "content": "259.75 USD"
|
|
1052
|
+
* }
|
|
1053
|
+
* ]
|
|
1054
|
+
* ```
|
|
1055
|
+
*
|
|
1056
|
+
* Tools can be used for workflows that include running client-side tools and
|
|
1057
|
+
* functions, or more generally whenever you want the model to produce a particular
|
|
1058
|
+
* JSON structure of output.
|
|
1059
|
+
*
|
|
1060
|
+
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
|
1061
|
+
*/
|
|
1062
|
+
tools?: Array<BetaTool | BetaToolComputerUse20241022 | BetaToolBash20241022 | BetaToolTextEditor20241022>;
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Header param: Optional header to specify the beta version(s) you want to use.
|
|
1066
|
+
*/
|
|
1067
|
+
betas?: Array<BetaAPI.AnthropicBeta>;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
Messages.Batches = Batches;
|
|
1071
|
+
Messages.BetaMessageBatchesPage = BetaMessageBatchesPage;
|
|
1072
|
+
|
|
1073
|
+
export declare namespace Messages {
|
|
1074
|
+
export {
|
|
1075
|
+
type BetaBase64PDFBlock as BetaBase64PDFBlock,
|
|
1076
|
+
type BetaBase64PDFSource as BetaBase64PDFSource,
|
|
1077
|
+
type BetaCacheControlEphemeral as BetaCacheControlEphemeral,
|
|
1078
|
+
type BetaContentBlock as BetaContentBlock,
|
|
1079
|
+
type BetaContentBlockParam as BetaContentBlockParam,
|
|
1080
|
+
type BetaImageBlockParam as BetaImageBlockParam,
|
|
1081
|
+
type BetaInputJSONDelta as BetaInputJSONDelta,
|
|
1082
|
+
type BetaMessage as BetaMessage,
|
|
1083
|
+
type BetaMessageDeltaUsage as BetaMessageDeltaUsage,
|
|
1084
|
+
type BetaMessageParam as BetaMessageParam,
|
|
1085
|
+
type BetaMessageTokensCount as BetaMessageTokensCount,
|
|
1086
|
+
type BetaMetadata as BetaMetadata,
|
|
1087
|
+
type BetaRawContentBlockDeltaEvent as BetaRawContentBlockDeltaEvent,
|
|
1088
|
+
type BetaRawContentBlockStartEvent as BetaRawContentBlockStartEvent,
|
|
1089
|
+
type BetaRawContentBlockStopEvent as BetaRawContentBlockStopEvent,
|
|
1090
|
+
type BetaRawMessageDeltaEvent as BetaRawMessageDeltaEvent,
|
|
1091
|
+
type BetaRawMessageStartEvent as BetaRawMessageStartEvent,
|
|
1092
|
+
type BetaRawMessageStopEvent as BetaRawMessageStopEvent,
|
|
1093
|
+
type BetaRawMessageStreamEvent as BetaRawMessageStreamEvent,
|
|
1094
|
+
type BetaTextBlock as BetaTextBlock,
|
|
1095
|
+
type BetaTextBlockParam as BetaTextBlockParam,
|
|
1096
|
+
type BetaTextDelta as BetaTextDelta,
|
|
1097
|
+
type BetaTool as BetaTool,
|
|
1098
|
+
type BetaToolBash20241022 as BetaToolBash20241022,
|
|
1099
|
+
type BetaToolChoice as BetaToolChoice,
|
|
1100
|
+
type BetaToolChoiceAny as BetaToolChoiceAny,
|
|
1101
|
+
type BetaToolChoiceAuto as BetaToolChoiceAuto,
|
|
1102
|
+
type BetaToolChoiceTool as BetaToolChoiceTool,
|
|
1103
|
+
type BetaToolComputerUse20241022 as BetaToolComputerUse20241022,
|
|
1104
|
+
type BetaToolResultBlockParam as BetaToolResultBlockParam,
|
|
1105
|
+
type BetaToolTextEditor20241022 as BetaToolTextEditor20241022,
|
|
1106
|
+
type BetaToolUnion as BetaToolUnion,
|
|
1107
|
+
type BetaToolUseBlock as BetaToolUseBlock,
|
|
1108
|
+
type BetaToolUseBlockParam as BetaToolUseBlockParam,
|
|
1109
|
+
type BetaUsage as BetaUsage,
|
|
1110
|
+
type MessageCreateParams as MessageCreateParams,
|
|
1111
|
+
type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming,
|
|
1112
|
+
type MessageCreateParamsStreaming as MessageCreateParamsStreaming,
|
|
1113
|
+
type MessageCountTokensParams as MessageCountTokensParams,
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
export {
|
|
1117
|
+
Batches as Batches,
|
|
1118
|
+
type BetaMessageBatch as BetaMessageBatch,
|
|
1119
|
+
type BetaMessageBatchCanceledResult as BetaMessageBatchCanceledResult,
|
|
1120
|
+
type BetaMessageBatchErroredResult as BetaMessageBatchErroredResult,
|
|
1121
|
+
type BetaMessageBatchExpiredResult as BetaMessageBatchExpiredResult,
|
|
1122
|
+
type BetaMessageBatchIndividualResponse as BetaMessageBatchIndividualResponse,
|
|
1123
|
+
type BetaMessageBatchRequestCounts as BetaMessageBatchRequestCounts,
|
|
1124
|
+
type BetaMessageBatchResult as BetaMessageBatchResult,
|
|
1125
|
+
type BetaMessageBatchSucceededResult as BetaMessageBatchSucceededResult,
|
|
1126
|
+
BetaMessageBatchesPage as BetaMessageBatchesPage,
|
|
1127
|
+
type BatchCreateParams as BatchCreateParams,
|
|
1128
|
+
type BatchRetrieveParams as BatchRetrieveParams,
|
|
1129
|
+
type BatchListParams as BatchListParams,
|
|
1130
|
+
type BatchCancelParams as BatchCancelParams,
|
|
1131
|
+
type BatchResultsParams as BatchResultsParams,
|
|
1132
|
+
};
|
|
838
1133
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export { PromptCaching } from "./prompt-caching.js";
|
|
4
3
|
export {
|
|
5
|
-
PromptCachingBetaCacheControlEphemeral,
|
|
6
|
-
PromptCachingBetaImageBlockParam,
|
|
7
|
-
PromptCachingBetaMessage,
|
|
8
|
-
PromptCachingBetaMessageParam,
|
|
9
|
-
PromptCachingBetaTextBlockParam,
|
|
10
|
-
PromptCachingBetaTool,
|
|
11
|
-
PromptCachingBetaToolResultBlockParam,
|
|
12
|
-
PromptCachingBetaToolUseBlockParam,
|
|
13
|
-
PromptCachingBetaUsage,
|
|
14
|
-
RawPromptCachingBetaMessageStartEvent,
|
|
15
|
-
RawPromptCachingBetaMessageStreamEvent,
|
|
16
|
-
MessageCreateParams,
|
|
17
|
-
MessageCreateParamsNonStreaming,
|
|
18
|
-
MessageCreateParamsStreaming,
|
|
19
4
|
Messages,
|
|
5
|
+
type PromptCachingBetaCacheControlEphemeral,
|
|
6
|
+
type PromptCachingBetaImageBlockParam,
|
|
7
|
+
type PromptCachingBetaMessage,
|
|
8
|
+
type PromptCachingBetaMessageParam,
|
|
9
|
+
type PromptCachingBetaTextBlockParam,
|
|
10
|
+
type PromptCachingBetaTool,
|
|
11
|
+
type PromptCachingBetaToolResultBlockParam,
|
|
12
|
+
type PromptCachingBetaToolUseBlockParam,
|
|
13
|
+
type PromptCachingBetaUsage,
|
|
14
|
+
type RawPromptCachingBetaMessageStartEvent,
|
|
15
|
+
type RawPromptCachingBetaMessageStreamEvent,
|
|
16
|
+
type MessageCreateParams,
|
|
17
|
+
type MessageCreateParamsNonStreaming,
|
|
18
|
+
type MessageCreateParamsStreaming,
|
|
20
19
|
} from "./messages.js";
|
|
20
|
+
export { PromptCaching } from "./prompt-caching.js";
|
|
@@ -213,6 +213,11 @@ export interface PromptCachingBetaTool {
|
|
|
213
213
|
*/
|
|
214
214
|
input_schema: PromptCachingBetaTool.InputSchema;
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Name of the tool.
|
|
218
|
+
*
|
|
219
|
+
* This is how the tool will be called by the model and in tool_use blocks.
|
|
220
|
+
*/
|
|
216
221
|
name: string;
|
|
217
222
|
|
|
218
223
|
cache_control?: PromptCachingBetaCacheControlEphemeral | null;
|
|
@@ -617,19 +622,21 @@ export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
|
|
|
617
622
|
stream: true;
|
|
618
623
|
}
|
|
619
624
|
|
|
620
|
-
export namespace Messages {
|
|
621
|
-
export
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
625
|
+
export declare namespace Messages {
|
|
626
|
+
export {
|
|
627
|
+
type PromptCachingBetaCacheControlEphemeral as PromptCachingBetaCacheControlEphemeral,
|
|
628
|
+
type PromptCachingBetaImageBlockParam as PromptCachingBetaImageBlockParam,
|
|
629
|
+
type PromptCachingBetaMessage as PromptCachingBetaMessage,
|
|
630
|
+
type PromptCachingBetaMessageParam as PromptCachingBetaMessageParam,
|
|
631
|
+
type PromptCachingBetaTextBlockParam as PromptCachingBetaTextBlockParam,
|
|
632
|
+
type PromptCachingBetaTool as PromptCachingBetaTool,
|
|
633
|
+
type PromptCachingBetaToolResultBlockParam as PromptCachingBetaToolResultBlockParam,
|
|
634
|
+
type PromptCachingBetaToolUseBlockParam as PromptCachingBetaToolUseBlockParam,
|
|
635
|
+
type PromptCachingBetaUsage as PromptCachingBetaUsage,
|
|
636
|
+
type RawPromptCachingBetaMessageStartEvent as RawPromptCachingBetaMessageStartEvent,
|
|
637
|
+
type RawPromptCachingBetaMessageStreamEvent as RawPromptCachingBetaMessageStreamEvent,
|
|
638
|
+
type MessageCreateParams as MessageCreateParams,
|
|
639
|
+
type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming,
|
|
640
|
+
type MessageCreateParamsStreaming as MessageCreateParamsStreaming,
|
|
641
|
+
};
|
|
635
642
|
}
|
|
@@ -2,25 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from "../../../resource.js";
|
|
4
4
|
import * as MessagesAPI from "./messages.js";
|
|
5
|
+
import {
|
|
6
|
+
MessageCreateParams,
|
|
7
|
+
MessageCreateParamsNonStreaming,
|
|
8
|
+
MessageCreateParamsStreaming,
|
|
9
|
+
Messages,
|
|
10
|
+
PromptCachingBetaCacheControlEphemeral,
|
|
11
|
+
PromptCachingBetaImageBlockParam,
|
|
12
|
+
PromptCachingBetaMessage,
|
|
13
|
+
PromptCachingBetaMessageParam,
|
|
14
|
+
PromptCachingBetaTextBlockParam,
|
|
15
|
+
PromptCachingBetaTool,
|
|
16
|
+
PromptCachingBetaToolResultBlockParam,
|
|
17
|
+
PromptCachingBetaToolUseBlockParam,
|
|
18
|
+
PromptCachingBetaUsage,
|
|
19
|
+
RawPromptCachingBetaMessageStartEvent,
|
|
20
|
+
RawPromptCachingBetaMessageStreamEvent,
|
|
21
|
+
} from "./messages.js";
|
|
5
22
|
|
|
6
23
|
export class PromptCaching extends APIResource {
|
|
7
24
|
messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
|
|
8
25
|
}
|
|
9
26
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
PromptCaching.Messages = Messages;
|
|
28
|
+
|
|
29
|
+
export declare namespace PromptCaching {
|
|
30
|
+
export {
|
|
31
|
+
Messages as Messages,
|
|
32
|
+
type PromptCachingBetaCacheControlEphemeral as PromptCachingBetaCacheControlEphemeral,
|
|
33
|
+
type PromptCachingBetaImageBlockParam as PromptCachingBetaImageBlockParam,
|
|
34
|
+
type PromptCachingBetaMessage as PromptCachingBetaMessage,
|
|
35
|
+
type PromptCachingBetaMessageParam as PromptCachingBetaMessageParam,
|
|
36
|
+
type PromptCachingBetaTextBlockParam as PromptCachingBetaTextBlockParam,
|
|
37
|
+
type PromptCachingBetaTool as PromptCachingBetaTool,
|
|
38
|
+
type PromptCachingBetaToolResultBlockParam as PromptCachingBetaToolResultBlockParam,
|
|
39
|
+
type PromptCachingBetaToolUseBlockParam as PromptCachingBetaToolUseBlockParam,
|
|
40
|
+
type PromptCachingBetaUsage as PromptCachingBetaUsage,
|
|
41
|
+
type RawPromptCachingBetaMessageStartEvent as RawPromptCachingBetaMessageStartEvent,
|
|
42
|
+
type RawPromptCachingBetaMessageStreamEvent as RawPromptCachingBetaMessageStreamEvent,
|
|
43
|
+
type MessageCreateParams as MessageCreateParams,
|
|
44
|
+
type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming,
|
|
45
|
+
type MessageCreateParamsStreaming as MessageCreateParamsStreaming,
|
|
46
|
+
};
|
|
26
47
|
}
|
|
@@ -200,9 +200,11 @@ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsB
|
|
|
200
200
|
stream: true;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
export namespace Completions {
|
|
204
|
-
export
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
export declare namespace Completions {
|
|
204
|
+
export {
|
|
205
|
+
type Completion as Completion,
|
|
206
|
+
type CompletionCreateParams as CompletionCreateParams,
|
|
207
|
+
type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming,
|
|
208
|
+
type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming,
|
|
209
|
+
};
|
|
208
210
|
}
|