Skip to content

Commit 9d6f9ac

Browse files
authored
fix tool import bugs (#438)
1 parent 3effcd8 commit 9d6f9ac

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

modelscope_agent/agent.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _register_tool(self,
124124

125125
# check if the tenant_id of tool instance or tool service are exists
126126
# TODO: change from use_tool_api=True to False, to get the tenant_id of the tool changes to
127-
if tenant_id in tool_class_with_tenant:
127+
if tenant_id in tool_class_with_tenant and self.use_tool_api:
128128
return
129129

130130
try:

modelscope_agent/tools/base.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ def __contains__(self, key):
118118
def register_tool(name):
119119

120120
def decorator(cls):
121-
if name not in TOOL_REGISTRY:
122-
TOOL_REGISTRY[name] = {}
123-
TOOL_REGISTRY[name]['class'] = cls
121+
TOOL_REGISTRY[name] = {'class': cls}
124122
return cls
125123

126124
return decorator

0 commit comments

Comments
 (0)