Skip to content

ToolSet

Sub classes

Name Children Inherits
EntryPointTools
llmling.tools.entry_points
Collection of tools from entry points.
    OpenAPITools
    llmling.tools.openapi
    Tool collection for OpenAPI endpoints.

      Base classes

      Name Children Inherits
      ABC
      abc
      Helper class that provides a standard way to create an ABC using

      ⋔ Inheritance diagram

      graph TD
        2761628901["toolsets.ToolSet"]
        925645236["abc.ABC"]
        2751680898["builtins.object"]
        925645236 --> 2761628901
        2751680898 --> 925645236

      🛈 DocStrings

      Bases: ABC

      Container class for related tools.

      Source code in src/llmling/tools/toolsets.py
      class ToolSet(ABC):
          """Container class for related tools."""
      
          @abstractmethod
          def get_tools(self) -> list[Callable[..., Any]]:
              """Get all tools from this toolset.
      
              Returns:
                  List of callables to be converted to LLMCallableTools
              """
              raise NotImplementedError
      
          def get_llm_callable_tools(self) -> list[LLMCallableTool]:
              """Get all tools as LLMCallableTools.
      
              Returns:
                  List of LLMCallableTools ready for registration
      
              Raises:
                  ValueError: If a tool cannot be converted
              """
              tools = []
              for method in self.get_tools():
                  try:
                      tool = LLMCallableTool.from_callable(method)
                      tools.append(tool)
                  except Exception as exc:
                      logger.exception("Failed to convert %s to LLMCallableTool", method)
                      msg = f"Failed to convert {getattr(method, '__name__', method)} to LLMCallableTool"
                      raise ValueError(msg) from exc
              return tools
      

      get_llm_callable_tools

      get_llm_callable_tools() -> list[LLMCallableTool]
      

      Get all tools as LLMCallableTools.

      Returns:

      Type Description
      list[LLMCallableTool]

      List of LLMCallableTools ready for registration

      Raises:

      Type Description
      ValueError

      If a tool cannot be converted

      Source code in src/llmling/tools/toolsets.py
      def get_llm_callable_tools(self) -> list[LLMCallableTool]:
          """Get all tools as LLMCallableTools.
      
          Returns:
              List of LLMCallableTools ready for registration
      
          Raises:
              ValueError: If a tool cannot be converted
          """
          tools = []
          for method in self.get_tools():
              try:
                  tool = LLMCallableTool.from_callable(method)
                  tools.append(tool)
              except Exception as exc:
                  logger.exception("Failed to convert %s to LLMCallableTool", method)
                  msg = f"Failed to convert {getattr(method, '__name__', method)} to LLMCallableTool"
                  raise ValueError(msg) from exc
          return tools
      

      get_tools abstractmethod

      get_tools() -> list[Callable[..., Any]]
      

      Get all tools from this toolset.

      Returns:

      Type Description
      list[Callable[..., Any]]

      List of callables to be converted to LLMCallableTools

      Source code in src/llmling/tools/toolsets.py
      @abstractmethod
      def get_tools(self) -> list[Callable[..., Any]]:
          """Get all tools from this toolset.
      
          Returns:
              List of callables to be converted to LLMCallableTools
          """
          raise NotImplementedError
      

      :fa-brands-github: Show source on GitHub