convert_pydantic_to_openai_tool#

langchain_core.utils.function_calling.convert_pydantic_to_openai_tool(
model: type[BaseModel],
*,
name: str | None = None,
description: str | None = None,
) ToolDescription[source]#

Deprecated since version 0.1.16: Use convert_to_openai_tool() instead. It will not be removed until langchain-core==1.0.

Converts a Pydantic model to a function description for the OpenAI API.

Parameters:
  • model (type[BaseModel]) – The Pydantic model to convert.

  • name (str | None) – The name of the function. If not provided, the title of the schema will be used.

  • description (str | None) – The description of the function. If not provided, the description of the schema will be used.

Returns:

The tool description.

Return type:

ToolDescription