Toolset#

class scikitplot.agent.Toolset(tools=())[source]#

The tools one agent may call, by name.

Parameters:
toolsiterable of Tool, default=()

Names must be distinct.

Raises:
TypeError

If an item is not a Tool.

ValueError

If two tools share a name.

Parameters:

tools (Iterable[Tool])

Examples

>>> from scikitplot.agent import Tool, Toolset
>>> tools = Toolset([Tool("ping", lambda: "pong")])
>>> "ping" in tools, len(tools), tools.names()
(True, 1, ('ping',))
describe()[source]#

Return Tool.describe of every tool, sorted by name.

Return type:

list[dict[str, Any]]

get(name)[source]#

Return the tool named name, or None.

Parameters:

name (str)

Return type:

Tool | None

names()[source]#

Return the tool names, sorted.

Return type:

tuple[str, …]