@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.
- package/dist/messages/ai.cjs +4 -2
- package/dist/messages/ai.js +4 -2
- package/package.json +1 -1
package/dist/messages/ai.cjs
CHANGED
|
@@ -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 (
|
|
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({
|
package/dist/messages/ai.js
CHANGED
|
@@ -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 (
|
|
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({
|