@ai-sdk/anthropic 2.0.16 → 2.0.18
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 +12 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +26 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -11
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +9 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +9 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 2.0.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 322901b: feat: add provider version to user-agent header
|
|
8
|
+
|
|
9
|
+
## 2.0.17
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- da92132: fix(provider/anthorpic): add cacheControl to AnthropicProviderOptions
|
|
14
|
+
|
|
3
15
|
## 2.0.16
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,10 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
11
11
|
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
12
12
|
}, z.core.$strip>>;
|
|
13
13
|
disableParallelToolUse: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
16
|
+
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
14
18
|
}, z.core.$strip>;
|
|
15
19
|
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
16
20
|
|
|
@@ -247,4 +251,6 @@ Default Anthropic provider instance.
|
|
|
247
251
|
*/
|
|
248
252
|
declare const anthropic: AnthropicProvider;
|
|
249
253
|
|
|
250
|
-
|
|
254
|
+
declare const VERSION: string;
|
|
255
|
+
|
|
256
|
+
export { type AnthropicProvider, type AnthropicProviderOptions, type AnthropicProviderSettings, VERSION, anthropic, createAnthropic };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
11
11
|
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
12
12
|
}, z.core.$strip>>;
|
|
13
13
|
disableParallelToolUse: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
16
|
+
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
14
18
|
}, z.core.$strip>;
|
|
15
19
|
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
16
20
|
|
|
@@ -247,4 +251,6 @@ Default Anthropic provider instance.
|
|
|
247
251
|
*/
|
|
248
252
|
declare const anthropic: AnthropicProvider;
|
|
249
253
|
|
|
250
|
-
|
|
254
|
+
declare const VERSION: string;
|
|
255
|
+
|
|
256
|
+
export { type AnthropicProvider, type AnthropicProviderOptions, type AnthropicProviderSettings, VERSION, anthropic, createAnthropic };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
VERSION: () => VERSION,
|
|
33
34
|
anthropic: () => anthropic,
|
|
34
35
|
createAnthropic: () => createAnthropic
|
|
35
36
|
});
|
|
@@ -39,6 +40,9 @@ module.exports = __toCommonJS(src_exports);
|
|
|
39
40
|
var import_provider4 = require("@ai-sdk/provider");
|
|
40
41
|
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
41
42
|
|
|
43
|
+
// src/version.ts
|
|
44
|
+
var VERSION = true ? "2.0.18" : "0.0.0-test";
|
|
45
|
+
|
|
42
46
|
// src/anthropic-messages-language-model.ts
|
|
43
47
|
var import_provider3 = require("@ai-sdk/provider");
|
|
44
48
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
@@ -94,7 +98,15 @@ var anthropicProviderOptions = import_v42.z.object({
|
|
|
94
98
|
* Whether to disable parallel function calling during tool use. Default is false.
|
|
95
99
|
* When set to true, Claude will use at most one tool per response.
|
|
96
100
|
*/
|
|
97
|
-
disableParallelToolUse: import_v42.z.boolean().optional()
|
|
101
|
+
disableParallelToolUse: import_v42.z.boolean().optional(),
|
|
102
|
+
/**
|
|
103
|
+
* Cache control settings for this message.
|
|
104
|
+
* See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
|
105
|
+
*/
|
|
106
|
+
cacheControl: import_v42.z.object({
|
|
107
|
+
type: import_v42.z.literal("ephemeral"),
|
|
108
|
+
ttl: import_v42.z.union([import_v42.z.literal("5m"), import_v42.z.literal("1h")]).optional()
|
|
109
|
+
}).optional()
|
|
98
110
|
});
|
|
99
111
|
|
|
100
112
|
// src/anthropic-prepare-tools.ts
|
|
@@ -2094,15 +2106,18 @@ var anthropicTools = {
|
|
|
2094
2106
|
function createAnthropic(options = {}) {
|
|
2095
2107
|
var _a;
|
|
2096
2108
|
const baseURL = (_a = (0, import_provider_utils13.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.anthropic.com/v1";
|
|
2097
|
-
const getHeaders = () => (
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2109
|
+
const getHeaders = () => (0, import_provider_utils13.withUserAgentSuffix)(
|
|
2110
|
+
{
|
|
2111
|
+
"anthropic-version": "2023-06-01",
|
|
2112
|
+
"x-api-key": (0, import_provider_utils13.loadApiKey)({
|
|
2113
|
+
apiKey: options.apiKey,
|
|
2114
|
+
environmentVariableName: "ANTHROPIC_API_KEY",
|
|
2115
|
+
description: "Anthropic"
|
|
2116
|
+
}),
|
|
2117
|
+
...options.headers
|
|
2118
|
+
},
|
|
2119
|
+
`ai-sdk/anthropic/${VERSION}`
|
|
2120
|
+
);
|
|
2106
2121
|
const createChatModel = (modelId) => {
|
|
2107
2122
|
var _a2;
|
|
2108
2123
|
return new AnthropicMessagesLanguageModel(modelId, {
|
|
@@ -2139,6 +2154,7 @@ function createAnthropic(options = {}) {
|
|
|
2139
2154
|
var anthropic = createAnthropic();
|
|
2140
2155
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2141
2156
|
0 && (module.exports = {
|
|
2157
|
+
VERSION,
|
|
2142
2158
|
anthropic,
|
|
2143
2159
|
createAnthropic
|
|
2144
2160
|
});
|