import { z } from 'zod'; import { RunnableConfig } from '@langchain/core/runnables'; import { StructuredTool, ToolParams } from '@langchain/core/tools'; import { CallbackManagerForToolRun, Callbacks } from '@langchain/core/callbacks/manager'; import { ICommonObject } from '../../../src/Interface'; export declare const defaultCode = "const fetch = require('node-fetch');\nconst url = $url;\nconst options = $options;\n\ntry {\n\tconst response = await fetch(url, options);\n\tconst resp = await response.json();\n\treturn JSON.stringify(resp);\n} catch (error) {\n\tconsole.error(error);\n\treturn '';\n}\n"; export declare const howToUseCode = "- **Libraries:** \n You can use any libraries imported in Flowise.\n\n- **Tool Input Arguments:** \n Tool input arguments are available as the following variables:\n - `$PathParameters`\n - `$QueryParameters`\n - `$RequestBody`\n\n- **HTTP Requests:** \n By default, you can get the following values for making HTTP requests:\n - `$url`\n - `$options`\n\n- **Default Flow Config:** \n You can access the default flow configuration using these variables:\n - `$flow.sessionId`\n - `$flow.chatId`\n - `$flow.chatflowId`\n - `$flow.input`\n - `$flow.state`\n\n- **Custom Variables:** \n You can get custom variables using the syntax:\n - `$vars.`\n\n- **Return Value:** \n The function must return a **string** value at the end.\n\n```js\nconst fetch = require('node-fetch');\nconst url = $url;\nconst options = $options;\n\ntry {\n\tconst response = await fetch(url, options);\n\tconst resp = await response.json();\n\treturn JSON.stringify(resp);\n} catch (error) {\n\tconsole.error(error);\n\treturn '';\n}\n\n```\n"; export interface BaseDynamicToolInput extends ToolParams { name: string; description: string; returnDirect?: boolean; } export interface DynamicStructuredToolInput = z.ZodObject> extends BaseDynamicToolInput { func?: (input: z.infer, runManager?: CallbackManagerForToolRun) => Promise; schema: T; baseUrl: string; method: string; headers: ICommonObject; customCode?: string; strict?: boolean; removeNulls?: boolean; } export declare class DynamicStructuredTool = z.ZodObject> extends StructuredTool { name: string; description: string; baseUrl: string; method: string; headers: ICommonObject; customCode?: string; strict?: boolean; func: DynamicStructuredToolInput['func']; schema: T; private variables; private flowObj; private removeNulls; constructor(fields: DynamicStructuredToolInput); call(arg: z.output, configArg?: RunnableConfig | Callbacks, tags?: string[], flowConfig?: { sessionId?: string; chatId?: string; input?: string; state?: ICommonObject; }): Promise; protected _call(arg: z.output, _?: CallbackManagerForToolRun, flowConfig?: { sessionId?: string; chatId?: string; input?: string; state?: ICommonObject; }): Promise; setVariables(variables: any[]): void; setFlowObject(flow: any): void; isStrict(): boolean; }