import { ToolCallDelta } from ".."; export function safeParseToolCallArgs( toolCall: ToolCallDelta, ): Record { try { return JSON.parse(toolCall.function?.arguments?.trim() || "{}"); } catch (e) { //console.error( // `Failed to parse tool call arguments:\nTool call: ${toolCall.function?.name + " " + toolCall.id}\nArgs:${toolCall.function?.arguments}\n`, //); return {}; } }