From c92720170626644bd90a9a701cbf042d92e1650a Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Fri, 4 Oct 2024 17:02:10 +0200 Subject: [PATCH] feat(agent): simplify tools' schema that is passing to prompt Signed-off-by: Tomas Dvorak --- src/agents/bee/runner.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/agents/bee/runner.ts b/src/agents/bee/runner.ts index ece073ea..203afb45 100644 --- a/src/agents/bee/runner.ts +++ b/src/agents/bee/runner.ts @@ -119,6 +119,7 @@ export class BeeAgentRunner { }, }, }); + await memory.addMany([ BaseMessage.of({ role: Role.SYSTEM, @@ -127,7 +128,13 @@ export class BeeAgentRunner { input.tools.map(async (tool) => ({ name: tool.name, description: tool.description.replaceAll("\n", ".").replace(/\.$/, "").concat("."), - schema: JSON.stringify(await tool.getInputJsonSchema()), + schema: JSON.stringify( + await tool.getInputJsonSchema(), + (() => { + const ignoredKeys = new Set(["minLength", "maxLength", "$schema"]); + return (key, value) => (ignoredKeys.has(key) ? undefined : value); + })(), + ), })), ), instructions: undefined,