@langchain/core 0.3.40 → 0.3.42

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.
@@ -240,9 +240,11 @@ async function index(args) {
240
240
  before: indexStartDt,
241
241
  groupIds: sourceIds,
242
242
  });
243
- await vectorStore.delete({ ids: uidsToDelete });
244
- await recordManager.deleteKeys(uidsToDelete);
245
- numDeleted += uidsToDelete.length;
243
+ if (uidsToDelete.length > 0) {
244
+ await vectorStore.delete({ ids: uidsToDelete });
245
+ await recordManager.deleteKeys(uidsToDelete);
246
+ numDeleted += uidsToDelete.length;
247
+ }
246
248
  }
247
249
  }
248
250
  if (cleanup === "full") {
@@ -232,9 +232,11 @@ export async function index(args) {
232
232
  before: indexStartDt,
233
233
  groupIds: sourceIds,
234
234
  });
235
- await vectorStore.delete({ ids: uidsToDelete });
236
- await recordManager.deleteKeys(uidsToDelete);
237
- numDeleted += uidsToDelete.length;
235
+ if (uidsToDelete.length > 0) {
236
+ await vectorStore.delete({ ids: uidsToDelete });
237
+ await recordManager.deleteKeys(uidsToDelete);
238
+ numDeleted += uidsToDelete.length;
239
+ }
238
240
  }
239
241
  }
240
242
  if (cleanup === "full") {
@@ -5,6 +5,9 @@ const serializable_js_1 = require("../load/serializable.cjs");
5
5
  function mergeContent(firstContent, secondContent) {
6
6
  // If first content is a string
7
7
  if (typeof firstContent === "string") {
8
+ if (firstContent === "") {
9
+ return secondContent;
10
+ }
8
11
  if (typeof secondContent === "string") {
9
12
  return firstContent + secondContent;
10
13
  }
@@ -20,6 +23,9 @@ function mergeContent(firstContent, secondContent) {
20
23
  ]);
21
24
  }
22
25
  else {
26
+ if (secondContent === "") {
27
+ return firstContent;
28
+ }
23
29
  // Otherwise, add the second content as a new element of the list
24
30
  return [...firstContent, { type: "text", text: secondContent }];
25
31
  }
@@ -2,6 +2,9 @@ import { Serializable } from "../load/serializable.js";
2
2
  export function mergeContent(firstContent, secondContent) {
3
3
  // If first content is a string
4
4
  if (typeof firstContent === "string") {
5
+ if (firstContent === "") {
6
+ return secondContent;
7
+ }
5
8
  if (typeof secondContent === "string") {
6
9
  return firstContent + secondContent;
7
10
  }
@@ -17,6 +20,9 @@ export function mergeContent(firstContent, secondContent) {
17
20
  ]);
18
21
  }
19
22
  else {
23
+ if (secondContent === "") {
24
+ return firstContent;
25
+ }
20
26
  // Otherwise, add the second content as a new element of the list
21
27
  return [...firstContent, { type: "text", text: secondContent }];
22
28
  }
@@ -21,8 +21,6 @@ class BytesOutputParser extends transform_js_1.BaseTransformOutputParser {
21
21
  writable: true,
22
22
  value: true
23
23
  });
24
- // TODO: Figure out why explicit typing is needed
25
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
24
  Object.defineProperty(this, "textEncoder", {
27
25
  enumerable: true,
28
26
  configurable: true,
@@ -7,7 +7,7 @@ export declare class BytesOutputParser extends BaseTransformOutputParser<Uint8Ar
7
7
  static lc_name(): string;
8
8
  lc_namespace: string[];
9
9
  lc_serializable: boolean;
10
- protected textEncoder: any;
10
+ protected textEncoder: InstanceType<typeof TextEncoder>;
11
11
  parse(text: string): Promise<Uint8Array>;
12
12
  getFormatInstructions(): string;
13
13
  }
@@ -18,8 +18,6 @@ export class BytesOutputParser extends BaseTransformOutputParser {
18
18
  writable: true,
19
19
  value: true
20
20
  });
21
- // TODO: Figure out why explicit typing is needed
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
21
  Object.defineProperty(this, "textEncoder", {
24
22
  enumerable: true,
25
23
  configurable: true,
@@ -63,6 +63,7 @@ function revive(obj) {
63
63
  content: obj.content,
64
64
  tool_call_id: obj.tool_call_id,
65
65
  status: obj.status,
66
+ artifact: obj.artifact,
66
67
  });
67
68
  }
68
69
  if (obj.type === "AIMessage" || obj.type === "ai") {
@@ -97,6 +98,7 @@ function revive(obj) {
97
98
  content: obj.content,
98
99
  tool_call_id: obj.tool_call_id,
99
100
  status: obj.status,
101
+ artifact: obj.artifact,
100
102
  });
101
103
  }
102
104
  if (obj.type === "AIMessageChunk") {
@@ -60,6 +60,7 @@ function revive(obj) {
60
60
  content: obj.content,
61
61
  tool_call_id: obj.tool_call_id,
62
62
  status: obj.status,
63
+ artifact: obj.artifact,
63
64
  });
64
65
  }
65
66
  if (obj.type === "AIMessage" || obj.type === "ai") {
@@ -94,6 +95,7 @@ function revive(obj) {
94
95
  content: obj.content,
95
96
  tool_call_id: obj.tool_call_id,
96
97
  status: obj.status,
98
+ artifact: obj.artifact,
97
99
  });
98
100
  }
99
101
  if (obj.type === "AIMessageChunk") {
@@ -51,6 +51,9 @@ class AsyncLocalStorageProvider {
51
51
  }
52
52
  if (previousValue !== undefined &&
53
53
  previousValue[globals_js_1._CONTEXT_VARIABLES_KEY] !== undefined) {
54
+ if (runTree === undefined) {
55
+ runTree = {};
56
+ }
54
57
  runTree[globals_js_1._CONTEXT_VARIABLES_KEY] =
55
58
  previousValue[globals_js_1._CONTEXT_VARIABLES_KEY];
56
59
  }
@@ -47,6 +47,9 @@ class AsyncLocalStorageProvider {
47
47
  }
48
48
  if (previousValue !== undefined &&
49
49
  previousValue[_CONTEXT_VARIABLES_KEY] !== undefined) {
50
+ if (runTree === undefined) {
51
+ runTree = {};
52
+ }
50
53
  runTree[_CONTEXT_VARIABLES_KEY] =
51
54
  previousValue[_CONTEXT_VARIABLES_KEY];
52
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.3.40",
3
+ "version": "0.3.42",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {