• Formats a StructuredTool or RunnableToolLike instance into a format that is compatible with OpenAI tool calling. It uses the zodToJsonSchema function to convert the schema of the StructuredTool or RunnableToolLike into a JSON schema, which is then used as the parameters for the OpenAI tool.

    Parameters

    • tool: Record<string, any> | StructuredToolInterface<ZodObjectAny> | RunnableToolLike<ZodType<any, ZodTypeDef, any>, unknown>

      The tool to convert to an OpenAI tool.

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

    Returns ToolDefinition

    The inputted tool in OpenAI tool format.