convert_runnable_to_tool#

langchain_core.tools.convert.convert_runnable_to_tool(runnable: Runnable, args_schema: type[BaseModel] | None = None, *, name: str | None = None, description: str | None = None, arg_types: dict[str, type] | None = None) β†’ BaseTool[source]#

Convert a Runnable into a BaseTool.

Parameters:
  • runnable (Runnable) – The runnable to convert.

  • args_schema (type[BaseModel] | None) – The schema for the tool’s input arguments. Defaults to None.

  • name (str | None) – The name of the tool. Defaults to None.

  • description (str | None) – The description of the tool. Defaults to None.

  • arg_types (dict[str, type] | None) – The types of the arguments. Defaults to None.

Returns:

The tool.

Return type:

BaseTool