EntryPointTools
Base classes
| Name |
Children |
Inherits |
ToolSet llmling.tools.toolsets Container class for related tools. |
|
|
⋔ Inheritance diagram
graph TD
2134509036["entry_points.EntryPointTools"]
2761628901["toolsets.ToolSet"]
925645236["abc.ABC"]
2751680898["builtins.object"]
2761628901 --> 2134509036
925645236 --> 2761628901
2751680898 --> 925645236
🛈 DocStrings
Bases: ToolSet
Collection of tools from entry points.
Source code in src/llmling/tools/entry_points.py
| class EntryPointTools(ToolSet):
"""Collection of tools from entry points."""
def __init__(self, module: str) -> None:
"""Initialize entry point tools.
Args:
module: Module name to load tools from
"""
from epregistry import EntryPointRegistry
self.module = module
self._tools: list[Callable[..., Any]] = []
self.registry = EntryPointRegistry[Callable[..., Any]]("llmling")
self._load_tools()
def _load_tools(self) -> None:
"""Load tools from entry points."""
entry_point = self.registry.get("tools")
if not entry_point:
msg = f"No tools entry point found for {self.module}"
raise ValueError(msg)
get_tools = entry_point.load()
for item in get_tools():
try:
self._tools.append(item)
name = getattr(item, "__name__", str(item))
logger.debug("Loaded tool %s from entry point %s", name, self.module)
except Exception as exc: # noqa: BLE001
logger.warning("Failed to load tool from %s: %s", self.module, exc)
def get_tools(self) -> list[Callable[..., Any]]:
"""Get all tools loaded from entry points."""
return self._tools
|
__init__
__init__(module: str) -> None
Initialize entry point tools.
Parameters:
| Name |
Type |
Description |
Default |
module
|
str
|
Module name to load tools from
|
required
|
Source code in src/llmling/tools/entry_points.py
| def __init__(self, module: str) -> None:
"""Initialize entry point tools.
Args:
module: Module name to load tools from
"""
from epregistry import EntryPointRegistry
self.module = module
self._tools: list[Callable[..., Any]] = []
self.registry = EntryPointRegistry[Callable[..., Any]]("llmling")
self._load_tools()
|
get_tools
get_tools() -> list[Callable[..., Any]]
Get all tools loaded from entry points.
Source code in src/llmling/tools/entry_points.py
| def get_tools(self) -> list[Callable[..., Any]]:
"""Get all tools loaded from entry points."""
return self._tools
|
:fa-brands-github: Show source on GitHub