@ai-sdk/anthropic 4.0.1 → 4.0.2
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 +6 -0
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +6 -4
- package/dist/internal/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anthropic-language-model.ts +12 -3
package/package.json
CHANGED
|
@@ -1495,6 +1495,7 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
|
|
|
1495
1495
|
providerExecuted?: boolean;
|
|
1496
1496
|
firstDelta: boolean;
|
|
1497
1497
|
providerToolName?: string;
|
|
1498
|
+
providerToolInputType?: string;
|
|
1498
1499
|
caller?: {
|
|
1499
1500
|
type:
|
|
1500
1501
|
| 'code_execution_20250825'
|
|
@@ -1699,6 +1700,13 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
|
|
|
1699
1700
|
part.name === 'bash_code_execution'
|
|
1700
1701
|
? 'code_execution'
|
|
1701
1702
|
: part.name;
|
|
1703
|
+
const providerToolInputType =
|
|
1704
|
+
part.name === 'text_editor_code_execution' ||
|
|
1705
|
+
part.name === 'bash_code_execution'
|
|
1706
|
+
? part.name
|
|
1707
|
+
: part.name === 'code_execution'
|
|
1708
|
+
? 'programmatic-tool-call'
|
|
1709
|
+
: undefined;
|
|
1702
1710
|
|
|
1703
1711
|
const customToolName =
|
|
1704
1712
|
toolNameMapping.toCustomToolName(providerToolName);
|
|
@@ -1727,8 +1735,9 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
|
|
|
1727
1735
|
providerToolName === 'code_execution'
|
|
1728
1736
|
? { dynamic: true }
|
|
1729
1737
|
: {}),
|
|
1730
|
-
firstDelta:
|
|
1738
|
+
firstDelta: finalInput.length === 0,
|
|
1731
1739
|
providerToolName,
|
|
1740
|
+
providerToolInputType,
|
|
1732
1741
|
};
|
|
1733
1742
|
|
|
1734
1743
|
controller.enqueue({
|
|
@@ -2257,9 +2266,9 @@ export class AnthropicLanguageModel implements LanguageModelV4 {
|
|
|
2257
2266
|
// the type to the delta and change the tool name.
|
|
2258
2267
|
if (
|
|
2259
2268
|
contentBlock.firstDelta &&
|
|
2260
|
-
contentBlock.
|
|
2269
|
+
contentBlock.providerToolInputType != null
|
|
2261
2270
|
) {
|
|
2262
|
-
delta = `{"type": "
|
|
2271
|
+
delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
|
|
2263
2272
|
}
|
|
2264
2273
|
|
|
2265
2274
|
controller.enqueue({
|