@ai-sdk/anthropic 4.0.80 → 4.0.81
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 +22 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +21 -0
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/convert-to-anthropic-prompt.ts +25 -0
package/dist/internal/index.js
CHANGED
|
@@ -2527,6 +2527,27 @@ async function convertToAnthropicPrompt({ prompt, sendReasoning, warnings, cache
|
|
|
2527
2527
|
};
|
|
2528
2528
|
case "file": {
|
|
2529
2529
|
const topLevel = getTopLevelMediaType(contentPart.mediaType);
|
|
2530
|
+
if (contentPart.data.type === "reference") {
|
|
2531
|
+
const fileId = resolveProviderReference({
|
|
2532
|
+
reference: contentPart.data.reference,
|
|
2533
|
+
provider: "anthropic"
|
|
2534
|
+
});
|
|
2535
|
+
betas.add("files-api-2025-04-14");
|
|
2536
|
+
if (topLevel === "image") return {
|
|
2537
|
+
type: "image",
|
|
2538
|
+
source: {
|
|
2539
|
+
type: "file",
|
|
2540
|
+
file_id: fileId
|
|
2541
|
+
}
|
|
2542
|
+
};
|
|
2543
|
+
return {
|
|
2544
|
+
type: "document",
|
|
2545
|
+
source: {
|
|
2546
|
+
type: "file",
|
|
2547
|
+
file_id: fileId
|
|
2548
|
+
}
|
|
2549
|
+
};
|
|
2550
|
+
}
|
|
2530
2551
|
if (contentPart.data.type === "url") {
|
|
2531
2552
|
if (topLevel === "image") return {
|
|
2532
2553
|
type: "image",
|