convert_pydantic_to_openai_function#

langchain_core.utils.function_calling.convert_pydantic_to_openai_function(model: type, *, name: str | None = None, description: str | None = None, rm_titles: bool = True) FunctionDescription[source]#

Deprecated since version 0.1.16: Use convert_to_openai_function() instead.

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

Parameters:
  • model (type) – 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.

  • rm_titles (bool) – Whether to remove titles from the schema. Defaults to True.

Returns:

The function description.

Return type:

FunctionDescription

Examples using convert_pydantic_to_openai_function