@langchain/core 0.1.50 → 0.1.51

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.
@@ -165,16 +165,22 @@ class Runnable extends serializable_js_1.Serializable {
165
165
  await wrappedGenerator.setup;
166
166
  return stream_js_1.IterableReadableStream.fromAsyncGenerator(wrappedGenerator);
167
167
  }
168
- _separateRunnableConfigFromCallOptions(options = {}) {
169
- const runnableConfig = (0, config_js_1.ensureConfig)({
170
- callbacks: options.callbacks,
171
- tags: options.tags,
172
- metadata: options.metadata,
173
- runName: options.runName,
174
- configurable: options.configurable,
175
- recursionLimit: options.recursionLimit,
176
- maxConcurrency: options.maxConcurrency,
177
- });
168
+ _separateRunnableConfigFromCallOptions(options) {
169
+ let runnableConfig;
170
+ if (options === undefined) {
171
+ runnableConfig = (0, config_js_1.ensureConfig)(options);
172
+ }
173
+ else {
174
+ runnableConfig = (0, config_js_1.ensureConfig)({
175
+ callbacks: options.callbacks,
176
+ tags: options.tags,
177
+ metadata: options.metadata,
178
+ runName: options.runName,
179
+ configurable: options.configurable,
180
+ recursionLimit: options.recursionLimit,
181
+ maxConcurrency: options.maxConcurrency,
182
+ });
183
+ }
178
184
  const callOptions = { ...options };
179
185
  delete callOptions.callbacks;
180
186
  delete callOptions.tags;
@@ -158,16 +158,22 @@ export class Runnable extends Serializable {
158
158
  await wrappedGenerator.setup;
159
159
  return IterableReadableStream.fromAsyncGenerator(wrappedGenerator);
160
160
  }
161
- _separateRunnableConfigFromCallOptions(options = {}) {
162
- const runnableConfig = ensureConfig({
163
- callbacks: options.callbacks,
164
- tags: options.tags,
165
- metadata: options.metadata,
166
- runName: options.runName,
167
- configurable: options.configurable,
168
- recursionLimit: options.recursionLimit,
169
- maxConcurrency: options.maxConcurrency,
170
- });
161
+ _separateRunnableConfigFromCallOptions(options) {
162
+ let runnableConfig;
163
+ if (options === undefined) {
164
+ runnableConfig = ensureConfig(options);
165
+ }
166
+ else {
167
+ runnableConfig = ensureConfig({
168
+ callbacks: options.callbacks,
169
+ tags: options.tags,
170
+ metadata: options.metadata,
171
+ runName: options.runName,
172
+ configurable: options.configurable,
173
+ recursionLimit: options.recursionLimit,
174
+ maxConcurrency: options.maxConcurrency,
175
+ });
176
+ }
171
177
  const callOptions = { ...options };
172
178
  delete callOptions.callbacks;
173
179
  delete callOptions.tags;
@@ -84,6 +84,9 @@ exports.mergeConfigs = mergeConfigs;
84
84
  const PRIMITIVES = new Set(["string", "number", "boolean"]);
85
85
  /**
86
86
  * Ensure that a passed config is an object with all required keys present.
87
+ *
88
+ * Note: To make sure async local storage loading works correctly, this
89
+ * should not be called with a default or prepopulated config argument.
87
90
  */
88
91
  function ensureConfig(config) {
89
92
  const loadedConfig = config ?? index_js_1.AsyncLocalStorageProviderSingleton.getInstance().getStore();
@@ -17,6 +17,9 @@ export declare function getCallbackManagerForConfig(config?: RunnableConfig): Pr
17
17
  export declare function mergeConfigs<CallOptions extends RunnableConfig>(...configs: (CallOptions | RunnableConfig | undefined | null)[]): Partial<CallOptions>;
18
18
  /**
19
19
  * Ensure that a passed config is an object with all required keys present.
20
+ *
21
+ * Note: To make sure async local storage loading works correctly, this
22
+ * should not be called with a default or prepopulated config argument.
20
23
  */
21
24
  export declare function ensureConfig<CallOptions extends RunnableConfig>(config?: CallOptions): CallOptions;
22
25
  /**
@@ -79,6 +79,9 @@ export function mergeConfigs(...configs) {
79
79
  const PRIMITIVES = new Set(["string", "number", "boolean"]);
80
80
  /**
81
81
  * Ensure that a passed config is an object with all required keys present.
82
+ *
83
+ * Note: To make sure async local storage loading works correctly, this
84
+ * should not be called with a default or prepopulated config argument.
82
85
  */
83
86
  export function ensureConfig(config) {
84
87
  const loadedConfig = config ?? AsyncLocalStorageProviderSingleton.getInstance().getStore();
@@ -410,7 +410,7 @@ class RemoteRunnable extends base_js_1.Runnable {
410
410
  yield {
411
411
  event: chunk.event,
412
412
  name: chunk.name,
413
- run_id: chunk.id,
413
+ run_id: chunk.run_id,
414
414
  tags: chunk.tags,
415
415
  metadata: chunk.metadata,
416
416
  data: chunk.data,
@@ -407,7 +407,7 @@ export class RemoteRunnable extends Runnable {
407
407
  yield {
408
408
  event: chunk.event,
409
409
  name: chunk.name,
410
- run_id: chunk.id,
410
+ run_id: chunk.run_id,
411
411
  tags: chunk.tags,
412
412
  metadata: chunk.metadata,
413
413
  data: chunk.data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {