@langchain/core 0.3.64 → 0.3.65
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 -3
- package/dist/messages/ai.js +4 -3
- package/package.json +1 -1
package/dist/messages/ai.cjs
CHANGED
|
@@ -155,9 +155,10 @@ class AIMessageChunk extends base_js_1.BaseMessageChunk {
|
|
|
155
155
|
for (const [id, chunks] of Object.entries(groupedToolCallChunk)) {
|
|
156
156
|
let parsedArgs = {};
|
|
157
157
|
const name = chunks[0]?.name ?? "";
|
|
158
|
-
const
|
|
158
|
+
const joinedArgs = chunks.map((c) => c.args || "").join("");
|
|
159
|
+
const argsStr = joinedArgs.length ? joinedArgs : "{}";
|
|
159
160
|
try {
|
|
160
|
-
parsedArgs = (0, json_js_1.parsePartialJson)(
|
|
161
|
+
parsedArgs = (0, json_js_1.parsePartialJson)(argsStr);
|
|
161
162
|
if (parsedArgs === null ||
|
|
162
163
|
typeof parsedArgs !== "object" ||
|
|
163
164
|
Array.isArray(parsedArgs)) {
|
|
@@ -173,7 +174,7 @@ class AIMessageChunk extends base_js_1.BaseMessageChunk {
|
|
|
173
174
|
catch (e) {
|
|
174
175
|
invalidToolCalls.push({
|
|
175
176
|
name,
|
|
176
|
-
args:
|
|
177
|
+
args: argsStr,
|
|
177
178
|
id,
|
|
178
179
|
error: "Malformed args.",
|
|
179
180
|
type: "invalid_tool_call",
|
package/dist/messages/ai.js
CHANGED
|
@@ -149,9 +149,10 @@ export class AIMessageChunk extends BaseMessageChunk {
|
|
|
149
149
|
for (const [id, chunks] of Object.entries(groupedToolCallChunk)) {
|
|
150
150
|
let parsedArgs = {};
|
|
151
151
|
const name = chunks[0]?.name ?? "";
|
|
152
|
-
const
|
|
152
|
+
const joinedArgs = chunks.map((c) => c.args || "").join("");
|
|
153
|
+
const argsStr = joinedArgs.length ? joinedArgs : "{}";
|
|
153
154
|
try {
|
|
154
|
-
parsedArgs = parsePartialJson(
|
|
155
|
+
parsedArgs = parsePartialJson(argsStr);
|
|
155
156
|
if (parsedArgs === null ||
|
|
156
157
|
typeof parsedArgs !== "object" ||
|
|
157
158
|
Array.isArray(parsedArgs)) {
|
|
@@ -167,7 +168,7 @@ export class AIMessageChunk extends BaseMessageChunk {
|
|
|
167
168
|
catch (e) {
|
|
168
169
|
invalidToolCalls.push({
|
|
169
170
|
name,
|
|
170
|
-
args:
|
|
171
|
+
args: argsStr,
|
|
171
172
|
id,
|
|
172
173
|
error: "Malformed args.",
|
|
173
174
|
type: "invalid_tool_call",
|