• Formats a StructuredTool or RunnableToolLike instance into a format that is compatible with OpenAI function 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 function.

    Parameters

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

      The tool to convert to an OpenAI function.

    • Optionalfields: {
          strict?: boolean;
      }
      • Optionalstrict?: boolean

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

    Returns FunctionDefinition

    The inputted tool in OpenAI function format.