@ai-sdk/anthropic 4.0.46 → 4.0.47
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 +10 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +9 -4
- package/dist/internal/index.js.map +1 -1
- package/package.json +3 -3
- package/src/anthropic-files.ts +8 -3
package/dist/internal/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare class AnthropicFiles implements FilesV4 {
|
|
|
15
15
|
readonly specificationVersion = "v4";
|
|
16
16
|
get provider(): string;
|
|
17
17
|
constructor(config: AnthropicFilesConfig);
|
|
18
|
-
uploadFile({ data, mediaType, filename, }: FilesV4UploadFileCallOptions): Promise<FilesV4UploadFileResult>;
|
|
18
|
+
uploadFile({ data, mediaType, filename, abortSignal, headers, }: FilesV4UploadFileCallOptions): Promise<FilesV4UploadFileResult>;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
type AnthropicMessage = AnthropicUserMessage | AnthropicAssistantMessage | AnthropicSystemMessage;
|
package/dist/internal/index.js
CHANGED
|
@@ -57,7 +57,9 @@ var AnthropicFiles = class {
|
|
|
57
57
|
async uploadFile({
|
|
58
58
|
data,
|
|
59
59
|
mediaType,
|
|
60
|
-
filename
|
|
60
|
+
filename,
|
|
61
|
+
abortSignal,
|
|
62
|
+
headers
|
|
61
63
|
}) {
|
|
62
64
|
var _a, _b;
|
|
63
65
|
const fileBytes = convertInlineFileDataToUint8Array(data);
|
|
@@ -70,14 +72,17 @@ var AnthropicFiles = class {
|
|
|
70
72
|
}
|
|
71
73
|
const { value: response } = await postFormDataToApi({
|
|
72
74
|
url: `${this.config.baseURL}/files`,
|
|
73
|
-
headers: combineHeaders(
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
headers: combineHeaders(
|
|
76
|
+
this.config.headers(),
|
|
77
|
+
{ "anthropic-beta": "files-api-2025-04-14" },
|
|
78
|
+
headers
|
|
79
|
+
),
|
|
76
80
|
formData,
|
|
77
81
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
78
82
|
successfulResponseHandler: createJsonResponseHandler(
|
|
79
83
|
anthropicUploadFileResponseSchema
|
|
80
84
|
),
|
|
85
|
+
abortSignal,
|
|
81
86
|
fetch: this.config.fetch
|
|
82
87
|
});
|
|
83
88
|
return {
|