• Given a runnable and a Zod schema, convert the runnable to a tool.

    Parameters

    • runnable: Runnable<any, any, RunnableConfig>

      The runnable to convert to a tool.

    • fields: {
          schema: ZodAny;
          description?: string;
          name?: string;
      }
      • schema: ZodAny

        The Zod schema for the input of the tool.

      • Optionaldescription?: string

        The description of the tool. If not provided, it will default to Takes {schema} where schema is a JSON string representation of the input schema.

      • Optionalname?: string

        The name of the tool. If not provided, it will default to the name of the runnable.

    Returns StructuredTool

    The tool created from the runnable.