UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

24 lines (23 loc) • 674 B
function isPlainRecord(value) { return typeof value === "object" && value !== null && !Array.isArray(value); } export function parseToolArguments(raw, kind) { if (kind === "custom") { return { input: raw }; } // Empty arguments is the documented zero-argument-call shape, not // malformed input — it must not be wrapped as `{ input: "" }`. if (raw === "") { return {}; } try { const parsed = JSON.parse(raw); if (isPlainRecord(parsed)) { return parsed; } } catch { // fall through — not JSON at all (e.g. a stray shell-command string) } return { input: raw }; }