• Preparing search index...
  • The search index is not available
LangChain.js - v0.2.13
  • LangChain.js
  • langchain-core/tools
  • tool

Function tool

  • tool<T>(func, fields): DynamicTool
  • Creates a new StructuredTool instance with the provided function, name, description, and schema.

    Schema can be provided as Zod or JSON schema. If you pass JSON schema, tool inputs will not be validated.

    Type Parameters

    • T extends ZodString

      The input schema for the tool. Either any Zod object, a Zod string, or JSON schema instance.

    Parameters

    • func: RunnableFunc<output<T>, any>

      The function to invoke when the tool is called.

    • fields: ToolWrapperParams<T>

      An object containing the following properties:

    Returns DynamicTool

    A new StructuredTool instance.

    Function

    • Defined in langchain-core/src/tools/index.ts:534
  • tool<T>(func, fields): DynamicStructuredTool<T>
  • Type Parameters

    • T extends ZodObjectAny

    Parameters

    • func: RunnableFunc<output<T>, any>
    • fields: ToolWrapperParams<T>

    Returns DynamicStructuredTool<T>

    • Defined in langchain-core/src/tools/index.ts:539
  • tool<T>(func, fields): DynamicStructuredTool<T>
  • Type Parameters

    • T extends Record<string, any>

    Parameters

    • func: RunnableFunc<T, any>
    • fields: ToolWrapperParams<T>

    Returns DynamicStructuredTool<T>

    • Defined in langchain-core/src/tools/index.ts:545

Settings

Member Visibility
LangChain.js - v0.2.13
  • Loading...

Generated using TypeDoc