langchain.js
    Preparing search index...
    • Formats a StructuredTool or RunnableToolLike instance into a format that is compatible with OpenAI tool calling. If StructuredTool or RunnableToolLike has a zod schema, the output will be converted into a JSON schema, which is then used as the parameters for the OpenAI tool.

      Parameters

      • tool:
            | Record<string, any>
            | StructuredToolInterface<ToolSchemaBase, any, any>
            | RunnableToolLike<InteropZodType, unknown>

        The tool to convert to an OpenAI tool.

      • Optionalfields: number | { strict?: boolean }
        • number
        • { strict?: boolean }
          • Optionalstrict?: boolean

            If true, model output is guaranteed to exactly match the JSON Schema provided in the function definition.

      Returns ToolDefinition

      The inputted tool in OpenAI tool format.