We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 46dc45a + 82f6f69 commit 363c3c7Copy full SHA for 363c3c7
core/tools/parseArgs.ts
@@ -3,6 +3,17 @@ import { ToolCallDelta } from "..";
3
export function safeParseToolCallArgs(
4
toolCall: ToolCallDelta,
5
): Record<string, any> {
6
+ const args = toolCall.function?.arguments;
7
+
8
+ if (
9
+ args &&
10
+ typeof args === "object" &&
11
+ !Array.isArray(args) &&
12
+ Object.keys(args).length > 0
13
+ ) {
14
+ return args;
15
+ }
16
17
try {
18
return JSON.parse(toolCall.function?.arguments?.trim() || "{}");
19
} catch (e) {
0 commit comments