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