@ai-sdk/anthropic 4.0.60 → 4.0.62
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 +19 -0
- package/dist/index.js +25 -15
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +13 -5
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/anthropic-api.ts +1 -1
- package/src/anthropic-batch.ts +5 -1
- package/src/anthropic-language-model.ts +4 -0
- package/src/convert-to-anthropic-prompt.ts +10 -4
- package/src/forward-anthropic-container-id-from-last-step.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/anthropic",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.62",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ai-sdk/provider": "4.0.
|
|
39
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
38
|
+
"@ai-sdk/provider": "4.0.18",
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.47"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@ai-sdk/test-server": "2.0.1",
|
package/src/anthropic-api.ts
CHANGED
package/src/anthropic-batch.ts
CHANGED
|
@@ -799,6 +799,10 @@ function convertAnthropicBatchResponse(
|
|
|
799
799
|
});
|
|
800
800
|
break;
|
|
801
801
|
case 'compaction':
|
|
802
|
+
if (!part.content) {
|
|
803
|
+
break;
|
|
804
|
+
}
|
|
805
|
+
|
|
802
806
|
content.push({
|
|
803
807
|
type: 'text',
|
|
804
808
|
text: part.content,
|
|
@@ -833,7 +837,7 @@ function convertAnthropicBatchResponse(
|
|
|
833
837
|
toolName,
|
|
834
838
|
input: JSON.stringify(
|
|
835
839
|
isCodeExecutionAlias
|
|
836
|
-
? { type: part.name, ...
|
|
840
|
+
? { type: part.name, ...part.input }
|
|
837
841
|
: part.name === 'code_execution' &&
|
|
838
842
|
part.input != null &&
|
|
839
843
|
'code' in part.input &&
|
|
@@ -715,6 +715,10 @@ export async function convertToAnthropicPrompt({
|
|
|
715
715
|
| undefined;
|
|
716
716
|
|
|
717
717
|
if (textMetadata?.type === 'compaction') {
|
|
718
|
+
if (part.text === '') {
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
|
|
718
722
|
anthropicContent.push({
|
|
719
723
|
type: 'compaction',
|
|
720
724
|
content: part.text,
|
|
@@ -1386,10 +1390,12 @@ export async function convertToAnthropicPrompt({
|
|
|
1386
1390
|
}
|
|
1387
1391
|
}
|
|
1388
1392
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
+
if (anthropicContent.length > 0) {
|
|
1394
|
+
messages.push({
|
|
1395
|
+
role: 'assistant',
|
|
1396
|
+
content: moveToolUseBlocksToEnd(anthropicContent),
|
|
1397
|
+
});
|
|
1398
|
+
}
|
|
1393
1399
|
|
|
1394
1400
|
break;
|
|
1395
1401
|
}
|