Parameters
- tool: Record<string, any> | StructuredToolInterface<JsonSchema7Type | ZodObjectAny | ZodEffects<ZodObjectAny, any, {}>, unknown> | RunnableToolLike<ZodType<any, ZodTypeDef, any>, unknown>
Optional
fields: number | {
strict?: boolean;
}
The inputted tool in OpenAI tool format.
Formats a
StructuredTool
orRunnableToolLike
instance into a format that is compatible with OpenAI tool calling. IfStructuredTool
orRunnableToolLike
has a zod schema, it uses thezodToJsonSchema
function to convert the schema of theStructuredTool
orRunnableToolLike
into a JSON schema, which is then used as the parameters for the OpenAI tool.