转换原来的tools到新的(虽然没转)

This commit is contained in:
UnCLAS-Prommer
2025-07-29 00:15:29 +08:00
parent 6062b6bd3c
commit 16c644a666
10 changed files with 54 additions and 376 deletions

View File

@@ -10,7 +10,6 @@ install(extra_lines=3)
logger = get_logger("base_tool")
class BaseTool(ABC):
"""所有工具的基类"""
@@ -37,7 +36,7 @@ class BaseTool(ABC):
"type": "function",
"function": {"name": cls.name, "description": cls.description, "parameters": cls.parameters},
}
@classmethod
def get_tool_info(cls) -> ToolInfo:
"""获取工具信息"""
@@ -79,7 +78,7 @@ class BaseTool(ABC):
Returns:
dict: 工具执行结果
"""
"""
if self.parameters and (missing := [p for p in self.parameters.get("required", []) if p not in function_args]):
raise ValueError(f"工具类 {self.__class__.__name__} 缺少必要参数: {', '.join(missing)}")

View File

@@ -195,7 +195,7 @@ class ComponentRegistry:
def _register_tool_component(self, tool_info: ToolInfo, tool_class: Type[BaseTool]) -> bool:
"""注册Tool组件到Tool特定注册表"""
tool_name = tool_info.name
self._tool_registry[tool_name] = tool_class
# 如果是llm可用的且启用的工具,添加到 llm可用工具列表