From 18b83333d3d28ad0e02bf192459defdc353d8404 Mon Sep 17 00:00:00 2001 From: YISH Date: Fri, 21 Jun 2024 23:45:20 +0800 Subject: [PATCH] Fix `observation?.includes is not a function` (#2696) --- packages/components/nodes/tools/CustomTool/core.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/components/nodes/tools/CustomTool/core.ts b/packages/components/nodes/tools/CustomTool/core.ts index 86addc6b1..786ad6f7d 100644 --- a/packages/components/nodes/tools/CustomTool/core.ts +++ b/packages/components/nodes/tools/CustomTool/core.ts @@ -96,6 +96,9 @@ export class DynamicStructuredTool< await runManager?.handleToolError(e) throw e } + if (result && typeof result !== 'string') { + result = JSON.stringify(result) + } await runManager?.handleToolEnd(result) return result }