@ai-sdk/anthropic 2.0.105 → 2.0.107
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 +20 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +105 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -38
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +6 -1
- package/dist/internal/index.d.ts +6 -1
- package/dist/internal/index.js +104 -37
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +104 -37
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 2.0.107
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6dc04c5: feat(anthropic): add Claude Sonnet 5.5 support
|
|
8
|
+
|
|
9
|
+
- add the `claude-sonnet-5-5` model ID to `@ai-sdk/anthropic` and `@ai-sdk/google-vertex`, `anthropic.claude-sonnet-5-5` and `us.anthropic.claude-sonnet-5-5` to `@ai-sdk/amazon-bedrock`, and `anthropic/claude-sonnet-5.5` to `@ai-sdk/gateway`
|
|
10
|
+
- add the `between_tools` thinking type (`thinking: { type: 'between_tools' }`), the lowest thinking setting on `claude-sonnet-5-5`; `xhigh` and `max` effort are lowered to `high` with a warning because the API rejects them with `between_tools`
|
|
11
|
+
- `claude-sonnet-5-5` rejects disabled thinking: `thinking: { type: 'disabled' }` is replaced with `between_tools` thinking (with a warning), and budget-based thinking is converted to adaptive thinking
|
|
12
|
+
- `claude-sonnet-5-5` rejects forced tool use: `required` and named tool choices fall back to `auto`, and `structuredOutputMode: 'jsonTool'` falls back to native structured outputs, each with a warning
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [14810cb]
|
|
15
|
+
- @ai-sdk/provider-utils@3.0.40
|
|
16
|
+
|
|
17
|
+
## 2.0.106
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 214d440: Preserve effort updates on empty system messages at the beginning of a conversation, including consecutive updates.
|
|
22
|
+
|
|
3
23
|
## 2.0.105
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -169,7 +169,7 @@ interface AnthropicMessageMetadata {
|
|
|
169
169
|
} | null;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
|
|
172
|
+
type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
173
173
|
/**
|
|
174
174
|
* Anthropic provider options for system messages.
|
|
175
175
|
*/
|
|
@@ -216,6 +216,8 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
216
216
|
}, z.core.$strip>>;
|
|
217
217
|
}, z.core.$strip>, z.ZodObject<{
|
|
218
218
|
type: z.ZodLiteral<"disabled">;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
type: z.ZodLiteral<"between_tools">;
|
|
219
221
|
}, z.core.$strip>, z.ZodObject<{
|
|
220
222
|
blockBinding: z.ZodObject<{
|
|
221
223
|
prefixMismatchBehavior: z.ZodLiteral<"drop_block">;
|
package/dist/index.d.ts
CHANGED
|
@@ -169,7 +169,7 @@ interface AnthropicMessageMetadata {
|
|
|
169
169
|
} | null;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | (string & {});
|
|
172
|
+
type AnthropicMessagesModelId = 'claude-3-5-haiku-20241022' | 'claude-3-5-haiku-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-7-sonnet-latest' | 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-20250514' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
173
173
|
/**
|
|
174
174
|
* Anthropic provider options for system messages.
|
|
175
175
|
*/
|
|
@@ -216,6 +216,8 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
216
216
|
}, z.core.$strip>>;
|
|
217
217
|
}, z.core.$strip>, z.ZodObject<{
|
|
218
218
|
type: z.ZodLiteral<"disabled">;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
type: z.ZodLiteral<"between_tools">;
|
|
219
221
|
}, z.core.$strip>, z.ZodObject<{
|
|
220
222
|
blockBinding: z.ZodObject<{
|
|
221
223
|
prefixMismatchBehavior: z.ZodLiteral<"drop_block">;
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
31
31
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/version.ts
|
|
34
|
-
var VERSION = true ? "2.0.
|
|
34
|
+
var VERSION = true ? "2.0.107" : "0.0.0-test";
|
|
35
35
|
|
|
36
36
|
// src/anthropic-messages-language-model.ts
|
|
37
37
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -678,9 +678,10 @@ var anthropicSystemMessageProviderOptions = import_v43.z.object({
|
|
|
678
678
|
*/
|
|
679
679
|
clearAt: import_v43.z.literal("next_user_message").optional(),
|
|
680
680
|
/**
|
|
681
|
-
*
|
|
682
|
-
*
|
|
683
|
-
*
|
|
681
|
+
* Sets the model effort from the next user turn until a later message
|
|
682
|
+
* changes it. An effort-only system message with empty content can appear
|
|
683
|
+
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
684
|
+
* added automatically.
|
|
684
685
|
*/
|
|
685
686
|
effort: import_v43.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
686
687
|
/**
|
|
@@ -730,7 +731,7 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
730
731
|
*
|
|
731
732
|
* - `outputFormat`: Use the `output_format` parameter to specify the structured output format.
|
|
732
733
|
* - `jsonTool`: Use a special JSON response tool to specify the structured output format (default for most models).
|
|
733
|
-
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Opus 5.5 and Fable 5.1).
|
|
734
|
+
* - `auto`: Use 'outputFormat' when supported, otherwise use 'jsonTool' (default for Sonnet 5.5, Opus 5.5, and Fable 5.1).
|
|
734
735
|
*/
|
|
735
736
|
structuredOutputMode: import_v43.z.enum(["outputFormat", "jsonTool", "auto"]).optional(),
|
|
736
737
|
/**
|
|
@@ -743,6 +744,9 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
743
744
|
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
744
745
|
* provider drops the unsupported setting, emits a warning, and sends an
|
|
745
746
|
* adaptive thinking request. Use `effort` to control how much they think.
|
|
747
|
+
*
|
|
748
|
+
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
749
|
+
* and the provider uses it in place of `disabled` for that model.
|
|
746
750
|
*/
|
|
747
751
|
thinking: import_v43.z.union([
|
|
748
752
|
import_v43.z.object({
|
|
@@ -774,6 +778,14 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
774
778
|
import_v43.z.object({
|
|
775
779
|
type: import_v43.z.literal("disabled")
|
|
776
780
|
}),
|
|
781
|
+
import_v43.z.object({
|
|
782
|
+
/**
|
|
783
|
+
* for `claude-sonnet-5-5`: no upfront thinking, but progress notes
|
|
784
|
+
* between tool calls are returned as summarized thinking blocks.
|
|
785
|
+
* Only supported at `low`, `medium`, and `high` effort.
|
|
786
|
+
*/
|
|
787
|
+
type: import_v43.z.literal("between_tools")
|
|
788
|
+
}),
|
|
777
789
|
import_v43.z.object({
|
|
778
790
|
/**
|
|
779
791
|
* Configure prefix mismatch handling without changing the model's
|
|
@@ -1644,7 +1656,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1644
1656
|
cacheControlValidator,
|
|
1645
1657
|
toolsetNames = {}
|
|
1646
1658
|
}) {
|
|
1647
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
1659
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1648
1660
|
const betas = /* @__PURE__ */ new Set();
|
|
1649
1661
|
const blocks = groupIntoBlocks(prompt);
|
|
1650
1662
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -1676,10 +1688,9 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1676
1688
|
const type = block.type;
|
|
1677
1689
|
switch (type) {
|
|
1678
1690
|
case "system": {
|
|
1679
|
-
const
|
|
1691
|
+
const systemMessages = [];
|
|
1680
1692
|
let toolChangeCount = 0;
|
|
1681
|
-
let
|
|
1682
|
-
let effort = void 0;
|
|
1693
|
+
let hasMidConversationOptions = false;
|
|
1683
1694
|
for (const { content: text, providerOptions } of block.messages) {
|
|
1684
1695
|
const systemMessageOptions = await (0, import_provider_utils10.parseProviderOptions)({
|
|
1685
1696
|
provider: "anthropic",
|
|
@@ -1687,8 +1698,9 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1687
1698
|
schema: anthropicSystemMessageProviderOptions
|
|
1688
1699
|
});
|
|
1689
1700
|
const toolChanges = (_a = systemMessageOptions == null ? void 0 : systemMessageOptions.toolChanges) != null ? _a : [];
|
|
1690
|
-
clearAt =
|
|
1691
|
-
effort =
|
|
1701
|
+
const clearAt = systemMessageOptions == null ? void 0 : systemMessageOptions.clearAt;
|
|
1702
|
+
const effort = systemMessageOptions == null ? void 0 : systemMessageOptions.effort;
|
|
1703
|
+
const content = [];
|
|
1692
1704
|
if (text !== "" || toolChanges.length === 0 && (systemMessageOptions == null ? void 0 : systemMessageOptions.clearAt) == null && (systemMessageOptions == null ? void 0 : systemMessageOptions.effort) == null) {
|
|
1693
1705
|
content.push({
|
|
1694
1706
|
type: "text",
|
|
@@ -1709,33 +1721,47 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1709
1721
|
}
|
|
1710
1722
|
});
|
|
1711
1723
|
}
|
|
1724
|
+
hasMidConversationOptions || (hasMidConversationOptions = clearAt != null || effort != null);
|
|
1725
|
+
systemMessages.push({
|
|
1726
|
+
role: "system",
|
|
1727
|
+
content,
|
|
1728
|
+
...clearAt != null && { clear_at: clearAt },
|
|
1729
|
+
...effort != null && { output_config: { effort } }
|
|
1730
|
+
});
|
|
1712
1731
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
if (hasMidConversationOptions) {
|
|
1732
|
+
if (i === 0 || system == null && toolChangeCount === 0 && !hasMidConversationOptions) {
|
|
1733
|
+
if (toolChangeCount > 0) {
|
|
1716
1734
|
warnings.push({
|
|
1717
1735
|
type: "other",
|
|
1718
|
-
message: "
|
|
1736
|
+
message: "tool changes on the initial system message are not supported by Anthropic. Configure the initial tool set via the tools option instead. The tool changes have been ignored."
|
|
1719
1737
|
});
|
|
1720
1738
|
}
|
|
1721
|
-
|
|
1722
|
-
(
|
|
1739
|
+
for (const message of systemMessages) {
|
|
1740
|
+
if (message.content.length === 0 && message.clear_at == null && message.output_config != null) {
|
|
1741
|
+
messages.push(message);
|
|
1742
|
+
betas.add("mid-conversation-output-config-2026-07-01");
|
|
1743
|
+
} else if (message.clear_at != null || message.output_config != null) {
|
|
1744
|
+
warnings.push({
|
|
1745
|
+
type: "other",
|
|
1746
|
+
message: "clearAt and effort on this initial system message are not supported by Anthropic. Use a separate effort-only system message with empty content to set effort. These options have been ignored."
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
system = systemMessages.flatMap(
|
|
1751
|
+
(message) => message.content.filter(
|
|
1752
|
+
(part) => part.type === "text"
|
|
1753
|
+
)
|
|
1723
1754
|
);
|
|
1724
1755
|
} else {
|
|
1725
|
-
messages.push(
|
|
1726
|
-
role: "system",
|
|
1727
|
-
content,
|
|
1728
|
-
...clearAt != null && { clear_at: clearAt },
|
|
1729
|
-
...effort != null && { output_config: { effort } }
|
|
1730
|
-
});
|
|
1756
|
+
messages.push(...systemMessages);
|
|
1731
1757
|
betas.add("mid-conversation-system-2026-04-07");
|
|
1732
1758
|
if (toolChangeCount > 0) {
|
|
1733
1759
|
betas.add("mid-conversation-tool-changes-2026-07-01");
|
|
1734
1760
|
}
|
|
1735
|
-
if (
|
|
1761
|
+
if (systemMessages.some((message) => message.clear_at != null)) {
|
|
1736
1762
|
betas.add("mid-conversation-system-clear-at-2026-08-21");
|
|
1737
1763
|
}
|
|
1738
|
-
if (
|
|
1764
|
+
if (systemMessages.some((message) => message.output_config != null)) {
|
|
1739
1765
|
betas.add("mid-conversation-output-config-2026-07-01");
|
|
1740
1766
|
}
|
|
1741
1767
|
}
|
|
@@ -1750,10 +1776,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1750
1776
|
for (let j = 0; j < content.length; j++) {
|
|
1751
1777
|
const part = content[j];
|
|
1752
1778
|
const isLastPart = j === content.length - 1;
|
|
1753
|
-
const cacheControl = (
|
|
1779
|
+
const cacheControl = (_b = validator.getCacheControl(part.providerOptions, {
|
|
1754
1780
|
type: "user message part",
|
|
1755
1781
|
canCache: true
|
|
1756
|
-
})) != null ?
|
|
1782
|
+
})) != null ? _b : isLastPart ? validator.getCacheControl(message.providerOptions, {
|
|
1757
1783
|
type: "user message",
|
|
1758
1784
|
canCache: true
|
|
1759
1785
|
}) : void 0;
|
|
@@ -1798,7 +1824,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1798
1824
|
media_type: "application/pdf",
|
|
1799
1825
|
data: (0, import_provider_utils10.convertToBase64)(part.data)
|
|
1800
1826
|
},
|
|
1801
|
-
title: (
|
|
1827
|
+
title: (_c = metadata.title) != null ? _c : part.filename,
|
|
1802
1828
|
...metadata.context && { context: metadata.context },
|
|
1803
1829
|
...enableCitations && {
|
|
1804
1830
|
citations: { enabled: true }
|
|
@@ -1822,7 +1848,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1822
1848
|
media_type: "text/plain",
|
|
1823
1849
|
data: convertToString(part.data)
|
|
1824
1850
|
},
|
|
1825
|
-
title: (
|
|
1851
|
+
title: (_d = metadata.title) != null ? _d : part.filename,
|
|
1826
1852
|
...metadata.context && { context: metadata.context },
|
|
1827
1853
|
...enableCitations && {
|
|
1828
1854
|
citations: { enabled: true }
|
|
@@ -1844,10 +1870,10 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1844
1870
|
for (let i2 = 0; i2 < content.length; i2++) {
|
|
1845
1871
|
const part = content[i2];
|
|
1846
1872
|
const isLastPart = i2 === content.length - 1;
|
|
1847
|
-
const cacheControl = (
|
|
1873
|
+
const cacheControl = (_e = validator.getCacheControl(part.providerOptions, {
|
|
1848
1874
|
type: "tool result part",
|
|
1849
1875
|
canCache: true
|
|
1850
|
-
})) != null ?
|
|
1876
|
+
})) != null ? _e : isLastPart ? validator.getCacheControl(message.providerOptions, {
|
|
1851
1877
|
type: "tool result message",
|
|
1852
1878
|
canCache: true
|
|
1853
1879
|
}) : void 0;
|
|
@@ -1935,16 +1961,16 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1935
1961
|
for (let k = 0; k < content.length; k++) {
|
|
1936
1962
|
const part = content[k];
|
|
1937
1963
|
const isLastContentPart = k === content.length - 1;
|
|
1938
|
-
const cacheControl = (
|
|
1964
|
+
const cacheControl = (_f = validator.getCacheControl(part.providerOptions, {
|
|
1939
1965
|
type: "assistant message part",
|
|
1940
1966
|
canCache: true
|
|
1941
|
-
})) != null ?
|
|
1967
|
+
})) != null ? _f : isLastContentPart ? validator.getCacheControl(message.providerOptions, {
|
|
1942
1968
|
type: "assistant message",
|
|
1943
1969
|
canCache: true
|
|
1944
1970
|
}) : void 0;
|
|
1945
1971
|
switch (part.type) {
|
|
1946
1972
|
case "text": {
|
|
1947
|
-
const textMetadata = (
|
|
1973
|
+
const textMetadata = (_g = part.providerOptions) == null ? void 0 : _g.anthropic;
|
|
1948
1974
|
if ((textMetadata == null ? void 0 : textMetadata.type) === "compaction") {
|
|
1949
1975
|
anthropicContent.push({
|
|
1950
1976
|
type: "compaction",
|
|
@@ -2624,6 +2650,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2624
2650
|
rejectsThinkingDisabledAboveHighEffort,
|
|
2625
2651
|
rejectsThinkingDisabled,
|
|
2626
2652
|
rejectsForcedToolUse,
|
|
2653
|
+
supportsBetweenToolsThinking,
|
|
2627
2654
|
isKnownModel
|
|
2628
2655
|
} = getModelCapabilities(this.modelId);
|
|
2629
2656
|
if (!isKnownModel && maxOutputTokens == null) {
|
|
@@ -2659,7 +2686,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2659
2686
|
}
|
|
2660
2687
|
}
|
|
2661
2688
|
const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
|
|
2662
|
-
const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") || this.modelId.includes("claude-opus-5-5") ? "auto" : "jsonTool";
|
|
2689
|
+
const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : this.modelId.includes("claude-fable-5-1") || this.modelId.includes("claude-opus-5-5") || this.modelId.includes("claude-sonnet-5-5") ? "auto" : "jsonTool";
|
|
2663
2690
|
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
2664
2691
|
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null) {
|
|
2665
2692
|
warnings.push({
|
|
@@ -2694,7 +2721,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2694
2721
|
});
|
|
2695
2722
|
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
2696
2723
|
const thinking = anthropicOptions.thinking;
|
|
2697
|
-
if ("type" in thinking && thinking.type === "disabled") {
|
|
2724
|
+
if ("type" in thinking && thinking.type === "disabled" && supportsBetweenToolsThinking) {
|
|
2725
|
+
warnings.push({
|
|
2726
|
+
type: "unsupported-setting",
|
|
2727
|
+
setting: "providerOptions.anthropic.thinking",
|
|
2728
|
+
details: `thinking cannot be disabled for ${this.modelId}. Using 'between_tools' thinking, the lowest thinking setting, instead.`
|
|
2729
|
+
});
|
|
2730
|
+
anthropicOptions.thinking = { type: "between_tools" };
|
|
2731
|
+
} else if ("type" in thinking && thinking.type === "disabled") {
|
|
2698
2732
|
warnings.push({
|
|
2699
2733
|
type: "unsupported-setting",
|
|
2700
2734
|
setting: "providerOptions.anthropic.thinking",
|
|
@@ -2725,7 +2759,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2725
2759
|
});
|
|
2726
2760
|
anthropicOptions.effort = "high";
|
|
2727
2761
|
}
|
|
2728
|
-
|
|
2762
|
+
if (thinkingType === "between_tools" && anthropicOptions != null && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
2763
|
+
warnings.push({
|
|
2764
|
+
type: "unsupported-setting",
|
|
2765
|
+
setting: "providerOptions.anthropic.effort",
|
|
2766
|
+
details: `effort '${anthropicOptions.effort}' is not supported with 'between_tools' thinking. The effort has been lowered to 'high'.`
|
|
2767
|
+
});
|
|
2768
|
+
anthropicOptions.effort = "high";
|
|
2769
|
+
}
|
|
2770
|
+
const isThinking = thinkingType === "enabled" || thinkingType === "adaptive" || thinkingType === "between_tools";
|
|
2729
2771
|
let thinkingBudget = thinkingOptions != null && "budgetTokens" in thinkingOptions ? thinkingOptions.budgetTokens : void 0;
|
|
2730
2772
|
const thinkingDisplay = thinkingOptions != null && "display" in thinkingOptions ? thinkingOptions.display : void 0;
|
|
2731
2773
|
const thinkingBlockBinding = thinkingOptions != null && "blockBinding" in thinkingOptions ? thinkingOptions.blockBinding : void 0;
|
|
@@ -4090,7 +4132,18 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4090
4132
|
}
|
|
4091
4133
|
};
|
|
4092
4134
|
function getModelCapabilities(modelId) {
|
|
4093
|
-
if (modelId.includes("claude-
|
|
4135
|
+
if (modelId.includes("claude-sonnet-5-5")) {
|
|
4136
|
+
return {
|
|
4137
|
+
maxOutputTokens: 128e3,
|
|
4138
|
+
supportsStructuredOutput: true,
|
|
4139
|
+
rejectsSamplingParameters: true,
|
|
4140
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4141
|
+
rejectsThinkingDisabled: true,
|
|
4142
|
+
rejectsForcedToolUse: true,
|
|
4143
|
+
supportsBetweenToolsThinking: true,
|
|
4144
|
+
isKnownModel: true
|
|
4145
|
+
};
|
|
4146
|
+
} else if (modelId.includes("claude-opus-5-5")) {
|
|
4094
4147
|
return {
|
|
4095
4148
|
maxOutputTokens: 128e3,
|
|
4096
4149
|
supportsStructuredOutput: true,
|
|
@@ -4098,6 +4151,7 @@ function getModelCapabilities(modelId) {
|
|
|
4098
4151
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4099
4152
|
rejectsThinkingDisabled: true,
|
|
4100
4153
|
rejectsForcedToolUse: true,
|
|
4154
|
+
supportsBetweenToolsThinking: false,
|
|
4101
4155
|
isKnownModel: true
|
|
4102
4156
|
};
|
|
4103
4157
|
} else if (modelId.includes("claude-opus-5")) {
|
|
@@ -4108,6 +4162,7 @@ function getModelCapabilities(modelId) {
|
|
|
4108
4162
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4109
4163
|
rejectsThinkingDisabled: false,
|
|
4110
4164
|
rejectsForcedToolUse: false,
|
|
4165
|
+
supportsBetweenToolsThinking: false,
|
|
4111
4166
|
isKnownModel: true
|
|
4112
4167
|
};
|
|
4113
4168
|
} else if (modelId.includes("claude-fable-5-1")) {
|
|
@@ -4118,6 +4173,7 @@ function getModelCapabilities(modelId) {
|
|
|
4118
4173
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4119
4174
|
rejectsThinkingDisabled: true,
|
|
4120
4175
|
rejectsForcedToolUse: true,
|
|
4176
|
+
supportsBetweenToolsThinking: false,
|
|
4121
4177
|
isKnownModel: true
|
|
4122
4178
|
};
|
|
4123
4179
|
} else if (modelId.includes("claude-fable-5")) {
|
|
@@ -4128,6 +4184,7 @@ function getModelCapabilities(modelId) {
|
|
|
4128
4184
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4129
4185
|
rejectsThinkingDisabled: true,
|
|
4130
4186
|
rejectsForcedToolUse: false,
|
|
4187
|
+
supportsBetweenToolsThinking: false,
|
|
4131
4188
|
isKnownModel: true
|
|
4132
4189
|
};
|
|
4133
4190
|
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) {
|
|
@@ -4138,6 +4195,7 @@ function getModelCapabilities(modelId) {
|
|
|
4138
4195
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4139
4196
|
rejectsThinkingDisabled: false,
|
|
4140
4197
|
rejectsForcedToolUse: false,
|
|
4198
|
+
supportsBetweenToolsThinking: false,
|
|
4141
4199
|
isKnownModel: true
|
|
4142
4200
|
};
|
|
4143
4201
|
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
@@ -4148,6 +4206,7 @@ function getModelCapabilities(modelId) {
|
|
|
4148
4206
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4149
4207
|
rejectsThinkingDisabled: false,
|
|
4150
4208
|
rejectsForcedToolUse: false,
|
|
4209
|
+
supportsBetweenToolsThinking: false,
|
|
4151
4210
|
isKnownModel: true
|
|
4152
4211
|
};
|
|
4153
4212
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
@@ -4158,6 +4217,7 @@ function getModelCapabilities(modelId) {
|
|
|
4158
4217
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4159
4218
|
rejectsThinkingDisabled: false,
|
|
4160
4219
|
rejectsForcedToolUse: false,
|
|
4220
|
+
supportsBetweenToolsThinking: false,
|
|
4161
4221
|
isKnownModel: true
|
|
4162
4222
|
};
|
|
4163
4223
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
@@ -4168,6 +4228,7 @@ function getModelCapabilities(modelId) {
|
|
|
4168
4228
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4169
4229
|
rejectsThinkingDisabled: false,
|
|
4170
4230
|
rejectsForcedToolUse: false,
|
|
4231
|
+
supportsBetweenToolsThinking: false,
|
|
4171
4232
|
isKnownModel: true
|
|
4172
4233
|
};
|
|
4173
4234
|
} else if (modelId.includes("claude-sonnet-4-") || modelId.includes("claude-3-7-sonnet")) {
|
|
@@ -4178,6 +4239,7 @@ function getModelCapabilities(modelId) {
|
|
|
4178
4239
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4179
4240
|
rejectsThinkingDisabled: false,
|
|
4180
4241
|
rejectsForcedToolUse: false,
|
|
4242
|
+
supportsBetweenToolsThinking: false,
|
|
4181
4243
|
isKnownModel: true
|
|
4182
4244
|
};
|
|
4183
4245
|
} else if (modelId.includes("claude-opus-4-")) {
|
|
@@ -4188,6 +4250,7 @@ function getModelCapabilities(modelId) {
|
|
|
4188
4250
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4189
4251
|
rejectsThinkingDisabled: false,
|
|
4190
4252
|
rejectsForcedToolUse: false,
|
|
4253
|
+
supportsBetweenToolsThinking: false,
|
|
4191
4254
|
isKnownModel: true
|
|
4192
4255
|
};
|
|
4193
4256
|
} else if (modelId.includes("claude-3-haiku")) {
|
|
@@ -4198,6 +4261,7 @@ function getModelCapabilities(modelId) {
|
|
|
4198
4261
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4199
4262
|
rejectsThinkingDisabled: false,
|
|
4200
4263
|
rejectsForcedToolUse: false,
|
|
4264
|
+
supportsBetweenToolsThinking: false,
|
|
4201
4265
|
isKnownModel: true
|
|
4202
4266
|
};
|
|
4203
4267
|
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
@@ -4208,6 +4272,7 @@ function getModelCapabilities(modelId) {
|
|
|
4208
4272
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4209
4273
|
rejectsThinkingDisabled: false,
|
|
4210
4274
|
rejectsForcedToolUse: false,
|
|
4275
|
+
supportsBetweenToolsThinking: false,
|
|
4211
4276
|
isKnownModel: false
|
|
4212
4277
|
};
|
|
4213
4278
|
} else if (modelId.includes("claude-")) {
|
|
@@ -4218,6 +4283,7 @@ function getModelCapabilities(modelId) {
|
|
|
4218
4283
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
4219
4284
|
rejectsThinkingDisabled: false,
|
|
4220
4285
|
rejectsForcedToolUse: false,
|
|
4286
|
+
supportsBetweenToolsThinking: false,
|
|
4221
4287
|
isKnownModel: false
|
|
4222
4288
|
};
|
|
4223
4289
|
} else {
|
|
@@ -4228,6 +4294,7 @@ function getModelCapabilities(modelId) {
|
|
|
4228
4294
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
4229
4295
|
rejectsThinkingDisabled: false,
|
|
4230
4296
|
rejectsForcedToolUse: false,
|
|
4297
|
+
supportsBetweenToolsThinking: false,
|
|
4231
4298
|
isKnownModel: false
|
|
4232
4299
|
};
|
|
4233
4300
|
}
|