fabricatio_tool.capabilities.use_tool

This module defines the UseToolBox class, which represents the usage of tools in a task.

It extends the UseLLM class and provides methods to manage and use toolboxes and tools within tasks.

Classes

ToolConfig

A configuration class for tool usage.

UseTool

A class representing the usage of tools in a task.

Module Contents

class fabricatio_tool.capabilities.use_tool.ToolConfig(/, **data: Any)

Bases: fabricatio_core.models.generic.ScopedConfig

A configuration class for tool usage.

toolboxes: Set[fabricatio_tool.models.tool.ToolBox] = None

A set of toolboxes used by the instance.

class fabricatio_tool.capabilities.use_tool.UseTool(/, **data: Any)

Bases: fabricatio_core.capabilities.usages.UseLLM, ToolConfig, abc.ABC

A class representing the usage of tools in a task.

This class extends LLMUsage and provides methods to manage and use toolboxes and tools within tasks.

async choose_toolboxes(request: str, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ChooseKwargs[fabricatio_tool.models.tool.ToolBox]]) List[fabricatio_tool.models.tool.ToolBox] | None

Asynchronously executes a multi-choice decision-making process to choose toolboxes.

Parameters:
  • request (str) – The request for toolbox selection.

  • **kwargs (Unpack[LLMKwargs]) – Additional keyword arguments for the LLM usage.

Returns:

The selected toolboxes.

Return type:

Optional[List[ToolBox]]

async choose_tools(request: str, toolbox: fabricatio_tool.models.tool.ToolBox, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ChooseKwargs[fabricatio_tool.models.tool.Tool]]) List[fabricatio_tool.models.tool.Tool] | None

Asynchronously executes a multi-choice decision-making process to choose tools.

Parameters:
  • request (str) – The request for tool selection.

  • toolbox (ToolBox) – The toolbox from which to choose tools.

  • **kwargs (Unpack[LLMKwargs]) – Additional keyword arguments for the LLM usage.

Returns:

The selected tools.

Return type:

Optional[List[Tool]]

async gather_tools_fine_grind(request: str, box_choose_kwargs: fabricatio_core.models.kwargs_types.ChooseKwargs[fabricatio_tool.models.tool.ToolBox] | None = None, tool_choose_kwargs: fabricatio_core.models.kwargs_types.ChooseKwargs[fabricatio_tool.models.tool.Tool] | None = None) List[fabricatio_tool.models.tool.Tool]

Asynchronously gathers tools based on the provided request and toolbox and tool selection criteria.

Parameters:
  • request (str) – The request for gathering tools.

  • box_choose_kwargs (Optional[ChooseKwargs]) – Keyword arguments for choosing toolboxes.

  • tool_choose_kwargs (Optional[ChooseKwargs]) – Keyword arguments for choosing tools.

Returns:

A list of tools gathered based on the provided request and selection criteria.

Return type:

List[Tool]

async gather_tools(request: str, **kwargs: Unpack[fabricatio_core.models.kwargs_types.ChooseKwargs[fabricatio_tool.models.tool.Tool]]) List[fabricatio_tool.models.tool.Tool]

Asynchronously gathers tools based on the provided request.

Parameters:
  • request (str) – The request for gathering tools.

  • **kwargs (Unpack[ChooseKwargs]) – Keyword arguments for choosing tools.

Returns:

A list of tools gathered based on the provided request.

Return type:

List[Tool]