@langchain/core 0.3.39 → 0.3.41

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") {
@@ -1,7 +1,7 @@
1
1
  import type { z } from "zod";
2
2
  import type { SerializableInterface } from "../load/serializable.js";
3
3
  import type { BaseCallbackConfig } from "../callbacks/manager.js";
4
- import type { IterableReadableStreamInterface } from "../types/stream.js";
4
+ import type { IterableReadableStreamInterface } from "../types/_internal.js";
5
5
  export type RunnableBatchOptions = {
6
6
  /** @deprecated Pass in via the standard runnable config object instead */
7
7
  maxConcurrency?: number;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type IterableReadableStreamInterface<T> = ReadableStream<T> & AsyncIterable<T>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,2 @@
1
- export type IterableReadableStreamInterface<T> = ReadableStream<T> & AsyncIterable<T>;
1
+ export { type IterableReadableStreamInterface } from "./_internal.js";
2
+ export { type StreamEvent, type StreamEventData, } from "../tracers/event_stream.js";
@@ -1,4 +1,4 @@
1
- import type { IterableReadableStreamInterface } from "../types/stream.js";
1
+ import type { IterableReadableStreamInterface } from "../types/_internal.js";
2
2
  export type { IterableReadableStreamInterface };
3
3
  export declare class IterableReadableStream<T> extends ReadableStream<T> implements IterableReadableStreamInterface<T> {
4
4
  reader: ReadableStreamDefaultReader<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.3.39",
3
+ "version": "0.3.41",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {
@@ -494,6 +494,15 @@
494
494
  "import": "./tracers/tracer_langchain_v1.js",
495
495
  "require": "./tracers/tracer_langchain_v1.cjs"
496
496
  },
497
+ "./types/stream": {
498
+ "types": {
499
+ "import": "./types/stream.d.ts",
500
+ "require": "./types/stream.d.cts",
501
+ "default": "./types/stream.d.ts"
502
+ },
503
+ "import": "./types/stream.js",
504
+ "require": "./types/stream.cjs"
505
+ },
497
506
  "./utils/async_caller": {
498
507
  "types": {
499
508
  "import": "./utils/async_caller.d.ts",
@@ -804,6 +813,10 @@
804
813
  "tracers/tracer_langchain_v1.js",
805
814
  "tracers/tracer_langchain_v1.d.ts",
806
815
  "tracers/tracer_langchain_v1.d.cts",
816
+ "types/stream.cjs",
817
+ "types/stream.js",
818
+ "types/stream.d.ts",
819
+ "types/stream.d.cts",
807
820
  "utils/async_caller.cjs",
808
821
  "utils/async_caller.js",
809
822
  "utils/async_caller.d.ts",
@@ -0,0 +1 @@
1
+ module.exports = require('../dist/types/stream.cjs');
@@ -0,0 +1 @@
1
+ export * from '../dist/types/stream.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/types/stream.js'
@@ -0,0 +1 @@
1
+ export * from '../dist/types/stream.js'