@ai-sdk/langchain 2.0.318 → 2.0.320
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 +17 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/utils.ts +3 -2
package/dist/index.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
ToolMessage,
|
|
14
14
|
AIMessageChunk
|
|
15
15
|
} from "@langchain/core/messages";
|
|
16
|
+
import { convertUint8ArrayToBase64 } from "@ai-sdk/provider-utils";
|
|
16
17
|
function parseLangGraphEvent(event) {
|
|
17
18
|
return event.length === 3 ? [event[0], event[1], event[2]] : [void 0, event[0], event[1]];
|
|
18
19
|
}
|
|
@@ -162,7 +163,7 @@ function convertImageToContentBlock(data, mediaType = "image/png") {
|
|
|
162
163
|
const bytes = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
|
163
164
|
return {
|
|
164
165
|
type: "image",
|
|
165
|
-
data:
|
|
166
|
+
data: convertUint8ArrayToBase64(bytes),
|
|
166
167
|
mimeType: mediaType
|
|
167
168
|
};
|
|
168
169
|
}
|
|
@@ -233,7 +234,7 @@ function convertUserContent(content) {
|
|
|
233
234
|
}
|
|
234
235
|
} else if (filePart.data instanceof Uint8Array || filePart.data instanceof ArrayBuffer) {
|
|
235
236
|
const bytes = filePart.data instanceof ArrayBuffer ? new Uint8Array(filePart.data) : filePart.data;
|
|
236
|
-
const base64 =
|
|
237
|
+
const base64 = convertUint8ArrayToBase64(bytes);
|
|
237
238
|
contentBlocks.push({
|
|
238
239
|
type: "file",
|
|
239
240
|
data: base64,
|