@ai-sdk/anthropic 4.0.60 → 4.0.61
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 +9 -0
- package/dist/index.js +17 -6
- 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 +4 -0
- package/src/anthropic-language-model.ts +4 -0
- package/src/convert-to-anthropic-prompt.ts +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/anthropic",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.61",
|
|
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.46"
|
|
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
|
@@ -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
|
}
|