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

Function tool

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

    Type Parameters

    • RunInput extends ZodAny = ZodAny

      The input schema for the tool. This corresponds to the input type when the tool is invoked.

    • RunOutput extends ToolMessage = ToolMessage

      The output type for the tool. This corresponds to the output type when the tool is invoked.

    • FuncInput extends any = TypeOf<RunInput>

      The input type for the function.

    Parameters

    • func: RunnableFunc<FuncInput, ContentAndRawOutput>

      The function to invoke when the tool is called.

    • fields: Omit<ToolWrapperParams<RunInput>, "responseFormat"> & {
          responseFormat: "contentAndRawOutput";
      }

      An object containing the following properties:

    Returns DynamicStructuredTool<RunInput, RunOutput>

    A new StructuredTool instance.

    Function

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

    • RunInput extends ZodAny = ZodAny
    • RunOutput extends string = string
    • FuncInput extends any = TypeOf<RunInput>

    Parameters

    • func: RunnableFunc<FuncInput, string>
    • fields: Omit<ToolWrapperParams<RunInput>, "responseFormat"> & {
          responseFormat?: "content";
      }

    Returns DynamicStructuredTool<RunInput, RunOutput>

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

Settings

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

Generated using TypeDoc