@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
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { APIResource } from "
|
|
2
|
-
import { APIPromise } from "
|
|
3
|
-
import * as Core from "
|
|
1
|
+
import { APIResource } from "../../resource.js";
|
|
2
|
+
import { APIPromise } from "../../core.js";
|
|
3
|
+
import * as Core from "../../core.js";
|
|
4
4
|
import * as MessagesAPI from "./messages.js";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import * as BatchesAPI from "./batches.js";
|
|
6
|
+
import { BatchCreateParams, BatchListParams, Batches, MessageBatch, MessageBatchCanceledResult, MessageBatchErroredResult, MessageBatchExpiredResult, MessageBatchIndividualResponse, MessageBatchRequestCounts, MessageBatchResult, MessageBatchSucceededResult, MessageBatchesPage } from "./batches.js";
|
|
7
|
+
import { Stream } from "../../streaming.js";
|
|
8
|
+
import { MessageStream } from "../../lib/MessageStream.js";
|
|
9
|
+
export { MessageStream } from "../../lib/MessageStream.js";
|
|
8
10
|
export declare class Messages extends APIResource {
|
|
11
|
+
batches: BatchesAPI.Batches;
|
|
9
12
|
/**
|
|
10
13
|
* Send a structured list of input messages with text and/or image content, and the
|
|
11
14
|
* model will generate the next message in the conversation.
|
|
@@ -20,14 +23,36 @@ export declare class Messages extends APIResource {
|
|
|
20
23
|
* Create a Message stream
|
|
21
24
|
*/
|
|
22
25
|
stream(body: MessageStreamParams, options?: Core.RequestOptions): MessageStream;
|
|
26
|
+
/**
|
|
27
|
+
* Count the number of tokens in a Message.
|
|
28
|
+
*
|
|
29
|
+
* The Token Count API can be used to count the number of tokens in a Message,
|
|
30
|
+
* including tools, images, and documents, without creating it.
|
|
31
|
+
*/
|
|
32
|
+
countTokens(body: MessageCountTokensParams, options?: Core.RequestOptions): Core.APIPromise<MessageTokensCount>;
|
|
33
|
+
}
|
|
34
|
+
export interface Base64PDFSource {
|
|
35
|
+
data: string;
|
|
36
|
+
media_type: 'application/pdf';
|
|
37
|
+
type: 'base64';
|
|
38
|
+
}
|
|
39
|
+
export interface CacheControlEphemeral {
|
|
40
|
+
type: 'ephemeral';
|
|
23
41
|
}
|
|
24
42
|
export type ContentBlock = TextBlock | ToolUseBlock;
|
|
25
43
|
export type ContentBlockDeltaEvent = RawContentBlockDeltaEvent;
|
|
44
|
+
export type ContentBlockParam = TextBlockParam | ImageBlockParam | ToolUseBlockParam | ToolResultBlockParam | DocumentBlockParam;
|
|
26
45
|
export type ContentBlockStartEvent = RawContentBlockStartEvent;
|
|
27
46
|
export type ContentBlockStopEvent = RawContentBlockStopEvent;
|
|
47
|
+
export interface DocumentBlockParam {
|
|
48
|
+
source: Base64PDFSource;
|
|
49
|
+
type: 'document';
|
|
50
|
+
cache_control?: CacheControlEphemeral | null;
|
|
51
|
+
}
|
|
28
52
|
export interface ImageBlockParam {
|
|
29
53
|
source: ImageBlockParam.Source;
|
|
30
54
|
type: 'image';
|
|
55
|
+
cache_control?: CacheControlEphemeral | null;
|
|
31
56
|
}
|
|
32
57
|
export declare namespace ImageBlockParam {
|
|
33
58
|
interface Source {
|
|
@@ -146,12 +171,19 @@ export interface MessageDeltaUsage {
|
|
|
146
171
|
output_tokens: number;
|
|
147
172
|
}
|
|
148
173
|
export interface MessageParam {
|
|
149
|
-
content: string | Array<
|
|
174
|
+
content: string | Array<ContentBlockParam>;
|
|
150
175
|
role: 'user' | 'assistant';
|
|
151
176
|
}
|
|
152
177
|
export type MessageStartEvent = RawMessageStartEvent;
|
|
153
178
|
export type MessageStopEvent = RawMessageStopEvent;
|
|
154
179
|
export type MessageStreamEvent = RawMessageStreamEvent;
|
|
180
|
+
export interface MessageTokensCount {
|
|
181
|
+
/**
|
|
182
|
+
* The total number of tokens across the provided list of messages, system prompt,
|
|
183
|
+
* and tools.
|
|
184
|
+
*/
|
|
185
|
+
input_tokens: number;
|
|
186
|
+
}
|
|
155
187
|
export interface Metadata {
|
|
156
188
|
/**
|
|
157
189
|
* An external identifier for the user who is associated with the request.
|
|
@@ -167,7 +199,7 @@ export interface Metadata {
|
|
|
167
199
|
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
168
200
|
* details and options.
|
|
169
201
|
*/
|
|
170
|
-
export type Model = (string & {}) | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | 'claude-2.1' | 'claude-2.0'
|
|
202
|
+
export type Model = (string & {}) | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | 'claude-2.1' | 'claude-2.0';
|
|
171
203
|
export interface RawContentBlockDeltaEvent {
|
|
172
204
|
delta: TextDelta | InputJSONDelta;
|
|
173
205
|
index: number;
|
|
@@ -222,6 +254,7 @@ export interface TextBlock {
|
|
|
222
254
|
export interface TextBlockParam {
|
|
223
255
|
text: string;
|
|
224
256
|
type: 'text';
|
|
257
|
+
cache_control?: CacheControlEphemeral | null;
|
|
225
258
|
}
|
|
226
259
|
export interface TextDelta {
|
|
227
260
|
text: string;
|
|
@@ -241,6 +274,7 @@ export interface Tool {
|
|
|
241
274
|
* This is how the tool will be called by the model and in tool_use blocks.
|
|
242
275
|
*/
|
|
243
276
|
name: string;
|
|
277
|
+
cache_control?: CacheControlEphemeral | null;
|
|
244
278
|
/**
|
|
245
279
|
* Description of what this tool does.
|
|
246
280
|
*
|
|
@@ -315,6 +349,7 @@ export interface ToolChoiceTool {
|
|
|
315
349
|
export interface ToolResultBlockParam {
|
|
316
350
|
tool_use_id: string;
|
|
317
351
|
type: 'tool_result';
|
|
352
|
+
cache_control?: CacheControlEphemeral | null;
|
|
318
353
|
content?: string | Array<TextBlockParam | ImageBlockParam>;
|
|
319
354
|
is_error?: boolean;
|
|
320
355
|
}
|
|
@@ -329,8 +364,17 @@ export interface ToolUseBlockParam {
|
|
|
329
364
|
input: unknown;
|
|
330
365
|
name: string;
|
|
331
366
|
type: 'tool_use';
|
|
367
|
+
cache_control?: CacheControlEphemeral | null;
|
|
332
368
|
}
|
|
333
369
|
export interface Usage {
|
|
370
|
+
/**
|
|
371
|
+
* The number of input tokens used to create the cache entry.
|
|
372
|
+
*/
|
|
373
|
+
cache_creation_input_tokens: number | null;
|
|
374
|
+
/**
|
|
375
|
+
* The number of input tokens read from the cache.
|
|
376
|
+
*/
|
|
377
|
+
cache_read_input_tokens: number | null;
|
|
334
378
|
/**
|
|
335
379
|
* The number of input tokens which were used.
|
|
336
380
|
*/
|
|
@@ -627,7 +671,189 @@ export interface MessageCreateParamsStreaming extends MessageCreateParamsBase {
|
|
|
627
671
|
stream: true;
|
|
628
672
|
}
|
|
629
673
|
export type MessageStreamParams = MessageCreateParamsBase;
|
|
674
|
+
export interface MessageCountTokensParams {
|
|
675
|
+
/**
|
|
676
|
+
* Input messages.
|
|
677
|
+
*
|
|
678
|
+
* Our models are trained to operate on alternating `user` and `assistant`
|
|
679
|
+
* conversational turns. When creating a new `Message`, you specify the prior
|
|
680
|
+
* conversational turns with the `messages` parameter, and the model then generates
|
|
681
|
+
* the next `Message` in the conversation. Consecutive `user` or `assistant` turns
|
|
682
|
+
* in your request will be combined into a single turn.
|
|
683
|
+
*
|
|
684
|
+
* Each input message must be an object with a `role` and `content`. You can
|
|
685
|
+
* specify a single `user`-role message, or you can include multiple `user` and
|
|
686
|
+
* `assistant` messages.
|
|
687
|
+
*
|
|
688
|
+
* If the final message uses the `assistant` role, the response content will
|
|
689
|
+
* continue immediately from the content in that message. This can be used to
|
|
690
|
+
* constrain part of the model's response.
|
|
691
|
+
*
|
|
692
|
+
* Example with a single `user` message:
|
|
693
|
+
*
|
|
694
|
+
* ```json
|
|
695
|
+
* [{ "role": "user", "content": "Hello, Claude" }]
|
|
696
|
+
* ```
|
|
697
|
+
*
|
|
698
|
+
* Example with multiple conversational turns:
|
|
699
|
+
*
|
|
700
|
+
* ```json
|
|
701
|
+
* [
|
|
702
|
+
* { "role": "user", "content": "Hello there." },
|
|
703
|
+
* { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" },
|
|
704
|
+
* { "role": "user", "content": "Can you explain LLMs in plain English?" }
|
|
705
|
+
* ]
|
|
706
|
+
* ```
|
|
707
|
+
*
|
|
708
|
+
* Example with a partially-filled response from Claude:
|
|
709
|
+
*
|
|
710
|
+
* ```json
|
|
711
|
+
* [
|
|
712
|
+
* {
|
|
713
|
+
* "role": "user",
|
|
714
|
+
* "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"
|
|
715
|
+
* },
|
|
716
|
+
* { "role": "assistant", "content": "The best answer is (" }
|
|
717
|
+
* ]
|
|
718
|
+
* ```
|
|
719
|
+
*
|
|
720
|
+
* Each input message `content` may be either a single `string` or an array of
|
|
721
|
+
* content blocks, where each block has a specific `type`. Using a `string` for
|
|
722
|
+
* `content` is shorthand for an array of one content block of type `"text"`. The
|
|
723
|
+
* following input messages are equivalent:
|
|
724
|
+
*
|
|
725
|
+
* ```json
|
|
726
|
+
* { "role": "user", "content": "Hello, Claude" }
|
|
727
|
+
* ```
|
|
728
|
+
*
|
|
729
|
+
* ```json
|
|
730
|
+
* { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] }
|
|
731
|
+
* ```
|
|
732
|
+
*
|
|
733
|
+
* Starting with Claude 3 models, you can also send image content blocks:
|
|
734
|
+
*
|
|
735
|
+
* ```json
|
|
736
|
+
* {
|
|
737
|
+
* "role": "user",
|
|
738
|
+
* "content": [
|
|
739
|
+
* {
|
|
740
|
+
* "type": "image",
|
|
741
|
+
* "source": {
|
|
742
|
+
* "type": "base64",
|
|
743
|
+
* "media_type": "image/jpeg",
|
|
744
|
+
* "data": "/9j/4AAQSkZJRg..."
|
|
745
|
+
* }
|
|
746
|
+
* },
|
|
747
|
+
* { "type": "text", "text": "What is in this image?" }
|
|
748
|
+
* ]
|
|
749
|
+
* }
|
|
750
|
+
* ```
|
|
751
|
+
*
|
|
752
|
+
* We currently support the `base64` source type for images, and the `image/jpeg`,
|
|
753
|
+
* `image/png`, `image/gif`, and `image/webp` media types.
|
|
754
|
+
*
|
|
755
|
+
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for
|
|
756
|
+
* more input examples.
|
|
757
|
+
*
|
|
758
|
+
* Note that if you want to include a
|
|
759
|
+
* [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use
|
|
760
|
+
* the top-level `system` parameter — there is no `"system"` role for input
|
|
761
|
+
* messages in the Messages API.
|
|
762
|
+
*/
|
|
763
|
+
messages: Array<MessageParam>;
|
|
764
|
+
/**
|
|
765
|
+
* The model that will complete your prompt.\n\nSee
|
|
766
|
+
* [models](https://docs.anthropic.com/en/docs/models-overview) for additional
|
|
767
|
+
* details and options.
|
|
768
|
+
*/
|
|
769
|
+
model: Model;
|
|
770
|
+
/**
|
|
771
|
+
* System prompt.
|
|
772
|
+
*
|
|
773
|
+
* A system prompt is a way of providing context and instructions to Claude, such
|
|
774
|
+
* as specifying a particular goal or role. See our
|
|
775
|
+
* [guide to system prompts](https://docs.anthropic.com/en/docs/system-prompts).
|
|
776
|
+
*/
|
|
777
|
+
system?: string | Array<TextBlockParam>;
|
|
778
|
+
/**
|
|
779
|
+
* How the model should use the provided tools. The model can use a specific tool,
|
|
780
|
+
* any available tool, or decide by itself.
|
|
781
|
+
*/
|
|
782
|
+
tool_choice?: ToolChoice;
|
|
783
|
+
/**
|
|
784
|
+
* Definitions of tools that the model may use.
|
|
785
|
+
*
|
|
786
|
+
* If you include `tools` in your API request, the model may return `tool_use`
|
|
787
|
+
* content blocks that represent the model's use of those tools. You can then run
|
|
788
|
+
* those tools using the tool input generated by the model and then optionally
|
|
789
|
+
* return results back to the model using `tool_result` content blocks.
|
|
790
|
+
*
|
|
791
|
+
* Each tool definition includes:
|
|
792
|
+
*
|
|
793
|
+
* - `name`: Name of the tool.
|
|
794
|
+
* - `description`: Optional, but strongly-recommended description of the tool.
|
|
795
|
+
* - `input_schema`: [JSON schema](https://json-schema.org/) for the tool `input`
|
|
796
|
+
* shape that the model will produce in `tool_use` output content blocks.
|
|
797
|
+
*
|
|
798
|
+
* For example, if you defined `tools` as:
|
|
799
|
+
*
|
|
800
|
+
* ```json
|
|
801
|
+
* [
|
|
802
|
+
* {
|
|
803
|
+
* "name": "get_stock_price",
|
|
804
|
+
* "description": "Get the current stock price for a given ticker symbol.",
|
|
805
|
+
* "input_schema": {
|
|
806
|
+
* "type": "object",
|
|
807
|
+
* "properties": {
|
|
808
|
+
* "ticker": {
|
|
809
|
+
* "type": "string",
|
|
810
|
+
* "description": "The stock ticker symbol, e.g. AAPL for Apple Inc."
|
|
811
|
+
* }
|
|
812
|
+
* },
|
|
813
|
+
* "required": ["ticker"]
|
|
814
|
+
* }
|
|
815
|
+
* }
|
|
816
|
+
* ]
|
|
817
|
+
* ```
|
|
818
|
+
*
|
|
819
|
+
* And then asked the model "What's the S&P 500 at today?", the model might produce
|
|
820
|
+
* `tool_use` content blocks in the response like this:
|
|
821
|
+
*
|
|
822
|
+
* ```json
|
|
823
|
+
* [
|
|
824
|
+
* {
|
|
825
|
+
* "type": "tool_use",
|
|
826
|
+
* "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
827
|
+
* "name": "get_stock_price",
|
|
828
|
+
* "input": { "ticker": "^GSPC" }
|
|
829
|
+
* }
|
|
830
|
+
* ]
|
|
831
|
+
* ```
|
|
832
|
+
*
|
|
833
|
+
* You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an
|
|
834
|
+
* input, and return the following back to the model in a subsequent `user`
|
|
835
|
+
* message:
|
|
836
|
+
*
|
|
837
|
+
* ```json
|
|
838
|
+
* [
|
|
839
|
+
* {
|
|
840
|
+
* "type": "tool_result",
|
|
841
|
+
* "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
|
|
842
|
+
* "content": "259.75 USD"
|
|
843
|
+
* }
|
|
844
|
+
* ]
|
|
845
|
+
* ```
|
|
846
|
+
*
|
|
847
|
+
* Tools can be used for workflows that include running client-side tools and
|
|
848
|
+
* functions, or more generally whenever you want the model to produce a particular
|
|
849
|
+
* JSON structure of output.
|
|
850
|
+
*
|
|
851
|
+
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
|
|
852
|
+
*/
|
|
853
|
+
tools?: Array<Tool>;
|
|
854
|
+
}
|
|
630
855
|
export declare namespace Messages {
|
|
631
|
-
export { type ContentBlock as ContentBlock, type ContentBlockDeltaEvent as ContentBlockDeltaEvent, type ContentBlockStartEvent as ContentBlockStartEvent, type ContentBlockStopEvent as ContentBlockStopEvent, type ImageBlockParam as ImageBlockParam, type InputJsonDelta as InputJsonDelta, type InputJSONDelta as InputJSONDelta, type Message as Message, type MessageDeltaEvent as MessageDeltaEvent, type MessageDeltaUsage as MessageDeltaUsage, type MessageParam as MessageParam, type MessageStartEvent as MessageStartEvent, type MessageStopEvent as MessageStopEvent, type MessageStreamEvent as MessageStreamEvent, type Metadata as Metadata, type Model as Model, type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent, type RawContentBlockStartEvent as RawContentBlockStartEvent, type RawContentBlockStopEvent as RawContentBlockStopEvent, type RawMessageDeltaEvent as RawMessageDeltaEvent, type RawMessageStartEvent as RawMessageStartEvent, type RawMessageStopEvent as RawMessageStopEvent, type RawMessageStreamEvent as RawMessageStreamEvent, type TextBlock as TextBlock, type TextBlockParam as TextBlockParam, type TextDelta as TextDelta, type Tool as Tool, type ToolChoice as ToolChoice, type ToolChoiceAny as ToolChoiceAny, type ToolChoiceAuto as ToolChoiceAuto, type ToolChoiceTool as ToolChoiceTool, type ToolResultBlockParam as ToolResultBlockParam, type ToolUseBlock as ToolUseBlock, type ToolUseBlockParam as ToolUseBlockParam, type Usage as Usage, type MessageCreateParams as MessageCreateParams, type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming, type MessageCreateParamsStreaming as MessageCreateParamsStreaming, type MessageStreamParams as MessageStreamParams, };
|
|
856
|
+
export { type Base64PDFSource as Base64PDFSource, type CacheControlEphemeral as CacheControlEphemeral, type ContentBlock as ContentBlock, type ContentBlockDeltaEvent as ContentBlockDeltaEvent, type ContentBlockParam as ContentBlockParam, type ContentBlockStartEvent as ContentBlockStartEvent, type ContentBlockStopEvent as ContentBlockStopEvent, type DocumentBlockParam as DocumentBlockParam, type ImageBlockParam as ImageBlockParam, type InputJsonDelta as InputJsonDelta, type InputJSONDelta as InputJSONDelta, type Message as Message, type MessageDeltaEvent as MessageDeltaEvent, type MessageDeltaUsage as MessageDeltaUsage, type MessageParam as MessageParam, type MessageStartEvent as MessageStartEvent, type MessageStopEvent as MessageStopEvent, type MessageStreamEvent as MessageStreamEvent, type MessageTokensCount as MessageTokensCount, type Metadata as Metadata, type Model as Model, type RawContentBlockDeltaEvent as RawContentBlockDeltaEvent, type RawContentBlockStartEvent as RawContentBlockStartEvent, type RawContentBlockStopEvent as RawContentBlockStopEvent, type RawMessageDeltaEvent as RawMessageDeltaEvent, type RawMessageStartEvent as RawMessageStartEvent, type RawMessageStopEvent as RawMessageStopEvent, type RawMessageStreamEvent as RawMessageStreamEvent, type TextBlock as TextBlock, type TextBlockParam as TextBlockParam, type TextDelta as TextDelta, type Tool as Tool, type ToolChoice as ToolChoice, type ToolChoiceAny as ToolChoiceAny, type ToolChoiceAuto as ToolChoiceAuto, type ToolChoiceTool as ToolChoiceTool, type ToolResultBlockParam as ToolResultBlockParam, type ToolUseBlock as ToolUseBlock, type ToolUseBlockParam as ToolUseBlockParam, type Usage as Usage, type MessageCreateParams as MessageCreateParams, type MessageCreateParamsNonStreaming as MessageCreateParamsNonStreaming, type MessageCreateParamsStreaming as MessageCreateParamsStreaming, type MessageStreamParams as MessageStreamParams, type MessageCountTokensParams as MessageCountTokensParams, };
|
|
857
|
+
export { Batches as Batches, type MessageBatch as MessageBatch, type MessageBatchCanceledResult as MessageBatchCanceledResult, type MessageBatchErroredResult as MessageBatchErroredResult, type MessageBatchExpiredResult as MessageBatchExpiredResult, type MessageBatchIndividualResponse as MessageBatchIndividualResponse, type MessageBatchRequestCounts as MessageBatchRequestCounts, type MessageBatchResult as MessageBatchResult, type MessageBatchSucceededResult as MessageBatchSucceededResult, MessageBatchesPage as MessageBatchesPage, type BatchCreateParams as BatchCreateParams, type BatchListParams as BatchListParams, };
|
|
632
858
|
}
|
|
633
859
|
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/resources/messages/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,WAAW,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,UAAU,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,OAAO,EACP,YAAY,EACZ,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,8BAA8B,EAC9B,yBAAyB,EACzB,kBAAkB,EAClB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,qBAAa,QAAS,SAAQ,WAAW;IACvC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;IAEnE;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,+BAA+B,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;IACjG,MAAM,CACJ,IAAI,EAAE,4BAA4B,EAClC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,UAAU,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IAC5C,MAAM,CACJ,IAAI,EAAE,uBAAuB,EAC7B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,UAAU,CAAC,MAAM,CAAC,qBAAqB,C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IAAI,kBAAkB,EACxC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,eAAe,IAAI,eAAe,GACxC,CAAC;CACH"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Messages = exports.MessageStream = void 0;
|
|
28
|
+
const resource_1 = require("../../resource.js");
|
|
29
|
+
const BatchesAPI = __importStar(require("./batches.js"));
|
|
30
|
+
const batches_1 = require("./batches.js");
|
|
31
|
+
const MessageStream_1 = require("../../lib/MessageStream.js");
|
|
32
|
+
var MessageStream_2 = require("../../lib/MessageStream.js");
|
|
33
|
+
Object.defineProperty(exports, "MessageStream", { enumerable: true, get: function () { return MessageStream_2.MessageStream; } });
|
|
34
|
+
class Messages extends resource_1.APIResource {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
this.batches = new BatchesAPI.Batches(this._client);
|
|
38
|
+
}
|
|
39
|
+
create(body, options) {
|
|
40
|
+
if (body.model in DEPRECATED_MODELS) {
|
|
41
|
+
console.warn(`The model '${body.model}' is deprecated and will reach end-of-life on ${DEPRECATED_MODELS[body.model]}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);
|
|
42
|
+
}
|
|
43
|
+
return this._client.post('/v1/messages', {
|
|
44
|
+
body,
|
|
45
|
+
timeout: this._client._options.timeout ?? 600000,
|
|
46
|
+
...options,
|
|
47
|
+
stream: body.stream ?? false,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create a Message stream
|
|
52
|
+
*/
|
|
53
|
+
stream(body, options) {
|
|
54
|
+
return MessageStream_1.MessageStream.createMessage(this, body, options);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Count the number of tokens in a Message.
|
|
58
|
+
*
|
|
59
|
+
* The Token Count API can be used to count the number of tokens in a Message,
|
|
60
|
+
* including tools, images, and documents, without creating it.
|
|
61
|
+
*/
|
|
62
|
+
countTokens(body, options) {
|
|
63
|
+
return this._client.post('/v1/messages/count_tokens', { body, ...options });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.Messages = Messages;
|
|
67
|
+
const DEPRECATED_MODELS = {
|
|
68
|
+
'claude-1.3': 'November 6th, 2024',
|
|
69
|
+
'claude-1.3-100k': 'November 6th, 2024',
|
|
70
|
+
'claude-instant-1.1': 'November 6th, 2024',
|
|
71
|
+
'claude-instant-1.1-100k': 'November 6th, 2024',
|
|
72
|
+
'claude-instant-1.2': 'November 6th, 2024',
|
|
73
|
+
};
|
|
74
|
+
Messages.Batches = batches_1.Batches;
|
|
75
|
+
Messages.MessageBatchesPage = batches_1.MessageBatchesPage;
|
|
76
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/resources/messages/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAI7C,yDAAwC;AACxC,0CAamB;AAEnB,8DAAwD;AAExD,4DAAwD;AAA/C,8GAAA,aAAa,OAAA;AAEtB,MAAa,QAAS,SAAQ,sBAAW;IAAzC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAwDrE,CAAC;IAtCC,MAAM,CACJ,IAAyB,EACzB,OAA6B;QAE7B,IAAI,IAAI,CAAC,KAAK,IAAI,iBAAiB,EAAE;YACnC,OAAO,CAAC,IAAI,CACV,cAAc,IAAI,CAAC,KAAK,iDACtB,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAC9B,gIAAgI,CACjI,CAAC;SACH;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,IAAI;YACJ,OAAO,EAAG,IAAI,CAAC,OAAe,CAAC,QAAQ,CAAC,OAAO,IAAI,MAAM;YACzD,GAAG,OAAO;YACV,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;SAC7B,CAAoE,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAA6B;QAC7D,OAAO,6BAAa,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACH,WAAW,CACT,IAA8B,EAC9B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF;AAzDD,4BAyDC;AAuOD,MAAM,iBAAiB,GAAyB;IAC9C,YAAY,EAAE,oBAAoB;IAClC,iBAAiB,EAAE,oBAAoB;IACvC,oBAAoB,EAAE,oBAAoB;IAC1C,yBAAyB,EAAE,oBAAoB;IAC/C,oBAAoB,EAAE,oBAAoB;CAC3C,CAAC;AAsuBF,QAAQ,CAAC,OAAO,GAAG,iBAAO,CAAC;AAC3B,QAAQ,CAAC,kBAAkB,GAAG,4BAAkB,CAAC"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { APIResource } from "
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
import { APIResource } from "../../resource.mjs";
|
|
3
|
+
import * as BatchesAPI from "./batches.mjs";
|
|
4
|
+
import { Batches, MessageBatchesPage, } from "./batches.mjs";
|
|
5
|
+
import { MessageStream } from "../../lib/MessageStream.mjs";
|
|
6
|
+
export { MessageStream } from "../../lib/MessageStream.mjs";
|
|
5
7
|
export class Messages extends APIResource {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.batches = new BatchesAPI.Batches(this._client);
|
|
11
|
+
}
|
|
6
12
|
create(body, options) {
|
|
7
13
|
if (body.model in DEPRECATED_MODELS) {
|
|
8
14
|
console.warn(`The model '${body.model}' is deprecated and will reach end-of-life on ${DEPRECATED_MODELS[body.model]}\nPlease migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);
|
|
@@ -20,6 +26,15 @@ export class Messages extends APIResource {
|
|
|
20
26
|
stream(body, options) {
|
|
21
27
|
return MessageStream.createMessage(this, body, options);
|
|
22
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Count the number of tokens in a Message.
|
|
31
|
+
*
|
|
32
|
+
* The Token Count API can be used to count the number of tokens in a Message,
|
|
33
|
+
* including tools, images, and documents, without creating it.
|
|
34
|
+
*/
|
|
35
|
+
countTokens(body, options) {
|
|
36
|
+
return this._client.post('/v1/messages/count_tokens', { body, ...options });
|
|
37
|
+
}
|
|
23
38
|
}
|
|
24
39
|
const DEPRECATED_MODELS = {
|
|
25
40
|
'claude-1.3': 'November 6th, 2024',
|
|
@@ -28,4 +43,6 @@ const DEPRECATED_MODELS = {
|
|
|
28
43
|
'claude-instant-1.1-100k': 'November 6th, 2024',
|
|
29
44
|
'claude-instant-1.2': 'November 6th, 2024',
|
|
30
45
|
};
|
|
46
|
+
Messages.Batches = Batches;
|
|
47
|
+
Messages.MessageBatchesPage = MessageBatchesPage;
|
|
31
48
|
//# sourceMappingURL=messages.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../../src/resources/messages/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,KAAK,UAAU;OACf,EAGL,OAAO,EASP,kBAAkB,GACnB;OAEM,EAAE,aAAa,EAAE;OAEjB,EAAE,aAAa,EAAE;AAExB,MAAM,OAAO,QAAS,SAAQ,WAAW;IAAzC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAwDrE,CAAC;IAtCC,MAAM,CACJ,IAAyB,EACzB,OAA6B;QAE7B,IAAI,IAAI,CAAC,KAAK,IAAI,iBAAiB,EAAE;YACnC,OAAO,CAAC,IAAI,CACV,cAAc,IAAI,CAAC,KAAK,iDACtB,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAC9B,gIAAgI,CACjI,CAAC;SACH;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE;YACvC,IAAI;YACJ,OAAO,EAAG,IAAI,CAAC,OAAe,CAAC,QAAQ,CAAC,OAAO,IAAI,MAAM;YACzD,GAAG,OAAO;YACV,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;SAC7B,CAAoE,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAA6B;QAC7D,OAAO,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACH,WAAW,CACT,IAA8B,EAC9B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF;AAuOD,MAAM,iBAAiB,GAAyB;IAC9C,YAAY,EAAE,oBAAoB;IAClC,iBAAiB,EAAE,oBAAoB;IACvC,oBAAoB,EAAE,oBAAoB;IAC1C,yBAAyB,EAAE,oBAAoB;IAC/C,oBAAoB,EAAE,oBAAoB;CAC3C,CAAC;AAsuBF,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,QAAQ,CAAC,kBAAkB,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { APIResource } from "../resource.js";
|
|
2
|
+
import * as Core from "../core.js";
|
|
3
|
+
import { Page, type PageParams } from "../pagination.js";
|
|
4
|
+
export declare class Models extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Get a specific model.
|
|
7
|
+
*
|
|
8
|
+
* The Models API response can be used to determine information about a specific
|
|
9
|
+
* model or resolve a model alias to a model ID.
|
|
10
|
+
*/
|
|
11
|
+
retrieve(modelId: string, options?: Core.RequestOptions): Core.APIPromise<ModelInfo>;
|
|
12
|
+
/**
|
|
13
|
+
* List available models.
|
|
14
|
+
*
|
|
15
|
+
* The Models API response can be used to determine which models are available for
|
|
16
|
+
* use in the API. More recently released models are listed first.
|
|
17
|
+
*/
|
|
18
|
+
list(query?: ModelListParams, options?: Core.RequestOptions): Core.PagePromise<ModelInfosPage, ModelInfo>;
|
|
19
|
+
list(options?: Core.RequestOptions): Core.PagePromise<ModelInfosPage, ModelInfo>;
|
|
20
|
+
}
|
|
21
|
+
export declare class ModelInfosPage extends Page<ModelInfo> {
|
|
22
|
+
}
|
|
23
|
+
export interface ModelInfo {
|
|
24
|
+
/**
|
|
25
|
+
* Unique model identifier.
|
|
26
|
+
*/
|
|
27
|
+
id: string;
|
|
28
|
+
/**
|
|
29
|
+
* RFC 3339 datetime string representing the time at which the model was released.
|
|
30
|
+
* May be set to an epoch value if the release date is unknown.
|
|
31
|
+
*/
|
|
32
|
+
created_at: string;
|
|
33
|
+
/**
|
|
34
|
+
* A human-readable name for the model.
|
|
35
|
+
*/
|
|
36
|
+
display_name: string;
|
|
37
|
+
/**
|
|
38
|
+
* Object type.
|
|
39
|
+
*
|
|
40
|
+
* For Models, this is always `"model"`.
|
|
41
|
+
*/
|
|
42
|
+
type: 'model';
|
|
43
|
+
}
|
|
44
|
+
export interface ModelListParams extends PageParams {
|
|
45
|
+
}
|
|
46
|
+
export declare namespace Models {
|
|
47
|
+
export { type ModelInfo as ModelInfo, ModelInfosPage as ModelInfosPage, type ModelListParams as ModelListParams, };
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;IAIpF;;;;;OAKG;IACH,IAAI,CAAC,KAAK,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,SAAS,CAAC;IACzG,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,SAAS,CAAC;CAUjF;AAED,qBAAa,cAAe,SAAQ,IAAI,CAAC,SAAS,CAAC;CAAG;AAEtD,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;CAAG;AAItD,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,SAAS,IAAI,SAAS,EAC3B,cAAc,IAAI,cAAc,EAChC,KAAK,eAAe,IAAI,eAAe,GACxC,CAAC;CACH"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ModelInfosPage = exports.Models = void 0;
|
|
5
|
+
const resource_1 = require("../resource.js");
|
|
6
|
+
const core_1 = require("../core.js");
|
|
7
|
+
const pagination_1 = require("../pagination.js");
|
|
8
|
+
class Models extends resource_1.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, options) {
|
|
16
|
+
return this._client.get(`/v1/models/${modelId}`, options);
|
|
17
|
+
}
|
|
18
|
+
list(query = {}, options) {
|
|
19
|
+
if ((0, core_1.isRequestOptions)(query)) {
|
|
20
|
+
return this.list({}, query);
|
|
21
|
+
}
|
|
22
|
+
return this._client.getAPIList('/v1/models', ModelInfosPage, { query, ...options });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.Models = Models;
|
|
26
|
+
class ModelInfosPage extends pagination_1.Page {
|
|
27
|
+
}
|
|
28
|
+
exports.ModelInfosPage = ModelInfosPage;
|
|
29
|
+
Models.ModelInfosPage = ModelInfosPage;
|
|
30
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAC1C,qCAA2C;AAE3C,iDAAsD;AAEtD,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,OAAe,EAAE,OAA6B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAUD,IAAI,CACF,QAA+C,EAAE,EACjD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;CACF;AA5BD,wBA4BC;AAED,MAAa,cAAe,SAAQ,iBAAe;CAAG;AAAtD,wCAAsD;AA6BtD,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../resource.mjs";
|
|
3
|
+
import { isRequestOptions } from "../core.mjs";
|
|
4
|
+
import { Page } from "../pagination.mjs";
|
|
5
|
+
export class Models extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Get a specific model.
|
|
8
|
+
*
|
|
9
|
+
* The Models API response can be used to determine information about a specific
|
|
10
|
+
* model or resolve a model alias to a model ID.
|
|
11
|
+
*/
|
|
12
|
+
retrieve(modelId, options) {
|
|
13
|
+
return this._client.get(`/v1/models/${modelId}`, options);
|
|
14
|
+
}
|
|
15
|
+
list(query = {}, options) {
|
|
16
|
+
if (isRequestOptions(query)) {
|
|
17
|
+
return this.list({}, query);
|
|
18
|
+
}
|
|
19
|
+
return this._client.getAPIList('/v1/models', ModelInfosPage, { query, ...options });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export class ModelInfosPage extends Page {
|
|
23
|
+
}
|
|
24
|
+
Models.ModelInfosPage = ModelInfosPage;
|
|
25
|
+
//# sourceMappingURL=models.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.mjs","sourceRoot":"","sources":["../src/resources/models.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAEpB,EAAE,IAAI,EAAmB;AAEhC,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,OAAe,EAAE,OAA6B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAUD,IAAI,CACF,QAA+C,EAAE,EACjD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,IAAe;CAAG;AA6BtD,MAAM,CAAC,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface APIErrorObject {
|
|
2
|
+
message: string;
|
|
3
|
+
type: 'api_error';
|
|
4
|
+
}
|
|
5
|
+
export interface AuthenticationError {
|
|
6
|
+
message: string;
|
|
7
|
+
type: 'authentication_error';
|
|
8
|
+
}
|
|
9
|
+
export interface BillingError {
|
|
10
|
+
message: string;
|
|
11
|
+
type: 'billing_error';
|
|
12
|
+
}
|
|
13
|
+
export type ErrorObject = InvalidRequestError | AuthenticationError | BillingError | PermissionError | NotFoundError | RateLimitError | GatewayTimeoutError | APIErrorObject | OverloadedError;
|
|
14
|
+
export interface ErrorResponse {
|
|
15
|
+
error: ErrorObject;
|
|
16
|
+
type: 'error';
|
|
17
|
+
}
|
|
18
|
+
export interface GatewayTimeoutError {
|
|
19
|
+
message: string;
|
|
20
|
+
type: 'timeout_error';
|
|
21
|
+
}
|
|
22
|
+
export interface InvalidRequestError {
|
|
23
|
+
message: string;
|
|
24
|
+
type: 'invalid_request_error';
|
|
25
|
+
}
|
|
26
|
+
export interface NotFoundError {
|
|
27
|
+
message: string;
|
|
28
|
+
type: 'not_found_error';
|
|
29
|
+
}
|
|
30
|
+
export interface OverloadedError {
|
|
31
|
+
message: string;
|
|
32
|
+
type: 'overloaded_error';
|
|
33
|
+
}
|
|
34
|
+
export interface PermissionError {
|
|
35
|
+
message: string;
|
|
36
|
+
type: 'permission_error';
|
|
37
|
+
}
|
|
38
|
+
export interface RateLimitError {
|
|
39
|
+
message: string;
|
|
40
|
+
type: 'rate_limit_error';
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,MAAM,WAAW,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,YAAY,GACZ,eAAe,GACf,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,WAAW,CAAC;IAEnB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,uBAAuB,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,kBAAkB,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/resources/shared.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
|