@@ -829,14 +829,29 @@ def check_llm_command(
829
829
830
830
Available tools:
831
831
"""
832
- print (npc .tools_dict , type (npc .tools_dict ))
833
- if npc .tools_dict is None or npc .tools_dict == {}:
832
+
833
+ if (npc .tools_dict is None or npc .tools_dict == {}) & (
834
+ npc .all_tools_dict is None or npc .all_tools_dict == {}
835
+ ):
834
836
prompt += "No tools available. Do not invoke tools."
835
837
else :
836
- for tool_name , tool in npc .tools_dict .items ():
838
+ tools_set = {}
839
+
840
+ if npc .tools_dict is not None :
841
+ for tool_name , tool in npc .tools_dict .items ():
842
+ if tool_name not in tools_set :
843
+ tools_set [tool_name ] = tool .description
844
+ if npc .all_tools_dict is not None :
845
+ for tool_name , tool in npc .all_tools_dict .items ():
846
+ if tool_name not in tools_set :
847
+ tools_set [tool_name ] = tool .description
848
+
849
+ for tool_name , tool_description in tools_set .items ():
837
850
prompt += f"""
838
- { tool_name } : { tool .description } \n
839
- """
851
+
852
+ { tool_name } : { tool_description } \n
853
+ """
854
+
840
855
prompt += f"""
841
856
Available NPCs for alternative answers:
842
857
@@ -1101,9 +1116,9 @@ def check_llm_command(
1101
1116
elif action == "execute_sequence" :
1102
1117
tool_names = response_content_parsed .get ("tool_name" )
1103
1118
npc_names = response_content_parsed .get ("npc_name" )
1104
- print (npc_names )
1119
+ # print(npc_names)
1105
1120
npcs = []
1106
- print (tool_names , npc_names )
1121
+ # print(tool_names, npc_names)
1107
1122
if isinstance (npc_names , list ):
1108
1123
for npc_name in npc_names :
1109
1124
for npc_obj in npc .resolved_npcs :
@@ -1192,9 +1207,8 @@ def handle_tool_call(
1192
1207
"""
1193
1208
# print(npc)
1194
1209
print ("handling tool call" )
1195
- if not npc or (not npc .all_tools_dict and not npc .tools_dict ):
1196
- print ("not available" )
1197
- available_tools = npc .all_tools_dict if npc else None
1210
+ if not npc :
1211
+
1198
1212
print (
1199
1213
f"No tools available for NPC '{ npc .name } ' or tools_dict is empty. Available tools: { available_tools } "
1200
1214
)
0 commit comments