Convert a tool-like object to an OpenAI tool schema.
convert_to_openai_tool(
tool: Mapping[str, Any] | type[BaseModel] | Callable | BaseTool,
*,
strict: bool | None = None
) -> dict[str, Any]langchain-core 0.3.16description and parameters keys are now optional. Only name is
required and guaranteed to be part of the output.
langchain-core 0.3.44Return OpenAI Responses API-style tools unchanged. This includes
any dict with "type" in "file_search", "function",
"computer_use_preview", "web_search_preview".
langchain-core 0.3.63Added support for OpenAI's image generation built-in tool.
| Name | Type | Description |
|---|---|---|
tool* | Mapping[str, Any] | type[BaseModel] | Callable | BaseTool | Either a dictionary, a If a dictionary is passed in, it is assumed to already be a valid OpenAI
function, a JSON schema with top-level |
strict | bool | None | Default: NoneIf If |