BaseTool
Sub classes
| Name |
Children |
Inherits |
ChainTool llmling.core.chain Advanced tool pipeline execution system for LLMling. |
|
|
Base classes
| Name |
Children |
Inherits |
LLMCallableTool llmling.tools.base LLMCallableTool(callable: collections.abc.Callable[P, TReturnType], name: str, description: str \= '', import_path: str | None \= None, schema_override: schemez.functionschema.typedefs.OpenAIFunctionDefinition | None \= None, hints: llmling.config.models.ToolHints | None \= None) |
|
|
⋔ Inheritance diagram
graph TD
3540451753["base.BaseTool"]
477531674["base.LLMCallableTool"]
3481597255["typing.Generic"]
2751680898["builtins.object"]
477531674 --> 3540451753
3481597255 --> 477531674
2751680898 --> 3481597255
🛈 DocStrings
Bases: LLMCallableTool
Base class for complex tools requiring inheritance.
Source code in src/llmling/tools/base.py
| class BaseTool(LLMCallableTool):
"""Base class for complex tools requiring inheritance."""
name: ClassVar[str] # ty: ignore[incompatible-attribute-override]
description: ClassVar[str] # ty: ignore[incompatible-attribute-override]
supported_mime_types: ClassVar[list[str]] = ["text/plain"]
@classproperty # type: ignore
def import_path(cls) -> str: # noqa: N805
"""Get the import path of the tool class."""
return f"{cls.__module__}.{cls.__qualname__}" # type: ignore
def get_schema(self) -> schemez.OpenAIFunctionTool:
"""Get OpenAI function schema."""
schema = schemez.create_schema(self.execute).model_dump_openai()
schema["function"]["name"] = self.name
schema["function"]["description"] = self.description
return schema
async def execute(self, **params: Any) -> Any:
"""Execute the tool."""
raise NotImplementedError
|
execute(**params: Any) -> Any
Execute the tool.
Source code in src/llmling/tools/base.py
| async def execute(self, **params: Any) -> Any:
"""Execute the tool."""
raise NotImplementedError
|
get_schema() -> OpenAIFunctionTool
Get OpenAI function schema.
Source code in src/llmling/tools/base.py
| def get_schema(self) -> schemez.OpenAIFunctionTool:
"""Get OpenAI function schema."""
schema = schemez.create_schema(self.execute).model_dump_openai()
schema["function"]["name"] = self.name
schema["function"]["description"] = self.description
return schema
|
Get the import path of the tool class.
Source code in src/llmling/tools/base.py
| @classproperty # type: ignore
def import_path(cls) -> str: # noqa: N805
"""Get the import path of the tool class."""
return f"{cls.__module__}.{cls.__qualname__}" # type: ignore
|
:fa-brands-github: Show source on GitHub