Skip to content

entry_points

Class info

Classes

Name Children Inherits
EntryPointTools
llmling.tools.entry_points
Collection of tools from entry points.

    🛈 DocStrings

    Entry point based toolset implementation.

    EntryPointTools

    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