@anthropic-ai/sdk
Advanced tools
Comparing version 0.12.8 to 0.13.0
# Changelog | ||
## 0.13.0 (2024-02-02) | ||
Full Changelog: [sdk-v0.12.8...sdk-v0.13.0](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.12.8...sdk-v0.13.0) | ||
### Features | ||
* **api:** add new usage response fields ([#281](https://github.com/anthropics/anthropic-sdk-typescript/issues/281)) ([77bd18f](https://github.com/anthropics/anthropic-sdk-typescript/commit/77bd18fb3d149c0706664304102fc5f12830f761)) | ||
### Chores | ||
* **package:** fix formatting ([#283](https://github.com/anthropics/anthropic-sdk-typescript/issues/283)) ([f88579a](https://github.com/anthropics/anthropic-sdk-typescript/commit/f88579a0768e0a7d5064eec9e1dd79e86c66bce7)) | ||
## 0.12.8 (2024-02-02) | ||
@@ -4,0 +17,0 @@ |
{ | ||
"name": "@anthropic-ai/sdk", | ||
"version": "0.12.8", | ||
"version": "0.13.0", | ||
"description": "The official TypeScript library for the Anthropic API", | ||
@@ -5,0 +5,0 @@ "author": "Anthropic <support@anthropic.com>", |
@@ -14,2 +14,3 @@ import { APIResource } from '@anthropic-ai/sdk/resource'; | ||
export import MessageDeltaEvent = MessagesAPI.MessageDeltaEvent; | ||
export import MessageDeltaUsage = MessagesAPI.MessageDeltaUsage; | ||
export import MessageParam = MessagesAPI.MessageParam; | ||
@@ -21,2 +22,3 @@ export import MessageStartEvent = MessagesAPI.MessageStartEvent; | ||
export import TextDelta = MessagesAPI.TextDelta; | ||
export import Usage = MessagesAPI.Usage; | ||
export import MessageCreateParams = MessagesAPI.MessageCreateParams; | ||
@@ -23,0 +25,0 @@ export import MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming; |
export { Beta } from "./beta.js"; | ||
export { ContentBlock, ContentBlockDeltaEvent, ContentBlockStartEvent, ContentBlockStopEvent, Message, MessageDeltaEvent, MessageParam, MessageStartEvent, MessageStopEvent, MessageStreamEvent, TextBlock, TextDelta, MessageCreateParams, MessageCreateParamsNonStreaming, MessageCreateParamsStreaming, MessageStreamParams, Messages, } from "./messages.js"; | ||
export { ContentBlock, ContentBlockDeltaEvent, ContentBlockStartEvent, ContentBlockStopEvent, Message, MessageDeltaEvent, MessageDeltaUsage, MessageParam, MessageStartEvent, MessageStopEvent, MessageStreamEvent, TextBlock, TextDelta, Usage, MessageCreateParams, MessageCreateParamsNonStreaming, MessageCreateParamsStreaming, MessageStreamParams, Messages, } from "./messages.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -12,3 +12,11 @@ import * as Core from '@anthropic-ai/sdk/core'; | ||
* | ||
* The Messages API is currently in beta. | ||
* Send a structured list of input messages, and the model will generate the next | ||
* message in the conversation. | ||
* | ||
* Messages can be used for either single queries to the model or for multi-turn | ||
* conversations. | ||
* | ||
* The Messages API is currently in beta. During beta, you must send the | ||
* `anthropic-beta: messages-2023-12-15` header in your requests. If you are using | ||
* our client SDKs, this is handled for you automatically. | ||
*/ | ||
@@ -119,2 +127,6 @@ create(body: MessageCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Message>; | ||
type: 'message'; | ||
/** | ||
* Container for the number of tokens used. | ||
*/ | ||
usage: Usage; | ||
} | ||
@@ -124,2 +136,6 @@ export interface MessageDeltaEvent { | ||
type: 'message_delta'; | ||
/** | ||
* Container for the number of tokens used. | ||
*/ | ||
usage: MessageDeltaUsage; | ||
} | ||
@@ -132,2 +148,8 @@ export declare namespace MessageDeltaEvent { | ||
} | ||
export interface MessageDeltaUsage { | ||
/** | ||
* The cumulative number of output tokens which were used. | ||
*/ | ||
output_tokens: number; | ||
} | ||
export interface MessageParam { | ||
@@ -153,2 +175,12 @@ content: string | Array<TextBlock>; | ||
} | ||
export interface Usage { | ||
/** | ||
* The number of input tokens which were used. | ||
*/ | ||
input_tokens: number; | ||
/** | ||
* The number of output tokens which were used. | ||
*/ | ||
output_tokens: number; | ||
} | ||
export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming; | ||
@@ -227,2 +259,7 @@ export interface MessageCreateParamsBase { | ||
* for more details on how to best construct prompts. | ||
* | ||
* Note that if you want to include a | ||
* [system prompt](https://docs.anthropic.com/claude/docs/how-to-use-system-prompts), | ||
* you can use the top-level `system` parameter — there is no `"system"` role for | ||
* input messages in the Messages API. | ||
*/ | ||
@@ -262,4 +299,4 @@ messages: Array<MessageParam>; | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See [streaming](https://docs.anthropic.com/claude/reference/messages-streaming) | ||
* for details. | ||
*/ | ||
@@ -311,3 +348,3 @@ stream?: boolean; | ||
*/ | ||
user_id?: string; | ||
user_id?: string | null; | ||
} | ||
@@ -321,4 +358,4 @@ type MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming; | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See [streaming](https://docs.anthropic.com/claude/reference/messages-streaming) | ||
* for details. | ||
*/ | ||
@@ -331,4 +368,4 @@ stream?: false; | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See [streaming](https://docs.anthropic.com/claude/reference/messages-streaming) | ||
* for details. | ||
*/ | ||
@@ -409,2 +446,7 @@ stream: true; | ||
* for more details on how to best construct prompts. | ||
* | ||
* Note that if you want to include a | ||
* [system prompt](https://docs.anthropic.com/claude/docs/how-to-use-system-prompts), | ||
* you can use the top-level `system` parameter — there is no `"system"` role for | ||
* input messages in the Messages API. | ||
*/ | ||
@@ -485,3 +527,3 @@ messages: Array<MessageParam>; | ||
*/ | ||
user_id?: string; | ||
user_id?: string | null; | ||
} | ||
@@ -496,2 +538,3 @@ } | ||
export import MessageDeltaEvent = MessagesAPI.MessageDeltaEvent; | ||
export import MessageDeltaUsage = MessagesAPI.MessageDeltaUsage; | ||
export import MessageParam = MessagesAPI.MessageParam; | ||
@@ -503,2 +546,3 @@ export import MessageStartEvent = MessagesAPI.MessageStartEvent; | ||
export import TextDelta = MessagesAPI.TextDelta; | ||
export import Usage = MessagesAPI.Usage; | ||
export import MessageCreateParams = MessagesAPI.MessageCreateParams; | ||
@@ -505,0 +549,0 @@ export import MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming; |
@@ -8,3 +8,3 @@ import * as Core from '@anthropic-ai/sdk/core'; | ||
/** | ||
* Create a Completion | ||
* Create a Text Completion | ||
*/ | ||
@@ -39,3 +39,3 @@ create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Completion>; | ||
*/ | ||
stop_reason: string; | ||
stop_reason: string | null; | ||
type: 'completion'; | ||
@@ -97,4 +97,5 @@ } | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See | ||
* [streaming](https://docs.anthropic.com/claude/reference/text-completions-streaming) | ||
* for details. | ||
*/ | ||
@@ -138,3 +139,3 @@ stream?: boolean; | ||
*/ | ||
user_id?: string; | ||
user_id?: string | null; | ||
} | ||
@@ -148,4 +149,5 @@ type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming; | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See | ||
* [streaming](https://docs.anthropic.com/claude/reference/text-completions-streaming) | ||
* for details. | ||
*/ | ||
@@ -158,4 +160,5 @@ stream?: false; | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See | ||
* [streaming](https://docs.anthropic.com/claude/reference/text-completions-streaming) | ||
* for details. | ||
*/ | ||
@@ -162,0 +165,0 @@ stream: true; |
@@ -18,2 +18,3 @@ // File generated from our OpenAPI spec by Stainless. | ||
export import MessageDeltaEvent = MessagesAPI.MessageDeltaEvent; | ||
export import MessageDeltaUsage = MessagesAPI.MessageDeltaUsage; | ||
export import MessageParam = MessagesAPI.MessageParam; | ||
@@ -25,2 +26,3 @@ export import MessageStartEvent = MessagesAPI.MessageStartEvent; | ||
export import TextDelta = MessagesAPI.TextDelta; | ||
export import Usage = MessagesAPI.Usage; | ||
export import MessageCreateParams = MessagesAPI.MessageCreateParams; | ||
@@ -27,0 +29,0 @@ export import MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming; |
@@ -11,2 +11,3 @@ // File generated from our OpenAPI spec by Stainless. | ||
MessageDeltaEvent, | ||
MessageDeltaUsage, | ||
MessageParam, | ||
@@ -18,2 +19,3 @@ MessageStartEvent, | ||
TextDelta, | ||
Usage, | ||
MessageCreateParams, | ||
@@ -20,0 +22,0 @@ MessageCreateParamsNonStreaming, |
@@ -15,3 +15,11 @@ // File generated from our OpenAPI spec by Stainless. | ||
* | ||
* The Messages API is currently in beta. | ||
* Send a structured list of input messages, and the model will generate the next | ||
* message in the conversation. | ||
* | ||
* Messages can be used for either single queries to the model or for multi-turn | ||
* conversations. | ||
* | ||
* The Messages API is currently in beta. During beta, you must send the | ||
* `anthropic-beta: messages-2023-12-15` header in your requests. If you are using | ||
* our client SDKs, this is handled for you automatically. | ||
*/ | ||
@@ -160,2 +168,7 @@ create(body: MessageCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Message>; | ||
type: 'message'; | ||
/** | ||
* Container for the number of tokens used. | ||
*/ | ||
usage: Usage; | ||
} | ||
@@ -167,2 +180,7 @@ | ||
type: 'message_delta'; | ||
/** | ||
* Container for the number of tokens used. | ||
*/ | ||
usage: MessageDeltaUsage; | ||
} | ||
@@ -178,2 +196,9 @@ | ||
export interface MessageDeltaUsage { | ||
/** | ||
* The cumulative number of output tokens which were used. | ||
*/ | ||
output_tokens: number; | ||
} | ||
export interface MessageParam { | ||
@@ -215,2 +240,14 @@ content: string | Array<TextBlock>; | ||
export interface Usage { | ||
/** | ||
* The number of input tokens which were used. | ||
*/ | ||
input_tokens: number; | ||
/** | ||
* The number of output tokens which were used. | ||
*/ | ||
output_tokens: number; | ||
} | ||
export type MessageCreateParams = MessageCreateParamsNonStreaming | MessageCreateParamsStreaming; | ||
@@ -291,2 +328,7 @@ | ||
* for more details on how to best construct prompts. | ||
* | ||
* Note that if you want to include a | ||
* [system prompt](https://docs.anthropic.com/claude/docs/how-to-use-system-prompts), | ||
* you can use the top-level `system` parameter — there is no `"system"` role for | ||
* input messages in the Messages API. | ||
*/ | ||
@@ -330,4 +372,4 @@ messages: Array<MessageParam>; | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See [streaming](https://docs.anthropic.com/claude/reference/messages-streaming) | ||
* for details. | ||
*/ | ||
@@ -384,3 +426,3 @@ stream?: boolean; | ||
*/ | ||
user_id?: string; | ||
user_id?: string | null; | ||
} | ||
@@ -396,4 +438,4 @@ | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See [streaming](https://docs.anthropic.com/claude/reference/messages-streaming) | ||
* for details. | ||
*/ | ||
@@ -407,4 +449,4 @@ stream?: false; | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See [streaming](https://docs.anthropic.com/claude/reference/messages-streaming) | ||
* for details. | ||
*/ | ||
@@ -487,2 +529,7 @@ stream: true; | ||
* for more details on how to best construct prompts. | ||
* | ||
* Note that if you want to include a | ||
* [system prompt](https://docs.anthropic.com/claude/docs/how-to-use-system-prompts), | ||
* you can use the top-level `system` parameter — there is no `"system"` role for | ||
* input messages in the Messages API. | ||
*/ | ||
@@ -571,3 +618,3 @@ messages: Array<MessageParam>; | ||
*/ | ||
user_id?: string; | ||
user_id?: string | null; | ||
} | ||
@@ -583,2 +630,3 @@ } | ||
export import MessageDeltaEvent = MessagesAPI.MessageDeltaEvent; | ||
export import MessageDeltaUsage = MessagesAPI.MessageDeltaUsage; | ||
export import MessageParam = MessagesAPI.MessageParam; | ||
@@ -590,2 +638,3 @@ export import MessageStartEvent = MessagesAPI.MessageStartEvent; | ||
export import TextDelta = MessagesAPI.TextDelta; | ||
export import Usage = MessagesAPI.Usage; | ||
export import MessageCreateParams = MessagesAPI.MessageCreateParams; | ||
@@ -592,0 +641,0 @@ export import MessageCreateParamsNonStreaming = MessagesAPI.MessageCreateParamsNonStreaming; |
@@ -11,3 +11,3 @@ // File generated from our OpenAPI spec by Stainless. | ||
/** | ||
* Create a Completion | ||
* Create a Text Completion | ||
*/ | ||
@@ -63,3 +63,3 @@ create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise<Completion>; | ||
*/ | ||
stop_reason: string; | ||
stop_reason: string | null; | ||
@@ -129,4 +129,5 @@ type: 'completion'; | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See | ||
* [streaming](https://docs.anthropic.com/claude/reference/text-completions-streaming) | ||
* for details. | ||
*/ | ||
@@ -174,3 +175,3 @@ stream?: boolean; | ||
*/ | ||
user_id?: string; | ||
user_id?: string | null; | ||
} | ||
@@ -186,4 +187,5 @@ | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See | ||
* [streaming](https://docs.anthropic.com/claude/reference/text-completions-streaming) | ||
* for details. | ||
*/ | ||
@@ -197,4 +199,5 @@ stream?: false; | ||
* | ||
* See [streaming](https://docs.anthropic.com/claude/reference/streaming) for | ||
* details. | ||
* See | ||
* [streaming](https://docs.anthropic.com/claude/reference/text-completions-streaming) | ||
* for details. | ||
*/ | ||
@@ -201,0 +204,0 @@ stream: true; |
@@ -1,1 +0,1 @@ | ||
export const VERSION = '0.12.8'; // x-release-please-version | ||
export const VERSION = '0.13.0'; // x-release-please-version |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.12.8"; | ||
export declare const VERSION = "0.13.0"; | ||
//# sourceMappingURL=version.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '0.12.8'; // x-release-please-version | ||
exports.VERSION = '0.13.0'; // x-release-please-version | ||
//# sourceMappingURL=version.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
662612
10520