From cac21356b41be16faf044093d4cf0588ebce57d2 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 13 Oct 2024 13:11:28 -0700 Subject: [PATCH] Fix incorrect json API description. --- .../agents/aibitat/providers/helpers/untooled.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/utils/agents/aibitat/providers/helpers/untooled.js b/server/utils/agents/aibitat/providers/helpers/untooled.js index 11fbfec8be6..415a774257b 100644 --- a/server/utils/agents/aibitat/providers/helpers/untooled.js +++ b/server/utils/agents/aibitat/providers/helpers/untooled.js @@ -33,7 +33,19 @@ ${JSON.stringify(def.parameters.properties, null, 4)}\n`; if (Array.isArray(def.examples)) { def.examples.forEach(({ prompt, call }) => { - shotExample += `Query: "${prompt}"\nJSON: ${call}\n`; + // Parse the original call JSON + let callObj = JSON.parse(call); + + // Create a new object with the correct structure + let formattedCall = { + name: def.name, + arguments: callObj + }; + + // Stringify the new object with proper formatting + let formattedCallString = JSON.stringify(formattedCall, null, 2); + + shotExample += `Query: "${prompt}"\nJSON: ${formattedCallString}\n`; }); } output += `${shotExample}-----------\n`;