praisonaiagents 0.0.26__tar.gz → 0.0.27__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/PKG-INFO +1 -1
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/agent/agent.py +33 -11
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/PKG-INFO +1 -1
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/pyproject.toml +1 -1
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/agent/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/agents/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/agents/agents.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agent/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agent/agent.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agents/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/agents/agents.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/main.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/task/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/task/task.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/main.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/process/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/process/process.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/task/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/task/task.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/__init__.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/arxiv_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/calculator_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/csv_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/duckdb_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/duckduckgo_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/excel_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/file_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/json_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/newspaper_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/pandas_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/python_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/shell_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/spider_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/test.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/wikipedia_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/xml_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/yaml_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/tools/yfinance_tools.py +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/SOURCES.txt +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/dependency_links.txt +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/requires.txt +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/top_level.txt +0 -0
- {praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/setup.cfg +0 -0
@@ -18,6 +18,7 @@ from ..main import (
|
|
18
18
|
client,
|
19
19
|
error_logs
|
20
20
|
)
|
21
|
+
import inspect
|
21
22
|
|
22
23
|
if TYPE_CHECKING:
|
23
24
|
from ..task.task import Task
|
@@ -67,9 +68,24 @@ class Agent:
|
|
67
68
|
return None
|
68
69
|
|
69
70
|
import inspect
|
71
|
+
# Langchain tools
|
72
|
+
if inspect.isclass(func) and hasattr(func, 'run'):
|
73
|
+
original_func = func
|
74
|
+
func = func.run
|
75
|
+
function_name = original_func.__name__
|
76
|
+
|
70
77
|
sig = inspect.signature(func)
|
71
78
|
logging.debug(f"Function signature: {sig}")
|
72
79
|
|
80
|
+
# Skip self, *args, **kwargs, so they don't get passed in arguments
|
81
|
+
parameters_list = []
|
82
|
+
for name, param in sig.parameters.items():
|
83
|
+
if name == "self":
|
84
|
+
continue
|
85
|
+
if param.kind in (inspect.Parameter.VAR_POSITIONAL, inspect.Parameter.VAR_KEYWORD):
|
86
|
+
continue
|
87
|
+
parameters_list.append((name, param))
|
88
|
+
|
73
89
|
parameters = {
|
74
90
|
"type": "object",
|
75
91
|
"properties": {},
|
@@ -95,7 +111,7 @@ class Agent:
|
|
95
111
|
|
96
112
|
logging.debug(f"Parameter descriptions: {param_descriptions}")
|
97
113
|
|
98
|
-
for name, param in
|
114
|
+
for name, param in parameters_list:
|
99
115
|
param_type = "string" # Default type
|
100
116
|
if param.annotation != inspect.Parameter.empty:
|
101
117
|
if param.annotation == int:
|
@@ -249,25 +265,31 @@ Your Goal: {self.goal}
|
|
249
265
|
# Try to find the function in the agent's tools list first
|
250
266
|
func = None
|
251
267
|
for tool in self.tools:
|
252
|
-
if callable(tool) and getattr(tool, '__name__', '') == function_name
|
268
|
+
if (callable(tool) and getattr(tool, '__name__', '') == function_name) or \
|
269
|
+
(inspect.isclass(tool) and tool.__name__ == function_name):
|
253
270
|
func = tool
|
254
271
|
break
|
255
272
|
|
256
|
-
|
257
|
-
|
258
|
-
# If not found in tools, try globals and main
|
259
|
-
if not func:
|
273
|
+
if func is None:
|
274
|
+
# If not found in tools, try globals and main
|
260
275
|
func = globals().get(function_name)
|
261
|
-
logging.debug(f"Looking for {function_name} in globals: {func is not None}")
|
262
|
-
|
263
276
|
if not func:
|
264
277
|
import __main__
|
265
278
|
func = getattr(__main__, function_name, None)
|
266
|
-
logging.debug(f"Looking for {function_name} in __main__: {func is not None}")
|
267
279
|
|
268
|
-
if func
|
280
|
+
if func:
|
269
281
|
try:
|
270
|
-
|
282
|
+
# If it's a class with run method, instantiate and call run
|
283
|
+
if inspect.isclass(func) and hasattr(func, 'run'):
|
284
|
+
instance = func()
|
285
|
+
# Extract only the parameters that run() expects
|
286
|
+
run_params = {k: v for k, v in arguments.items()
|
287
|
+
if k in inspect.signature(instance.run).parameters
|
288
|
+
and k != 'self'}
|
289
|
+
return instance.run(**run_params)
|
290
|
+
# Otherwise treat as regular function
|
291
|
+
elif callable(func):
|
292
|
+
return func(**arguments)
|
271
293
|
except Exception as e:
|
272
294
|
error_msg = str(e)
|
273
295
|
logging.error(f"Error executing tool {function_name}: {error_msg}")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents/build/lib/praisonaiagents/main.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{praisonaiagents-0.0.26 → praisonaiagents-0.0.27}/praisonaiagents.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|