Spaces:
Sleeping
Sleeping
Create base_tool.py
Browse files- tools/base_tool.py +16 -0
tools/base_tool.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class BaseTool:
|
| 2 |
+
"""
|
| 3 |
+
A base class that defines the interface for tools.
|
| 4 |
+
Each tool should define:
|
| 5 |
+
- name: Unique identifier for the tool
|
| 6 |
+
- description: What the tool does
|
| 7 |
+
- inputs: A dictionary describing input arguments
|
| 8 |
+
- output_type: The expected output format
|
| 9 |
+
"""
|
| 10 |
+
name: str
|
| 11 |
+
description: str
|
| 12 |
+
inputs: dict
|
| 13 |
+
output_type: str
|
| 14 |
+
|
| 15 |
+
def forward(self, *args, **kwargs):
|
| 16 |
+
raise NotImplementedError("Each tool must implement the forward method.")
|