mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-02 22:02:13 +08:00
feat: add tools
This commit is contained in:
3
backend/src/tools/__init__.py
Normal file
3
backend/src/tools/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .tools import get_available_tools
|
||||
|
||||
__all__ = ["get_available_tools"]
|
||||
14
backend/src/tools/tools.py
Normal file
14
backend/src/tools/tools.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from langchain.tools import BaseTool
|
||||
|
||||
from src.config import get_app_config
|
||||
from src.reflection import resolve_variable
|
||||
|
||||
|
||||
def get_available_tools(groups: list[str] | None = None) -> list[BaseTool]:
|
||||
"""Get all available tools from config"""
|
||||
config = get_app_config()
|
||||
return [
|
||||
resolve_variable(tool.use, BaseTool)
|
||||
for tool in config.tools
|
||||
if groups is None or tool.group in groups
|
||||
]
|
||||
Reference in New Issue
Block a user