Spaces:
Running
Running
File size: 1,498 Bytes
f209a8f e2a452d f209a8f e2a452d f209a8f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | from importlib import import_module
__all__ = [
"Bash",
"AskUser",
"Edit",
"Glob",
"Grep",
"Read",
"ReadImage",
"ReadPDF",
"ScholarSearch",
"StrReplaceEditor",
"TerminalInterrupt",
"TerminalKill",
"TerminalRead",
"TerminalStart",
"TerminalWrite",
"WebFetch",
"WebSearch",
"Write",
]
_EXPORT_TO_MODULE = {
"Bash": "agent_base.tools.tool_runtime",
"AskUser": "agent_base.tools.tool_user",
"Edit": "agent_base.tools.tool_file",
"Glob": "agent_base.tools.tool_file",
"Grep": "agent_base.tools.tool_file",
"Read": "agent_base.tools.tool_file",
"ReadImage": "agent_base.tools.tool_file",
"ReadPDF": "agent_base.tools.tool_file",
"ScholarSearch": "agent_base.tools.tool_web",
"StrReplaceEditor": "agent_base.tools.tool_extra",
"TerminalInterrupt": "agent_base.tools.tool_runtime",
"TerminalKill": "agent_base.tools.tool_runtime",
"TerminalRead": "agent_base.tools.tool_runtime",
"TerminalStart": "agent_base.tools.tool_runtime",
"TerminalWrite": "agent_base.tools.tool_runtime",
"WebFetch": "agent_base.tools.tool_web",
"WebSearch": "agent_base.tools.tool_web",
"Write": "agent_base.tools.tool_file",
}
def __getattr__(name: str):
module_name = _EXPORT_TO_MODULE.get(name)
if module_name is None:
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
module = import_module(module_name)
return getattr(module, name)
|