@langchain/core 0.1.25 → 0.1.27-rc.0

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.
@@ -371,7 +371,8 @@ class RemoteRunnable extends base_js_1.Runnable {
371
371
  }
372
372
  const runnableStream = (0, event_source_parse_js_1.convertEventStreamToIterableReadableDataStream)(body);
373
373
  for await (const log of runnableStream) {
374
- yield revive(JSON.parse(log));
374
+ const chunk = revive(JSON.parse(log));
375
+ yield new log_stream_js_1.RunLogPatch({ ops: chunk.ops });
375
376
  }
376
377
  }
377
378
  }
@@ -1,7 +1,7 @@
1
1
  import { Runnable, RunnableBatchOptions } from "./base.js";
2
2
  import type { RunnableConfig } from "./config.js";
3
3
  import { CallbackManagerForChainRun } from "../callbacks/manager.js";
4
- import { type LogStreamCallbackHandlerInput, type RunLogPatch } from "../tracers/log_stream.js";
4
+ import { RunLogPatch, type LogStreamCallbackHandlerInput } from "../tracers/log_stream.js";
5
5
  import { IterableReadableStream } from "../utils/stream.js";
6
6
  type RemoteRunnableOptions = {
7
7
  timeout?: number;
@@ -1,7 +1,7 @@
1
1
  import { Runnable } from "./base.js";
2
2
  import { Document } from "../documents/index.js";
3
3
  import { ChatPromptValue, StringPromptValue } from "../prompt_values.js";
4
- import { LogStreamCallbackHandler, } from "../tracers/log_stream.js";
4
+ import { LogStreamCallbackHandler, RunLogPatch, } from "../tracers/log_stream.js";
5
5
  import { AIMessage, AIMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessage, FunctionMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk, isBaseMessage, } from "../messages/index.js";
6
6
  import { GenerationChunk, ChatGenerationChunk, RUN_KEY } from "../outputs.js";
7
7
  import { getBytes, getLines, getMessages, convertEventStreamToIterableReadableDataStream, } from "../utils/event_source_parse.js";
@@ -368,7 +368,8 @@ export class RemoteRunnable extends Runnable {
368
368
  }
369
369
  const runnableStream = convertEventStreamToIterableReadableDataStream(body);
370
370
  for await (const log of runnableStream) {
371
- yield revive(JSON.parse(log));
371
+ const chunk = revive(JSON.parse(log));
372
+ yield new RunLogPatch({ ops: chunk.ops });
372
373
  }
373
374
  }
374
375
  }
@@ -152,7 +152,7 @@ function concat(first, second) {
152
152
  const chunk = { ...first };
153
153
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
154
  for (const [key, value] of Object.entries(second)) {
155
- if (key in chunk) {
155
+ if (key in chunk && !Array.isArray(chunk[key])) {
156
156
  chunk[key] = concat(chunk[key], value);
157
157
  }
158
158
  else {
@@ -147,7 +147,7 @@ export function concat(first, second) {
147
147
  const chunk = { ...first };
148
148
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
149
149
  for (const [key, value] of Object.entries(second)) {
150
- if (key in chunk) {
150
+ if (key in chunk && !Array.isArray(chunk[key])) {
151
151
  chunk[key] = concat(chunk[key], value);
152
152
  }
153
153
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.1.25",
3
+ "version": "0.1.27-rc.0",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {