@langchain/core 0.3.38 → 0.3.40

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.
@@ -57,6 +57,9 @@ class BaseCallbackHandler extends BaseCallbackHandlerMethodsClass {
57
57
  get lc_aliases() {
58
58
  return undefined;
59
59
  }
60
+ get lc_serializable_keys() {
61
+ return undefined;
62
+ }
60
63
  /**
61
64
  * The name of the serializable. Override to provide an alias or
62
65
  * to preserve the serialized module name in minified environments.
@@ -164,6 +164,7 @@ export declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMet
164
164
  get lc_aliases(): {
165
165
  [key: string]: string;
166
166
  } | undefined;
167
+ get lc_serializable_keys(): string[] | undefined;
167
168
  /**
168
169
  * The name of the serializable. Override to provide an alias or
169
170
  * to preserve the serialized module name in minified environments.
@@ -201,6 +202,7 @@ export declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMet
201
202
  readonly lc_aliases: {
202
203
  [key: string]: string;
203
204
  } | undefined;
205
+ readonly lc_serializable_keys: string[] | undefined;
204
206
  /**
205
207
  * The final serialized identifier for the module.
206
208
  */
@@ -30,6 +30,9 @@ export class BaseCallbackHandler extends BaseCallbackHandlerMethodsClass {
30
30
  get lc_aliases() {
31
31
  return undefined;
32
32
  }
33
+ get lc_serializable_keys() {
34
+ return undefined;
35
+ }
33
36
  /**
34
37
  * The name of the serializable. Override to provide an alias or
35
38
  * to preserve the serialized module name in minified environments.
@@ -94,6 +94,13 @@ class Serializable {
94
94
  get lc_aliases() {
95
95
  return undefined;
96
96
  }
97
+ /**
98
+ * A manual list of keys that should be serialized.
99
+ * If not overridden, all fields passed into the constructor will be serialized.
100
+ */
101
+ get lc_serializable_keys() {
102
+ return undefined;
103
+ }
97
104
  constructor(kwargs, ..._args) {
98
105
  Object.defineProperty(this, "lc_serializable", {
99
106
  enumerable: true,
@@ -107,7 +114,12 @@ class Serializable {
107
114
  writable: true,
108
115
  value: void 0
109
116
  });
110
- this.lc_kwargs = kwargs || {};
117
+ if (this.lc_serializable_keys !== undefined) {
118
+ this.lc_kwargs = Object.fromEntries(Object.entries(kwargs || {}).filter(([key]) => this.lc_serializable_keys?.includes(key)));
119
+ }
120
+ else {
121
+ this.lc_kwargs = kwargs ?? {};
122
+ }
111
123
  }
112
124
  toJSON() {
113
125
  if (!this.lc_serializable) {
@@ -65,6 +65,11 @@ export declare abstract class Serializable implements SerializableInterface {
65
65
  get lc_aliases(): {
66
66
  [key: string]: string;
67
67
  } | undefined;
68
+ /**
69
+ * A manual list of keys that should be serialized.
70
+ * If not overridden, all fields passed into the constructor will be serialized.
71
+ */
72
+ get lc_serializable_keys(): string[] | undefined;
68
73
  constructor(kwargs?: SerializedFields, ..._args: never[]);
69
74
  toJSON(): Serialized;
70
75
  toJSONNotImplemented(): SerializedNotImplemented;
@@ -90,6 +90,13 @@ export class Serializable {
90
90
  get lc_aliases() {
91
91
  return undefined;
92
92
  }
93
+ /**
94
+ * A manual list of keys that should be serialized.
95
+ * If not overridden, all fields passed into the constructor will be serialized.
96
+ */
97
+ get lc_serializable_keys() {
98
+ return undefined;
99
+ }
93
100
  constructor(kwargs, ..._args) {
94
101
  Object.defineProperty(this, "lc_serializable", {
95
102
  enumerable: true,
@@ -103,7 +110,12 @@ export class Serializable {
103
110
  writable: true,
104
111
  value: void 0
105
112
  });
106
- this.lc_kwargs = kwargs || {};
113
+ if (this.lc_serializable_keys !== undefined) {
114
+ this.lc_kwargs = Object.fromEntries(Object.entries(kwargs || {}).filter(([key]) => this.lc_serializable_keys?.includes(key)));
115
+ }
116
+ else {
117
+ this.lc_kwargs = kwargs ?? {};
118
+ }
107
119
  }
108
120
  toJSON() {
109
121
  if (!this.lc_serializable) {
@@ -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.38",
3
+ "version": "0.3.40",
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'