@ai-sdk/langchain 2.0.319 → 2.0.321

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/langchain",
3
- "version": "2.0.319",
3
+ "version": "2.0.321",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -25,7 +25,8 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "ai": "6.0.311"
28
+ "@ai-sdk/provider-utils": "4.0.62",
29
+ "ai": "6.0.313"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@langchain/core": "^1.1.5",
@@ -33,7 +34,6 @@
33
34
  "@types/node": "20.17.24",
34
35
  "tsup": "^8",
35
36
  "typescript": "5.8.3",
36
- "@ai-sdk/provider-utils": "4.0.61",
37
37
  "@vercel/ai-tsconfig": "0.0.0"
38
38
  },
39
39
  "peerDependencies": {
package/src/utils.ts CHANGED
@@ -17,6 +17,10 @@ import {
17
17
  type ProviderMetadata,
18
18
  type JSONValue,
19
19
  } from 'ai';
20
+ import {
21
+ convertUint8ArrayToBase64,
22
+ secureJsonParse,
23
+ } from '@ai-sdk/provider-utils';
20
24
 
21
25
  import {
22
26
  type LangGraphEventState,
@@ -246,7 +250,7 @@ function convertImageToContentBlock(
246
250
  const bytes = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
247
251
  return {
248
252
  type: 'image',
249
- data: btoa(String.fromCharCode(...bytes)),
253
+ data: convertUint8ArrayToBase64(bytes),
250
254
  mimeType: mediaType,
251
255
  };
252
256
  }
@@ -353,7 +357,7 @@ export function convertUserContent(content: UserContent): HumanMessage {
353
357
  filePart.data instanceof ArrayBuffer
354
358
  ? new Uint8Array(filePart.data)
355
359
  : filePart.data;
356
- const base64 = btoa(String.fromCharCode(...bytes));
360
+ const base64 = convertUint8ArrayToBase64(bytes);
357
361
  contentBlocks.push({
358
362
  type: 'file',
359
363
  data: base64,
@@ -1886,7 +1890,7 @@ export function processLangGraphEvent(
1886
1890
  let args: unknown;
1887
1891
  try {
1888
1892
  args = functionData?.arguments
1889
- ? JSON.parse(functionData.arguments)
1893
+ ? secureJsonParse(functionData.arguments)
1890
1894
  : {};
1891
1895
  } catch {
1892
1896
  args = {};