praisonaiagents 0.0.11__py3-none-any.whl → 0.0.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- praisonaiagents/agent/agent.py +23 -7
- {praisonaiagents-0.0.11.dist-info → praisonaiagents-0.0.12.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.11.dist-info → praisonaiagents-0.0.12.dist-info}/RECORD +5 -5
- {praisonaiagents-0.0.11.dist-info → praisonaiagents-0.0.12.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.11.dist-info → praisonaiagents-0.0.12.dist-info}/top_level.txt +0 -0
praisonaiagents/agent/agent.py
CHANGED
@@ -197,20 +197,36 @@ class Agent:
|
|
197
197
|
"""
|
198
198
|
logging.debug(f"{self.name} executing tool {function_name} with arguments: {arguments}")
|
199
199
|
|
200
|
-
# Try to
|
201
|
-
func =
|
200
|
+
# Try to find the function in the agent's tools list first
|
201
|
+
func = None
|
202
|
+
for tool in self.tools:
|
203
|
+
if callable(tool) and getattr(tool, '__name__', '') == function_name:
|
204
|
+
func = tool
|
205
|
+
break
|
206
|
+
|
207
|
+
logging.debug(f"Looking for {function_name} in agent tools: {func is not None}")
|
208
|
+
|
209
|
+
# If not found in tools, try globals and main
|
202
210
|
if not func:
|
203
|
-
|
204
|
-
|
205
|
-
|
211
|
+
func = globals().get(function_name)
|
212
|
+
logging.debug(f"Looking for {function_name} in globals: {func is not None}")
|
213
|
+
|
214
|
+
if not func:
|
215
|
+
import __main__
|
216
|
+
func = getattr(__main__, function_name, None)
|
217
|
+
logging.debug(f"Looking for {function_name} in __main__: {func is not None}")
|
206
218
|
|
207
219
|
if func and callable(func):
|
208
220
|
try:
|
209
221
|
return func(**arguments)
|
210
222
|
except Exception as e:
|
211
|
-
|
223
|
+
error_msg = str(e)
|
224
|
+
logging.error(f"Error executing tool {function_name}: {error_msg}")
|
225
|
+
return {"error": error_msg}
|
212
226
|
|
213
|
-
|
227
|
+
error_msg = f"Tool '{function_name}' is not callable"
|
228
|
+
logging.error(error_msg)
|
229
|
+
return {"error": error_msg}
|
214
230
|
|
215
231
|
def clear_history(self):
|
216
232
|
self.chat_history = []
|
@@ -1,7 +1,7 @@
|
|
1
1
|
praisonaiagents/__init__.py,sha256=gI8vEabBTRPsE_E8GA5sBMi4sTtJI-YokPrH2Nor-k0,741
|
2
2
|
praisonaiagents/main.py,sha256=zDhN5KKtKbfruolDNxlyJkcFlkSt4KQkQTDRfQVAhxc,3960
|
3
3
|
praisonaiagents/agent/__init__.py,sha256=sKO8wGEXvtCrvV1e834r1Okv0XAqAxqZCqz6hKLiTvA,79
|
4
|
-
praisonaiagents/agent/agent.py,sha256=
|
4
|
+
praisonaiagents/agent/agent.py,sha256=hf9z2XwdUF5n_A1ztDM9qGvaKJj40SqJm9WblwLcKjI,20328
|
5
5
|
praisonaiagents/agents/__init__.py,sha256=7RDeQNSqZg5uBjD4M_0p_F6YgfWuDuxPFydPU50kDYc,120
|
6
6
|
praisonaiagents/agents/agents.py,sha256=CBN7OQwFbTgiKXVn7o8987mBH9TUr5s721AC-FSu8AQ,13680
|
7
7
|
praisonaiagents/build/lib/praisonaiagents/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
|
@@ -14,7 +14,7 @@ praisonaiagents/build/lib/praisonaiagents/task/__init__.py,sha256=VL5hXVmyGjINb3
|
|
14
14
|
praisonaiagents/build/lib/praisonaiagents/task/task.py,sha256=4Y1qX8OeEFcid2yhAiPYylvHpuDmWORsyNL16_BiVvI,1831
|
15
15
|
praisonaiagents/task/__init__.py,sha256=VL5hXVmyGjINb34AalxpBMl-YW9m5EDcRkMTKkSSl7c,80
|
16
16
|
praisonaiagents/task/task.py,sha256=4Y1qX8OeEFcid2yhAiPYylvHpuDmWORsyNL16_BiVvI,1831
|
17
|
-
praisonaiagents-0.0.
|
18
|
-
praisonaiagents-0.0.
|
19
|
-
praisonaiagents-0.0.
|
20
|
-
praisonaiagents-0.0.
|
17
|
+
praisonaiagents-0.0.12.dist-info/METADATA,sha256=ci_5OYkXaI9I_O1sMV3-P-i-Gi9jX9S_GzDXCNrnV8Y,233
|
18
|
+
praisonaiagents-0.0.12.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
19
|
+
praisonaiagents-0.0.12.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
|
20
|
+
praisonaiagents-0.0.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|