Formats a StructuredTool or RunnableToolLike instance into a format
that is compatible with OpenAI function 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.
convertToOpenAIFunction(
tool: StructuredToolParams | StructuredToolInterface<ToolSchemaBase, any, any> | RunnableToolLike<InteropZodType, unknown>,
fields: number | __type
): FunctionDefinition| Name | Type | Description |
|---|---|---|
tool* | StructuredToolParams | StructuredToolInterface<ToolSchemaBase, any, any> | RunnableToolLike<InteropZodType, unknown> | The tool to convert to an OpenAI function. |
fields | number | __type |