@ai-sdk/anthropic 4.0.0-beta.16 → 4.0.0-beta.17
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1162 -1060
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1162 -1050
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +20 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +22 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/anthropic-files.ts +106 -0
- package/src/anthropic-messages-api.ts +4 -0
- package/src/anthropic-provider.ts +13 -1
- package/src/convert-to-anthropic-messages-prompt.ts +23 -1
package/dist/internal/index.js
CHANGED
|
@@ -2067,7 +2067,26 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2067
2067
|
break;
|
|
2068
2068
|
}
|
|
2069
2069
|
case "file": {
|
|
2070
|
-
if (part.
|
|
2070
|
+
if ((0, import_provider_utils14.isProviderReference)(part.data)) {
|
|
2071
|
+
const fileId = (0, import_provider_utils14.resolveProviderReference)({
|
|
2072
|
+
reference: part.data,
|
|
2073
|
+
provider: "anthropic"
|
|
2074
|
+
});
|
|
2075
|
+
betas.add("files-api-2025-04-14");
|
|
2076
|
+
if (part.mediaType.startsWith("image/")) {
|
|
2077
|
+
anthropicContent.push({
|
|
2078
|
+
type: "image",
|
|
2079
|
+
source: { type: "file", file_id: fileId },
|
|
2080
|
+
cache_control: cacheControl
|
|
2081
|
+
});
|
|
2082
|
+
} else {
|
|
2083
|
+
anthropicContent.push({
|
|
2084
|
+
type: "document",
|
|
2085
|
+
source: { type: "file", file_id: fileId },
|
|
2086
|
+
cache_control: cacheControl
|
|
2087
|
+
});
|
|
2088
|
+
}
|
|
2089
|
+
} else if (part.mediaType.startsWith("image/")) {
|
|
2071
2090
|
anthropicContent.push({
|
|
2072
2091
|
type: "image",
|
|
2073
2092
|
source: isUrlData(part.data) ? {
|