@ai-sdk/anthropic 3.0.0-beta.86 → 3.0.0-beta.88
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 +13 -0
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -10
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +4 -0
- package/dist/internal/index.d.ts +4 -0
- package/dist/internal/index.js +14 -9
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -9
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.88
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 87db851: fix(vertex/anthropic): passing beta header only for structured outputs
|
|
8
|
+
|
|
9
|
+
## 3.0.0-beta.87
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [c1efac4]
|
|
14
|
+
- @ai-sdk/provider-utils@4.0.0-beta.51
|
|
15
|
+
|
|
3
16
|
## 3.0.0-beta.86
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
31
31
|
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/version.ts
|
|
34
|
-
var VERSION = true ? "3.0.0-beta.
|
|
34
|
+
var VERSION = true ? "3.0.0-beta.88" : "0.0.0-test";
|
|
35
35
|
|
|
36
36
|
// src/anthropic-messages-language-model.ts
|
|
37
37
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -1038,6 +1038,9 @@ async function prepareTools({
|
|
|
1038
1038
|
)
|
|
1039
1039
|
} : {}
|
|
1040
1040
|
});
|
|
1041
|
+
if (supportsStructuredOutput === true) {
|
|
1042
|
+
betas.add("structured-outputs-2025-11-13");
|
|
1043
|
+
}
|
|
1041
1044
|
if (tool.inputExamples != null) {
|
|
1042
1045
|
betas.add("advanced-tool-use-2025-11-20");
|
|
1043
1046
|
}
|
|
@@ -2188,7 +2191,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2188
2191
|
providerOptions,
|
|
2189
2192
|
stream
|
|
2190
2193
|
}) {
|
|
2191
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2194
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2192
2195
|
const warnings = [];
|
|
2193
2196
|
if (frequencyPenalty != null) {
|
|
2194
2197
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -2230,10 +2233,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2230
2233
|
});
|
|
2231
2234
|
const {
|
|
2232
2235
|
maxOutputTokens: maxOutputTokensForModel,
|
|
2233
|
-
supportsStructuredOutput,
|
|
2236
|
+
supportsStructuredOutput: modelSupportsStructuredOutput,
|
|
2234
2237
|
isKnownModel
|
|
2235
2238
|
} = getModelCapabilities(this.modelId);
|
|
2236
|
-
const
|
|
2239
|
+
const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
|
|
2240
|
+
const structureOutputMode = (_b = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _b : "auto";
|
|
2237
2241
|
const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
2238
2242
|
const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
2239
2243
|
type: "function",
|
|
@@ -2265,13 +2269,13 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2265
2269
|
});
|
|
2266
2270
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
2267
2271
|
prompt,
|
|
2268
|
-
sendReasoning: (
|
|
2272
|
+
sendReasoning: (_c = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _c : true,
|
|
2269
2273
|
warnings,
|
|
2270
2274
|
cacheControlValidator,
|
|
2271
2275
|
toolNameMapping
|
|
2272
2276
|
});
|
|
2273
|
-
const isThinking = ((
|
|
2274
|
-
let thinkingBudget = (
|
|
2277
|
+
const isThinking = ((_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.type) === "enabled";
|
|
2278
|
+
let thinkingBudget = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.budgetTokens;
|
|
2275
2279
|
const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
|
|
2276
2280
|
const baseArgs = {
|
|
2277
2281
|
// model id:
|
|
@@ -2313,7 +2317,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2313
2317
|
...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
|
|
2314
2318
|
container: {
|
|
2315
2319
|
id: anthropicOptions.container.id,
|
|
2316
|
-
skills: (
|
|
2320
|
+
skills: (_f = anthropicOptions.container.skills) == null ? void 0 : _f.map((skill) => ({
|
|
2317
2321
|
type: skill.type,
|
|
2318
2322
|
skill_id: skill.skillId,
|
|
2319
2323
|
version: skill.version
|
|
@@ -2432,10 +2436,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2432
2436
|
if (anthropicOptions == null ? void 0 : anthropicOptions.effort) {
|
|
2433
2437
|
betas.add("effort-2025-11-24");
|
|
2434
2438
|
}
|
|
2435
|
-
if (stream && ((
|
|
2439
|
+
if (stream && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _g : true)) {
|
|
2436
2440
|
betas.add("fine-grained-tool-streaming-2025-05-14");
|
|
2437
2441
|
}
|
|
2438
|
-
|
|
2442
|
+
const usingNativeOutputFormat = useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
|
|
2443
|
+
if (usingNativeOutputFormat) {
|
|
2439
2444
|
betas.add("structured-outputs-2025-11-13");
|
|
2440
2445
|
}
|
|
2441
2446
|
const {
|