@langchain/core 0.2.29 → 0.2.30-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.
@@ -141,8 +141,10 @@ class AIMessageChunk extends base_js_1.BaseMessageChunk {
141
141
  for (const toolCallChunk of fields.tool_call_chunks) {
142
142
  let parsedArgs = {};
143
143
  try {
144
- parsedArgs = (0, json_js_1.parsePartialJson)(toolCallChunk.args ?? "{}") ?? {};
145
- if (typeof parsedArgs !== "object" || Array.isArray(parsedArgs)) {
144
+ parsedArgs = (0, json_js_1.parsePartialJson)(toolCallChunk.args || "{}");
145
+ if (parsedArgs === null ||
146
+ typeof parsedArgs !== "object" ||
147
+ Array.isArray(parsedArgs)) {
146
148
  throw new Error("Malformed tool call chunk args.");
147
149
  }
148
150
  toolCalls.push({
@@ -136,8 +136,10 @@ export class AIMessageChunk extends BaseMessageChunk {
136
136
  for (const toolCallChunk of fields.tool_call_chunks) {
137
137
  let parsedArgs = {};
138
138
  try {
139
- parsedArgs = parsePartialJson(toolCallChunk.args ?? "{}") ?? {};
140
- if (typeof parsedArgs !== "object" || Array.isArray(parsedArgs)) {
139
+ parsedArgs = parsePartialJson(toolCallChunk.args || "{}");
140
+ if (parsedArgs === null ||
141
+ typeof parsedArgs !== "object" ||
142
+ Array.isArray(parsedArgs)) {
141
143
  throw new Error("Malformed tool call chunk args.");
142
144
  }
143
145
  toolCalls.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "0.2.29",
3
+ "version": "0.2.30-rc.0",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {