@ai-sdk/anthropic 3.0.0-beta.58 → 3.0.0-beta.60
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.js +23 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +22 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +22 -7
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@ai-sdk/provider-utils";
|
|
12
12
|
|
|
13
13
|
// src/version.ts
|
|
14
|
-
var VERSION = true ? "3.0.0-beta.
|
|
14
|
+
var VERSION = true ? "3.0.0-beta.60" : "0.0.0-test";
|
|
15
15
|
|
|
16
16
|
// src/anthropic-messages-language-model.ts
|
|
17
17
|
import {
|
|
@@ -1922,6 +1922,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1922
1922
|
return (_c = (_b = (_a = this.config).supportedUrls) == null ? void 0 : _b.call(_a)) != null ? _c : {};
|
|
1923
1923
|
}
|
|
1924
1924
|
async getArgs({
|
|
1925
|
+
userSuppliedBetas,
|
|
1925
1926
|
prompt,
|
|
1926
1927
|
maxOutputTokens,
|
|
1927
1928
|
temperature,
|
|
@@ -2155,7 +2156,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2155
2156
|
// do not send when not streaming
|
|
2156
2157
|
},
|
|
2157
2158
|
warnings: [...warnings, ...toolWarnings, ...cacheWarnings],
|
|
2158
|
-
betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas]),
|
|
2159
|
+
betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas, ...userSuppliedBetas]),
|
|
2159
2160
|
usesJsonResponseTool: jsonResponseTool != null
|
|
2160
2161
|
};
|
|
2161
2162
|
}
|
|
@@ -2165,8 +2166,20 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2165
2166
|
}) {
|
|
2166
2167
|
return combineHeaders(
|
|
2167
2168
|
await resolve(this.config.headers),
|
|
2168
|
-
|
|
2169
|
-
|
|
2169
|
+
headers,
|
|
2170
|
+
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
2171
|
+
);
|
|
2172
|
+
}
|
|
2173
|
+
async getBetasFromHeaders(requestHeaders) {
|
|
2174
|
+
var _a, _b;
|
|
2175
|
+
const configHeaders = await resolve(this.config.headers);
|
|
2176
|
+
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
2177
|
+
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
2178
|
+
return new Set(
|
|
2179
|
+
[
|
|
2180
|
+
...configBetaHeader.toLowerCase().split(","),
|
|
2181
|
+
...requestBetaHeader.toLowerCase().split(",")
|
|
2182
|
+
].map((beta) => beta.trim()).filter((beta) => beta !== "")
|
|
2170
2183
|
);
|
|
2171
2184
|
}
|
|
2172
2185
|
buildRequestUrl(isStreaming) {
|
|
@@ -2204,7 +2217,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2204
2217
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2205
2218
|
const { args, warnings, betas, usesJsonResponseTool } = await this.getArgs({
|
|
2206
2219
|
...options,
|
|
2207
|
-
stream: false
|
|
2220
|
+
stream: false,
|
|
2221
|
+
userSuppliedBetas: await this.getBetasFromHeaders(options.headers)
|
|
2208
2222
|
});
|
|
2209
2223
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
2210
2224
|
const {
|
|
@@ -2505,7 +2519,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2505
2519
|
usesJsonResponseTool
|
|
2506
2520
|
} = await this.getArgs({
|
|
2507
2521
|
...options,
|
|
2508
|
-
stream: true
|
|
2522
|
+
stream: true,
|
|
2523
|
+
userSuppliedBetas: await this.getBetasFromHeaders(options.headers)
|
|
2509
2524
|
});
|
|
2510
2525
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
2511
2526
|
const { responseHeaders, value: response } = await postJsonToApi({
|
|
@@ -3004,13 +3019,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3004
3019
|
}
|
|
3005
3020
|
};
|
|
3006
3021
|
function getModelCapabilities(modelId) {
|
|
3007
|
-
if (modelId.includes("claude-sonnet-4-5")) {
|
|
3022
|
+
if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5")) {
|
|
3008
3023
|
return {
|
|
3009
3024
|
maxOutputTokens: 64e3,
|
|
3010
3025
|
supportsStructuredOutput: true,
|
|
3011
3026
|
isKnownModel: true
|
|
3012
3027
|
};
|
|
3013
|
-
} else if (modelId.includes("claude-opus-4-1")
|
|
3028
|
+
} else if (modelId.includes("claude-opus-4-1")) {
|
|
3014
3029
|
return {
|
|
3015
3030
|
maxOutputTokens: 32e3,
|
|
3016
3031
|
supportsStructuredOutput: true,
|